[Gambas-user] Find a button who was pressed

rolf rolf.frogs at ...221...
Mon Sep 4 15:00:16 CEST 2006


Hello Stefano

> > But getting the click event from the buttons it requires a public sub for
>> each button. Is it possible to put the buttons also into an array and how
>> to find out, which button was pressed?

> In the panel property for every button you want to put in the "array"
> set a common name for all for the property "Group"
> For example you set "AllButtons" as group name.
>
> Then in the code you have to
>
> PUBLIC SUB AllButtons_click()
>
>    if LAST.text = pressed_button_text THEN blahblah
>
> ENDIF
>
> you can use other properties to know which button
> was pressed, like LAST.X et cetera.

Many thanks for you example. I works very well. I would like to ask another 
question, about filling the array.

Is there something where i can search for my objects (i.e. combo boxes) to 
fill them in my array. So in a loop I would like to write (pseudo code!):

  IF object.typ = combobox then
    myarray.add(object)
  ENDIF

Many thanks for your help.
Rolf




More information about the User mailing list