[Gambas-user] indexing of buttons

Kadaitcha Man nospam.nospam.nospam at ...626...
Wed Jan 27 09:23:26 CET 2010


2010/1/27 Fiddler63 <mx4eva at ...626...>:

> In gambas I get an error if I give more that one button the same name.
> How do I index a row of buttons in Gambas ?

You don't. Gambas is not VB; it does not suppor, and rightly so,
arrays of control objects in the way that VB does; even the more
modern .NET revisions do not do it the way VB does. If you want more
than one object to do the very same thing then you use the control's
Group property.

If you need to know what item in the group was selected then, for
example, you use the Tag property. Or, perhaps the Caption property:

Public Sub mnuEdit_Click()

  Select Case mnuEdit.Caption
  Case $MNU_ITEM_EDIT_IDENTITY
     [...]
  Case $MNU_ITEM_EDIT_OPTIONS
     [...]
  Case $MNU_ITEM_NEW_OPTIONS
     [...]
  End selct

End

In the above code example, one menu item has three functions. The
function is determined by the context of the code.




More information about the User mailing list