[Gambas-user] buttons at runtine, but then..

M0E Lnx m0e.lnx at ...626...
Tue Aug 26 21:01:07 CEST 2008


What I do in a case like this is... first... assign a label to button
instances..
Also, add a .tag property to each one of them (this helps adress them
individually if you need to)

Take a look as this
hbutton = new Button(FControl) as "ControlBtn"
WITH hButton
.x = 200
.y = iYy
.text = rDevice!name
.height = 40
.width = 130
.tag = rDevice!name (you can change this as you want... it's a good
idea to store a unique value here)
END WITH

Then, to create your click event you do it like this

PUBLIC SUB ControlBtn_Click()
message(last.tag & " Was clicked")
END



HTH

On Tue, Aug 26, 2008 at 1:49 PM, Ron <ron at ...1740...> wrote:
> Hi,
>
> I have to create number of buttons at runtime, (from a database) this
> works with this for example:
>
>       hButton = NEW Button(FControl)
>        WITH hButton
>          .X = 200
>          .Y = iYy
>          .Text = rDevice!name
>          .height = 40
>          .width = 130
>        END WITH
>
> But how can I create the corresponding click events at runtime?
>
> The events needs to call a subroutine with an parameter also from the
> database.
>
> Do I need to create objects,and then add a string to a button name to
> create unique names?
>
> Someone has a pointer?
>
> Regards,
> Ron_2nd
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list