[Gambas-user] Gambas Help - PLEASE - Object Arrays - Need help ASAP

Robert Moss the.at.robert at ...626...
Thu Nov 6 13:05:42 CET 2008


Hello, I am fairly new to GAMBAS but a experienced in C++ and VB 6. I am
trying to create an array of sockets, so that I can maintain a dynamic
number of connections, and use the same code for each.

I've been struggling for HOURS searching for the answer on google, and
trying as much different code as I can think of, experimenting, but to no
avail. I can create the objects, but I can't figure out how to receive
messages from them (actually I can't figure out how to distinguish them).

A simpler example with buttons:     This works, but I need to know WHICH
button fired the event,

PUBLIC SUB Form_Open()

  DIM btns[2] AS Button

  btns[0] = NEW Button(FMain) AS "btns"

  btns[0].Caption = "Test"
  btns[0].Left = 50
  btns[0].Top = 50
  btns[0].Show

  btns[1] = NEW Button(FMain) AS "btns"

  btns[1].Caption = "Test 2"
  btns[1].Left = 150
  btns[1].Top = 50

  btns[1].Show

END

PUBLIC SUB btns_Click()
  Message.Info("augh: ")
END
' using             PUBLIC SUB btns_Click(Index as Integer) doesnt work
' nor does       PUBLIC SUB btns[key]_Click()

'also, using the current function, I tried maybe Message.Info("ID: " &
btns.Id) or ANYTHING

This functionality is CRUCIAL please help asap.

-Robert



More information about the User mailing list