Need help to get IDE forms object

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help to get IDE forms object

leledumbo
Administrator
I need to get the object (TCustomForm) of IDE forms, namely object inspector, code explorer and source notebook. I need this to help a docking solution (kzdesktop: http://forum.lazarus.freepascal.org/index.php/topic,16736.0.html) to work. The successful way in 0.9.30.4 which is not working on 1.1 is to use Screen.FindForm called in main IDE's OnShow event, because at this time on 1.1, those forms aren't created yet. If it's already correct, then when is the correct time (on which event) to call Screen.FindForm? If not, what's the correct way?
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

Martin Frb
On 20/07/2012 18:30, leledumbo wrote:
> I need to get the object (TCustomForm) of IDE forms, namely object inspector,
> code explorer and source notebook. I need this to help a docking solution
> (kzdesktop:

For the SourceEditor there is an event system:

unit SrcEditorIntf  (Package IdeIntf)
var SourceEditorManagerIntf

   SourceEditorManagerIntf.RegisterChangeEvent(semWindowCreate, method);

And also check for closing windows.
There can be several. The one that was docked can be destroyed, and
others opened instead.

     procedure RegisterChangeEvent(AReason: TsemChangeReason; AHandler:
TNotifyEvent); virtual; abstract;
     procedure UnRegisterChangeEvent(AReason: TsemChangeReason;
AHandler: TNotifyEvent); virtual; abstract;

   TsemChangeReason = (
     semWindowCreate,    // Called after creation of a Window
     semWindowDestroy,   // Called after removal of a Window
     semWindowActivate,  // Window is now ActiveSourceWindow (does not
vave to be focused)
     semWindowFocused,   // The window became the active win of the
application
     semEditorCreate,    // Called after a new editor was created and
added to list
     semEditorDestroy,   // Called when an Editor is destroyed / after
it is removed fron the list of editors
     semEditorActivate,  // Editor is ActiveEditor
     semEditorStatus     // any status change of the editor (Caret,
Selection, topline, ...)
   );

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

leledumbo
Administrator
That could be of help, but only for the source editor. Isn't there any universal way?
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

Martin Frb
On 21/07/2012 00:40, leledumbo wrote:
> That could be of help, but only for the source editor. Isn't there any
> universal way?
>
>
Actually, why didnt I think of it.

unit IDEWindowIntf (also from package IdeIntf)
all windows should somehow be registered there.

But I don't know from top of my head, where you would need to hook your
code in.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

Mattias Gaertner
In reply to this post by leledumbo
On Fri, 20 Jul 2012 10:30:38 -0700 (PDT)
leledumbo <[hidden email]> wrote:

> I need to get the object (TCustomForm) of IDE forms, namely object inspector,
> code explorer and source notebook. I need this to help a docking solution
> (kzdesktop:
> http://forum.lazarus.freepascal.org/index.php/topic,16736.0.html) to work.
> The successful way in 0.9.30.4 which is not working on 1.1 is to use
> Screen.FindForm called in main IDE's OnShow event, because at this time on
> 1.1, those forms aren't created yet. If it's already correct, then when is
> the correct time (on which event) to call Screen.FindForm? If not, what's
> the correct way?

Either implement an IDEDockMaster, see for example anchordockingdsgn
package.

Or do it manually:
Connect the event LazarusIDE.AddHandlerOnIDERestoreWindows.
In this event create the forms you need at start up:

    AForm:=IDEWindowCreators.GetForm(FormName,true);

The FormName is one of 'MessagesView', 'CodeExplorerView',
'ProjectInspector', 'ObjectInspectorDlg'.

Dock them.


Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

Martin Frb
On 22/07/2012 22:50, Mattias Gaertner wrote:

> On Fri, 20 Jul 2012 10:30:38 -0700 (PDT)
> leledumbo <[hidden email]> wrote:
>
>> I need to get the object (TCustomForm) of IDE forms, namely object inspector,
>> code explorer and source notebook. I need this to help a docking solution
>> (kzdesktop:
> Either implement an IDEDockMaster, see for example anchordockingdsgn
> package.
>
> Or do it manually:
> Connect the event LazarusIDE.AddHandlerOnIDERestoreWindows.
> In this event create the forms you need at start up:
>

Note, that never mind how you get it. The SourceEditorWindow that you
got, can get destroyed during the IDE' s lifetime.

Once a 2nd SourceEditor is opened, and all the tabs in the 1st are
closed, then it will be destroyed

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

leledumbo
Administrator
In reply to this post by Mattias Gaertner
> Or do it manually:
Connect the event LazarusIDE.AddHandlerOnIDERestoreWindows.
In this event create the forms you need at start up:

    AForm:=IDEWindowCreators.GetForm(FormName,true);

The FormName is one of 'MessagesView', 'CodeExplorerView',
'ProjectInspector', 'ObjectInspectorDlg'.

AHA! I hope this is the correct one, I'll try soon.
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Need help to get IDE forms object

leledumbo
Administrator
It works! Yeah! Guess I'll need to explore LazarusIDE object, though working when the last source editor is closed the notebook is destroyed as well and on the next creation it doesn't get docked anymore. Furthermore, the form being designed is still flying around.