[Lazarus] IDE docking flaw?
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Mon Jun 6 03:06:46 CEST 2011
In an attempt to document some IDE internals, I came across the
following code in IdeWindowIntf.TIDEWindowCreatorList.ShowForm:
if (IDEDockMaster<>nil) and (not (csDesigning in AForm.ComponentState))
and (FindWithName(AForm.Name)<>nil) then
// show dockable if it has a creator and is not a designer form
IDEDockMaster.ShowForm(AForm,BringToFront)
else if Assigned(OnShowForm) then
OnShowForm(Self,AForm,BringToFront)
else if BringToFront then
AForm.ShowOnTop
else
AForm.Visible:=true;
This bypasses OnShowForm, when a DockMaster is installed. Is this
intended? What's the purpose of OnShowForm?
IMO the DockMaster should not be involved in ShowForm, this method is
called too often in the IDE code. The only situations, where the
DockMaster really is involved, are:
- MakeWindowDockable
- MakeWindowDockSite
- Save/RestoreLayout[1]
ShowForm should handle (already) docked forms by means of
TWinControl.ShowControl, which e.g. already handles forms in notebook
pages (switches to the according page). I'd add the following features
to ShowControl:
- make it public
- add an BringToFront parameter (default True?)
- also make parents visible
- when called with AControl=nil, show itself
The last item means: when the form has no parent,
form.Parent.ShowControl(form) is not applicable. This special situation
can be handled in ShowControl, when called as form.ShowControl(nil), so
that the caller doesn't have to care. I can supply an according patch,
if you like.
Then TIDEWindowCreatorList.ShowForm can invoke AForm.ShowControl(nil,
BringToFront) instead of figuring out what should happen.
[1] As long as dockable forms are not supported by all platforms,
dockable forms have to be wrapped into a floating form, which offers
means to start docking the contained control. Since such floating sites
are handled by the DockMaster, all dockable forms are part of the
DockMaster layout, regardless of really docked or floating. The
remaining non-modal IDE forms are all docksites, which also are handled
by the DockMatster. This means that a DockMaster can restore the
complete IDE layout, when e.g. called from
IDEWindowCreators.RestoreSimpleLayout.
DoDi
More information about the Lazarus
mailing list