On Thursday 06 November 2008 07:19, Robert Moss wrote: > Ok, awesome. But what is a control group and how do I use one? I can't > find any documentation on it
The "control group" concept in the form designer corresponds to what comes after the "AS" when you programmatically create a control. In the example you posted, you're creating a control group. Control groups don't automatically create an array when creating them in the form designer, or allow you to iterate through the controls; it just ensures that all the controls in the group trigger the same events. But you're already creating an array in your code, so you've gotten that part licked. Differentiating between the controls when their event gets fired is where most people get tripped up. Most people use the Tag property of each control to identify it, like this: ' in Form_Open btns[0].tag = 0 btns[1].tag = 1 ' in btns_Click dim btnindex as integer btnindex = LAST.Tag Message.Info("You pressed button " & btnindex) I find this usage clunky as well, but I've also run into situations where I wanted multiple controls of different types to trigger the same event, and control groups allowed me to do that where VB control arrays wouldn't have. Rob ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user