[Gambas-user] Menu over a control

tobias tobiasboe1 at ...20...
Wed Jun 29 09:54:44 CEST 2011


hi,


> If I create TextLabels as you told me, I can get their tags, so I can
> identify them, but cannot remove them.
oh, of course, you can:
LAST.Delete()

> if I create them
> as a TextLabel[], I can add and remove them, but cannot figure which
> one of them has been clicked. How to make both of the option usable?
if you didn't know of Control.Delete(), i suppose, you removed them only 
from the array using Array.Remove() but in this case, the TextLabel is 
still on the form.

how do you create the array? in a similar way as you create the labels 
and add them to the action group:

DIM lblLabel AS Label
DIM aLabels AS NEW Object[]
DIM i AS Integer

FOR i = 0 TO 100 STEP 1
   lblLabel = NEW Label(ME) 'AS "MyText"
   aLabels.Add(lblLabel)
NEXT

in this case, of course, you cannot figure out, which one is clicked, 
because they even haven't got a Click()-Event-Handler. add one just as 
fabien did (it's commented out in the source above) and your event 
handler would be like:

PUBLIC SUB MyText_Click()
   LAST.Delete()
END


regards,
tobi




More information about the User mailing list