Option Control

Started by Richard Marchessault, February 18, 2013, 09:53:17 PM

Previous topic - Next topic

Richard Marchessault

What is the difference between the Index and ControlIndex properties of this control?
Thanks,
Dick

Paul Squires

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.
Paul Squires
PlanetSquires Software

Jean-pierre Leroy

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

Richard Marchessault

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.
Thanks,
Dick

Paul Squires

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.

Paul Squires
PlanetSquires Software

Richard Marchessault

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?
Thanks,
Dick

Paul Squires

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.
Paul Squires
PlanetSquires Software