Matteo Pasotti ha scritto: > Hi, > I'm writing an application that once read a configuration file, it > creates at runtime some buttons. > My problem is represented by the declaration of a unique event for all > these buttons with the target of recognizing the caller and change some > of its properties. > I think it's similar to the Group property but I'm not able of use it at > runtime :-( > Someone has any idea on what can I do? > Create every button with an event handler associated like this:
btAbutton = new Button(me) as "Button1" ' first button btAbutton2 = new Button(me) as "Button1" ' another button btAbutton2.tag = 5 The event handler for click will be: sub Button1_Click() if LAST=btAbutton ... if LAST=btAButton2... if LAST.tag=5 then... ' the same as before So you can: 1. Create buttons, and keep the variable around 2. Create buttons without keep variables around, but setting different TAG properties 3. Noye that you can use other fields other than Tag (for example, Text) 4. You can group all the buttons in the same event handler, as before, or you can use more than one handler Quick response - I hope it is clear. If not, let us know. Regards, Doriano ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user