PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Richard Marchessault on February 18, 2013, 09:53:17 PM

Title: Option Control
Post by: Richard Marchessault on February 18, 2013, 09:53:17 PM
What is the difference between the Index and ControlIndex properties of this control?
Title: Re: Option Control
Post by: Paul Squires on February 19, 2013, 05:43:38 PM
The ControlIndex differentiates the control from other similar option buttons in the Control Array. That way there is one common event handler for for all option buttons in the control array (eg. one BN_CLICKED for all of the option buttons). The Index is used with the option button group itself to determine the tab sequence when moving within items in the option button group.

It can be confusing because there are ControlIndex, Index and GroupName.

All option buttons with the same GroupName are treated as a group of buttons. When one is clicked on, the others within the group are clicked off.
Title: Re: Option Control
Post by: Jean-pierre Leroy on February 19, 2013, 06:08:18 PM
Hi Richard,

I made this sample FireFly project months ago to test the different settings of the "Option Button" control.

I hope it could be useful for you.

Jean-Pierre
Title: Re: Option Control
Post by: Richard Marchessault on February 20, 2013, 08:31:20 AM
The confusion for me was when I created a form which had an option group with 10 options in the group. I setup one option first and then copied and pasted it to created the other nine. Firefly created on option group. However, eight of the members of the groups had an index of 0, two of the members had an index of 1. All the members had a different control index. Although I could change the control index number, I could not change the index number of the two with an index of 1 to an index of zero. Quite confusing.
Title: Re: Option Control
Post by: Paul Squires on February 20, 2013, 02:13:04 PM
In the situation where the index numbers can not change (due to duplicate numbers) you could assign them higher numbers. The numbers need not be consecutive. So, you could have index numbers of say, 0, 1, 5, 12, 30, 50, 99, 1000, etc... If you really wanted to then after assigning the higher numbers you could go back and do the 0, 1, 2, 3, 4, etc...

The copy/paste issue with index numbers not automatically incrementing when the control is pasted has been a problem for a while now. Sorry it has not been fixed yet.

Title: Re: Option Control
Post by: Richard Marchessault on February 21, 2013, 07:11:55 AM
Would it then be fair to say that I should pay attention to the group number and the control index numbers, and ignore the index numbers?
Title: Re: Option Control
Post by: Paul Squires on February 21, 2013, 02:32:59 PM
I normally don't put option button groups into control arrays so the control index is not important to me. Personally, I pay more attention to the GroupNames and Indexes to ensure that the TAB ordering is correct when using the keyboard to navigate your Form.