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?
Mailing lists / lazarus / 2012-07
Need help to get IDE forms object
8 messages · 3 people · –
- Lleledumbo 4
- MMartin 3
- MMattias Gaertner 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
leledumbo wroteI 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, ...)
);That could be of help, but only for the source editor. Isn't there any universal way?
leledumbo wroteThat 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.
I need to get the object (TCustomForm) of IDE forms, namely object inspector, code…
Show quoted text 9 lines
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
Mattias Gaertner wrote 13 lines
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
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.
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.
