Jump to content

David Heffernan

Members
  • Content Count

    3534
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by David Heffernan


  1. I don't understand what you mean with these two handles. I guess you are talking about the popup parent. You can set this more easily with the VCL PopupParent property. The right thing to set it to is the main form. 

     

    Do you understand what the popup parent is, aka window owner in Windows terminology? 


  2. So I think that this behaviour happens because the window is not destroyed.  If you make the analagous WinForms app then you don't see this behaviour.  I believe that's because that framework destroys the window when the modal dialog is closed.

     

    You can achieve the same thing by, guess what, destroying the form object.  That's really the best approach.  I can't stress strongly enough that's what you should do.

     

    You could also achieve the same effect by forcing the window to be destroyed.  Call DestroyWindow on the modal form when it closes.  That forces windows recreation the next time you show it.  Perhaps that's safe to do.  I wouldn't do it.  I'd do it the right way.

     

    Embarcadero are never going to "fix" this because it would require a complete redesign of the VCL.  Not going to happen.  

    • Like 1

  3. So store the data in a collection and populate from that. Instant. And it's better not to use visual controls as data stores. They should just present views. Destroying the form when you close it solves your problem. And the performance issue is easily dealt with as I have described. 

    • Like 1

  4. 1 hour ago, McScotty said:

    The downside is simply speed.  If you have to fill a combobox with names for instance, doing this only once per application session is advantageous rather than destroying and having to fill the combo boxes again and again... 

    Not so. Populating a combo takes no discernible time. Try measuring it. 

    • Like 1

  5. I use them to apply the same options to all my various projects. They work quite nicely. It means that if ever I change an option, or make a new project, I can roll it out effortlessly, and with confidence. 

    • Like 2

  6. I'd want to fix the code first. There should be two try/finally blocks and no try/except block. 

     

    MotionBitmap1.Canvas.Lock;

    try

      jpeg := TJPEGImage.Create;

      try

        jpeg.Assign(MotionBitmap1);

        jpeg.SaveToFile('D:\picture.jpg');

      finally

        jpeg.Free;

      end;

    finally 

      MotionBitmap1.Canvas.Unlock;

    end;

     

    And I don't know whether or not the lock/unlock is necessary. Why did you include it?

     

    As for checking whether or not it worked, there's no point. What failure more do you have in mind? 

    • Like 1

  7. I've not ever looked at this function but it's not hard to see what must be going on. There is no 4 byte string type. So you'll be getting a dynamic array back. And there will be a null terminator as there is for all non short string types. But since there is no compiler support for treating the type as a string, you just get the dyn array length function, which counts the null terminator. 

    • Like 2
    • Thanks 1

  8. 9 hours ago, Darian Miller said:

    There are plenty of differences beyond basic code checks...   File I/O, socket implementation, authentication, database drivers, etc

    I don't see how any of that impacts a unit testing library. 

     

    9 hours ago, Darian Miller said:

    Also - many people test GUI interactions with DUnit which is VCL based.  There needs to be a FMX based version.

       

    I wouldn't describe that as unit testing.

     

    My take is that the if we had a single language then a well written library would naturally be cross platform. But Dalija is right, there are two languages, ARC and non ARC. 

     

    And you are also right about the runners. If you expect GUI then they could require distinct UI. 

×