Control arrays get corrupt sometimes

Started by David Kenny, October 14, 2008, 03:08:42 PM

Previous topic - Next topic

David Kenny

Paul,

I am sending you a test project with an option button control array.  It is currently messed up.  I can't put a finger on exactly what I do that messes it up, but I can usually do it fairly quickly  :-\  BTW, I am not manually editing the the main.bas and form.inc files before the corruption.  Only after, to try and figure out how it is happening.

Couple things I have noticed:

1) There are two sets of IDC definitions for the option buttons. One in the form.inc and one in main.bas. (doesn’t cause an error, but didn’t know if you knew they were duplicated)

2) The IDC declarations for each option button (when corrupt) all have the same value. (2101 in the project I emailed.)

3) If I manually edit the form.inc and change the IDC's to 2101,2102,2103, save the file and then load the project - FF sets them all to a new value (but all the same value again).

4) If I manually edit the main.bas and change the IDC's as in 3) above, and then compile that (without loading it in FF again), then the program functions as designed.

Thanks,

David

PS forgot to include:  I have a larger program that I am developing that has several Option Buton control arrays on one form.  One of them is corrupt while the other two are fine.  As I stated above, I can manually edit the Main.bas and get my program to function correctly. The symptom when you run the program is that the ControlIndex returned whenever you select and option button (for instance) is the same.  Even though each Option Button is defined with it's own control index.

TechSupport

Hi David,

This is a common problem that users encounter for Control Arrays and Option Buttons. What you need to do is increment the "Index" property for each Option Button in addition to having unique ControlIndex values.

So..... basically, just change the "Index" property for each of your Option Buttons. Set them to "1", "2", "3", etc....

Hope that helps  :)


David Kenny

That was it.  :-[  I blew that possibility off because I had some arrays that where working fine and their indexes were all 1.

David

Roger Garstang

#3
Seems there are a bunch of threads similar to this, so I'll comment in the most recent.

My main difference from the original post is I'm not using a Control array, just a GroupName (Called "Services").  I started with 3 Radio buttons to select for what service to control on a remote PC.  My function is sort of a template, so I can add or remove options and just add or remove an ifelse line setting a variable for the string of the service name.  My first 3 had an index of 1,2,3.  This worked fine and when tabbing to the group the arrow keys navigated in the proper sequence.  I then decided to add a forth, but to be in the proper order I wanted it to be between the current 2 & 3.  So, I put it between them, kept 1 & 2 numbered how they are, numbered the new one with Index 3 and the old 3 to a 4.  Now, upon tabbing the arrow keys move 1,2,4 instead of 1,2,3,4.  Sometimes pressing again moves back to 3, but most of the time it stops.  In the IDE it does the same thing when using the arrow keys and navigates 1,2,4,3.  It seems to be using the Z Order/Tab Order in groups instead of the Index.  If I move my new one to spot 4, renumber it to 4 and the old 4 that was a 3 back to a 3 the arrows work as they should...