Jump to content

David Heffernan

Members
  • Content Count

    3701
  • Joined

  • Last visited

  • Days Won

    185

Everything posted by David Heffernan

  1. David Heffernan

    RttiContext Create and Free

    I don't follow that Stefan.
  2. David Heffernan

    Pointers... loops...

    Type delphi pointers into a search engine and start there. I'm sure there will be a mix of hits. Some better than others. Read the top 10, form a view on which are good and which are not. Reread the good ones.
  3. David Heffernan

    Pointers... loops...

    This has to be, in my opinion, one of the worst pieces of advice I have ever come across.
  4. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    It is the same if you do it right. You didn't. Your code set the popup parent to be the application handle. But we were previously talking about making the main form the popup parent. You even had a potldt claiming to have done this but then your code told a different story. It doesn't. Setting WndParent doesn't fix your issue. It is setting WndParent to be the application handle that changes the behaviour. The reason that it changes the behaviour is that with application handle as popup parent then the dialog is not made visible when the main form is made visible. But, as I have explained before, if the application handle is the popup parent then the system won't guarantee that the dialog is always in front of the main form. I think I've said this a few times before, but I do believe that it's important to understand what popup parent does, and why it is important. My advice to you is to do some research on what popup parent actually is and why it is important to set it, with particular focus on modal dialogs.
  5. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    There seems to be some confusion. You asked about why setting PopupParent to be the main form resulted in different behaviour from setting WndParent to the main form handle in CreateParams. However, the two example projects you provided did not differ in that way. In those projects the only difference is that one of them sets WndParent to be the application handle. And you'd expect different behaviour in that case.
  6. David Heffernan

    Pointers... loops...

    The API will be documented. It's essential that you use that documentation.
  7. David Heffernan

    RttiContext Create and Free

    You don't need to worry about even that because the dynamic memory associated with RTTI is ref counted and the refs will go to zero when the module is unloaded.
  8. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    Perhaps you could provide a minimal example of these two variants so we can see exactly what you are doing.
  9. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    But when you make the application handle the popup parent, there's nothing to keep the modal form on top of the main form. This conversation is going nowhere. You really do need to understand what popup parent is.
  10. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    You don't want to make the application window the popup parent. Then your dialog can appear behind the main form. You want the main form to be the popup parent. Which you can do in CreateParams, or by setting PopupParent. It's important that you understand what popup parent aka Window owner in Windows terminology means. At the moment you seem to be trying stuff without understanding it. I think I already explained that destroying the window is the key to getting the behaviour you want. I gave you two options for doing that.
  11. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    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?
  12. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    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.
  13. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    FWIW it is less nasty if you pass the main form as the owner of the dialog when you create it. You pass Application as the owner. Actually, I'm not sure that's true having played around a bit more.
  14. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    It's worth pointing out that this preview is drawn by the system. It's entirely plausible that there's nothing that Embarcadero could do to change the behaviour.
  15. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    OK. Carry on the way you are doing it, and accept the preview oddity. I'm just trying to describe how to avoid that. But maybe it's less important to you.
  16. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    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.
  17. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

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

    SetFocus issue

    Well, I guess it's clear now that the issue is not Delphi, but rather what your ActiveX control does. Perhaps it's worth asking the vendor.
  19. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    What is the downside of creating the form when you need it and destroying it when it is closed?
  20. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    Destroy the form when you close it. It's as simple as that. If you want to preserve some state between invocations, put that in a separate object. Forms should just present views anyway, and not be part of your apps business logic.
  21. David Heffernan

    SetFocus issue

    That's not an issue with focus. It's an issue with window owner, or popup parent in VCL terminology.
  22. David Heffernan

    SetFocus issue

    What happens if you don't call LoadFile?
  23. David Heffernan

    optset files

    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.
  24. David Heffernan

    Form no longer repaints after WM_SETREDRAW

    This is the wrong way to deal with flicker. Do it the right way and this problem vanishes.
  25. David Heffernan

    jpg validation

    I'd start by identifying the problem. Don't try to solve problems you don't understand.
×