Forum > Designer
How to insert a form in a unit and have the IDE manage it?
jamie:
I have question about later deciding to insert a Form in a UNIT that got started without any interacting with the IDE designer.
Is it possible to insert a form class into an existing unit and have it be managed by the IDE/OI ?
I don't mean in forms of editing the LFM file, is there an option to start a new form within an existing unit?
MarkMLl:
What happens if you add the relevant .pas file to the project?
I admit to being somewhat uncomfortable with this distinction between "form" and "unit", which is something that I've seen people making repeatedly (https://forum.lazarus.freepascal.org/index.php/topic,65825.0.html and so on). The important thing is the unit and the class (descendant of TForm) defined therein in the context of Object Pascal: the IDE should take note of the presence of that and (a) compile the associated .lfm into a collection of resources and (b) use those resources to populate a form at program startup.
MarkMLl
jamie:
That's just it, I don't have a Form already in the process, I have a unit that I would like to have a visiual editable form in it now.
I just put in
TMYFORM = Class(TFORM)
...
etc.
I don't have any options for INSERT a form instead of starting a new form which starts a new empty unit with the form.
Also, I would like to know if creating Frames can be held to the current project and not installed on the IDE bar?
MarkMLl:
--- Quote from: jamie on October 15, 2024, 10:54:03 pm ---That's just it, I don't have a Form already in the process, I have a unit that I would like to have a visiual editable form in it now.
I don't have any options for INSERT a form instead of starting a new form which starts a new empty unit with the form.
--- End quote ---
Tell the IDE to open the .pas file and then make sure it's added to the project. If that doesn't work then I suspect we need Martin, as the IDE guru, in here.
--- Quote ---Also, I would like to know if creating Frames can be held to the current project and not installed on the IDE bar?
--- End quote ---
A frame is entirely in the local project. It's just a control instantiated onto the current form, and isn't in some way added to the IDE.
(Noting the repeated warnings against trying to edit a frame after it's been instantiated, which invariably ends badly.)
MarkMLl
jamie:
I need to make a ToolBar type controls and the main form is getting large where these toolbars are going to be used.
So I want to make each toolbar type control in different forms because these toolbars are also basically like a form with no caption border etc., they have properties and methods etc.
I have no intention of dropping them on the form at design time, these will be created and parented to the control housing the toolbars. these bars will also perform floating and docking operations.
Current project I am converting over has many of these that are more than just the toolbar control, they have all sorts of fields that are relevant only to the project, they need to be created at startup and keep that way, regardless of how they are being accessed visually.
Thank you.
Navigation
[0] Message Index
[#] Next page