[Gambas-user] Creating button as class element with variable function

M. Cs. mohareve at ...626...
Sat Feb 4 17:48:59 CET 2012


Is it possible to create a button with dinamically changeable action?
I would like to have something like:
Public Sub AddGomb2(sz As Integer, m As Integer, x As Integer, y As
Integer, q As Container, szoveg As String, operation as String)
  Dim gomb As Button
  gomb = New Button(q) As "Gomb2"
  gomb.Width = sz
  gomb.Height = m
  gomb.X = x
  gomb.Y = y
  gomb.Text = szoveg
End

I would like to replace "Gomb1" with a passed value, so to have a
reusable button upon creation. I mean, if I have multiple buttons on a
form, i would use:
myclass.AddGomb2(....,"action1")
myclass.AddGomb2(....,"action2")
myclass.AddGomb2(....,"action3")

Is that manageable?




More information about the User mailing list