[Gambas-user] create code option in form designer
Benoit Minisini
gambas at ...1...
Tue Jun 10 22:33:52 CEST 2008
On mardi 10 juin 2008, Ron wrote:
> Question.
>
> Is there a way to generate the code for an object you designed in the gui.
> If not wouldn't it be a nice feature?
>
> Let say you created a window and dragged a frame in it, and set the size
> etc etc, would be nice if you could see/save the lines of code you would
> need to create the objects without using the gui.
>
> As for a learning experience, and if you want to let your code generate
> similar content at runtime.
>
> I know you can see the dimensions etc already in the form created if you
> peek into the file itself.
>
> Regards,
> Ron.
>
The code is generated entirely from the contents of the *.form file. It is
just the instanciation of a control inside its container followed by a method
call (Move or MoveScaled) and property assignments.
The only trick is when you put a "virtual" control inside a form. There is a
mark that tells the compiler that this is not a true control, and that it
must not pass the container as argument to the control constructor.
In other words, I don't find that feature really useful, but if you can really
persuade me to it, I will have to modify the compiler so that it can give you
the generated code from a form file. :-)
--
Benoit Minisini
More information about the User
mailing list