[Lazarus] IDE docking flaw?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jun 6 09:10:45 CEST 2011


On Mon, 06 Jun 2011 03:06:46 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> 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?

OnShowForm existed for compatibility, but it is now obsolete. I
removed it.

 
> 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]

Showing a form can restore the old position or putting it at a
default position. Your dockmaster don't need to implement the restore.

 
> 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

That would be Delphi incompatible. We have to create a new method for
this.

> - 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.

Such a function is indeed useful. What could be a good name?

 
> Then TIDEWindowCreatorList.ShowForm can invoke AForm.ShowControl(nil,
> BringToFront) instead of figuring out what should happen.

Showing can require docking. So ShowForm must use the dockmaster.

 
> [1] As long as dockable forms are not supported by all platforms,

Basically it works. I use the docked IDE under gtk2, qt and carbon.
I used it only a few times under Windows.


> 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.

What about the floating forms that are neither docksites nor dockable?

Mattias




More information about the Lazarus mailing list