Our forms need to intercept CM_DIALOGKEY for special processing of arrow and other keys. Because our form is parented by a TLMDFloatingForm that message does not get to our form, so we implemented our own TLMDFloatingForm descendant class and set TLMDDockPanel.FloatingDockSiteClass to our form class. It might be useful in other scenarios for users to implement their own floating form descendant.
That works well when a new floating form is created at runtime because of this code:
1. Create our form
2. Create a TLMDDockPanel
3. Call dockPanel.ManualFloat (implemented in TControl.ManualFloat) which calls TControl.CreateFloatingDockSite which contains this code:
Result := FloatingDockSiteClass.Create(Application);
4. Set our form Parent to dockPanel
This also works when dragging a docked form from TLMDDockSite out to become floating because of this code:
TLMDDragObject.Init
fscls := Control.FloatingDockSiteClass;
FDragForm := TLMDFloatingForm(fscls.Create(Application));
And I can also see that TLMDDockPanel.CMFloat contains this code but I am not sure when it is triggered:
fscls := TLMDFloatingForm;
if FloatingDockSiteClass.InheritsFrom(TLMDFloatingForm) then
fscls := FloatingDockSiteClass;
form := TLMDFloatingForm(fscls.Create(Application));
However it doesn't work when loading saved forms when calling TLMDDockManager.LoadFromFile because there is a hard-coded TLMDFloatingForm.CreateEx in TLMDDockManager.FindSite.
Request: Allow a custom floating form descendant when the forms are loaded from file.
Add the following to TLMDDockManager:
FFloatingDockSiteClass: TWinControlClass;
property FloatingDockSiteClass: TWinControlClass read FFloatingDockSiteClass write FFloatingDockSiteClass;
In TLMDDockManager.Create:
FFloatingDockSiteClass := TLMDFloatingForm;
In TLMDDockManager.FindSite:
fscls: TWinControlClass;
fscls := TLMDFloatingForm;
if FFloatingDockSiteClass.InheritsFrom(TLMDFloatingForm) then
fscls := FFloatingDockSiteClass;
form := TLMDFloatingForm(fscls.CreateEx(Application, Self));
Thank you.
Comments