Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

ComCtrls (i.e. TTreeView, TComboBox) loosing data when changing parent away from TLMDDockPanel

To get this to happen, the code that changes the controls parent should be in an action and executed from a ribbon (there may be other ways but I do know if definitely does not happen from a TButton.OnClick event).

Also, the control that is being moved must currently have the focus.

Please find the attached project to see a TListView loose its items when moving from a TLMDDockPanel but not when it is moved from a TPanel.

I have found a workaround that is external to LMD code but am not happy with it. What is the best workaround you can suggest?

I also found that this can be fixed in LMD code by bypassing TLMDDockPanel.SetParent if the parent is not changing but I don't know what else this might do! i.e..

  procedure TLMDDockPanel.SetParent(...
  begin
    if AParent = Parent then
      Exit;

Hope that helps and hope to hear back soon.

Eddie.

Comments

  • 9 Comments sorted by Votes Date Added
  • Don't think I can attach files... It just says "uploading" and goes nowhere (the file's only 6k)! Also the site says I need to confirm email address but I have done successfully more than once! That may have something to do with it?
  • Simply send attachements to mail@lmdsupprt.com. If you send zip/exe files, make sure you rename files (e.g. to myfile(dot).zip, otherwise attachement will be blocked.
  • Have sent e-mail with attachment included.
  • Nothing received yet. Maybe because my typo (however: It is standard support mail address):
    mail@lmdsupport.com
  • Hi,

    I have several things to note:

    1) TTreeView and TCmboBox bugs are known. Basically, they implemented so, that they breack VCL conventions. Specifically, they can not work without Parent (e.g. when their Parent = nil). So, this design is the source of all problms and there nothing to do.

    2) I'll incorporate your proposed code, e.g. if AParent = Parent then Exit, so I hope this will help you.

    3) I do not tried with ribbons, however, I think a simple TSpeedButton will do the same (because it does not take a focus to itself before click event, unlike standard button do). So, I've tried to do MyDockPanel.ManualFloat(...) and all worked well. So, the question: what exactly you do with panel's parent?

    4) I think the file should be called "myfile(dot)zip", e.g. without real dot char...
  • Hi again,

    Re-sent e-mail. Hope it gets through this time!

    Otherwise, in reply to the above:

    1. Yes, agree, can not modify data in these components when parent = nil, but changing parent should retain data, even if changing through nil!

    2. Thanks very much. When is the next release due?

    3. I didn't know that about TSpeedButton but will bear that in mind... and yes, the focus change is the crux of the problem! In my case, as you will hopefully see from the attachment, the parent of the controls is being set to move them from a dock panel to a form. In our actual project code, the control that first showed the problem is inside a TPanel which is inside a TFrame and it is the TFrame that is changing parent... I have just condensed the problem to a simpler form in the example code.

    4. Yup, I guessed as much... It was the email address that I got wrong!

    Thanks again for you help with this,

    Kind Regards,

    Eddie
  • Your file is received, I'm looking...
  • Posts: 0 Accepted Answer Vote Up0Vote Down
    I've tested your demo. Now error does not occures. 
    I don't know when exactly the next release will occure, but since you reported me a fix, I think, you are able to work with your own fix for now (because I've just copied your lines :) ).
Sign In or Register to comment.