[Gambas-user] Trying to create a form and add controls dynamically

Tim Auld tim at ...258...
Sun Sep 28 17:18:11 CEST 2003


Hi Benoit,
Thanks for responding and thanks for the example.  It worked great.  I'm
am a VB programmer from way back.  I just love what you and the team
have done with Gambas.  I can't get over the speed with which it
executes, especially database access. 

Regards ... Tim.


On Sat, 2003-09-27 at 09:36, Benoit Minisini wrote:

> Le Mardi 23 Septembre 2003 23:52, Tim Auld a écrit :
> > Hi there,
> > I am trying to create a form in Gambas dynamically and programatically add
> > controls to the new form.  Has anyone done this?  Would you have an example
> > I could use?
> >
> > Regards,
> >
> > Tim
> >
> 
> You just have to create controls exactly like any other objects. The first 
> argument of the control constructor must be the parent control or form.
> 
> To create a form:
> 
> MyForm = NEW Form
> 
> And, for example, here is how to add controls in this form:
> 
> PRIVATE MyLabel AS Label
> ...
> MyLabel = NEW Label(MyForm)
> MyLabel.Move(10, 10, 120, 30)
> MyLabel.Text = "Hello"
> ...
> 
> If you want event handlers, do that:
> 
> MyLabel = NEW Label(MyForm) AS "MyLabel"
> ...
> PUBLIC SUB MyLabel_Click()
> ...
> END
> 
> When you create a form in the IDE, the gambas compiler replace it by this kind 
> of code, as if you have typed it by hand.
> 
> Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20030928/b4af39aa/attachment.html>


More information about the User mailing list