Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-07

Need help to get IDE forms object

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo

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?

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Need-help-to-get-IDE-forms-object-tp4024867.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Martin
to leledumbo
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, ...)

   );

Reply by email

Martin
to leledumbo
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.

Reply by email

Mattias Gaertner
to leledumbo: I need to get the object (TCustomForm) of IDE forms, namely object inspector, code…
Show quoted text 9 lines
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

Reply by email

Martin
to Mattias Gaertner
Mattias Gaertner wrote 13 lines
On Fri, 20 Jul 2012 10:30:38 -0700 (PDT) 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: 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

Reply by email

leledumbo
to Mattias Gaertner: On Fri, 20 Jul 2012 10:30:38 -0700 (PDT) Either implement an IDEDockMaster, see for…
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.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Need-help-to-get-IDE-forms-object-tp4024867p4024889.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

leledumbo
to leledumbo

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.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Need-help-to-get-IDE-forms-object-tp4024867p4024894.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email