Scrambled Control Arrays

I am writing a program (a simulation of the CARDIAC computer) which has three control arrays, two of 20 textfields, and one of 100 textfields. After getting it completely debugged and running, suddenly things got really messed up after a minor change which had nothing to do with any of the control arrays. After I investigated for a bit, I discovered that the indexes of each column of control arrays had somehow been reversed. For example, each of the 20 member control arrays were in columns with index 0 on top and index 19 on the bottom, and now they have index 19 on the top and index 0 on the bottom. The 100 member array was in 5 columns: 0-19, 20-39, 40-59, 60-79 and 80-99. Now, each of the columns has been reversed so that they read 19-0, 39-20, 59-40, 79-60 and 99-80.

Two questions: 1. How did this happen, and is there any way to prevent it from happening again? 2. Is there any way to fix the problem without laboriously dragging all 140 textfields back into the proper place?

If it can’t be prevented and I can’t fix it any easier, I see no alternative to abandoning the program while screaming loud curses in the direction of Austin.

Paul Dobbs

This bug was recently reported to us
<https://xojo.com/issue/34433>

So I guess all I can do is abandon the project. If you hear loud curses from the direction of Fort Worth, that will be me.

Paul

Try selecting the columns in reverse order (select the bottom one, then the next one up, and so on) and clicking the align left button. That fairly reliably switched things back when I was testing. Just check before saving!

IF you depend on control(0) be in a specific place & control(1) in mother you might as well name then - control0 control1 etc.
If you’re NOT using a control array to create new instances at runtime you’re not much worse off since the indexes end up serving as the unique part of the actual name

This seems to be new to R2

Can anyone thats seeing this confirm that ?

I love autocorrect. [quote=111227:@Norman Palardy]in mother[/quote]
?

Control arrays have the additional benefit of sharing event handlers and having an index, so using control0 control1 etc sort of short circuits the whole thing.

A work around might be to create a “trueindex()” property in your window/tabpanel/pagepanel & initialise it in the open even using the top & left positions to map the controls to the correct positions.

A listbox might be another way of presenting the data. A 5 x 20 grid doesn’t seem too difficult to achieve using that control & with some relatively simple manipulation you can get some great gui output.

This happened to me too with 41 text fields, 30 mins before a demonstration.
I was simply fixing a typo and bam, weird ordering.
Panicked and manually set each one in order.

[quote=111227:@Norman Palardy]
This seems to be new to R2

Can anyone thats seeing this confirm that ?[/quote]

I don’t see it in 1.1 with the example I’ve been using (the one in Feedback), so yes, it seems to be new with 2.

I also notice that with r2 the inspector stays on the advanced tab when you switch controls. First, that’s very nice. Second, even though I know nothing about the IDE, I’m always willing to give unsolicited advice (heh) and perhaps that change affected something with the index numbering. I’ve had similar issues.

Unrelated.

Has to do with making it so you DON’T have to hit enter to make changes in the inspector stick.

[quote=111334:@Norman Palardy]Unrelated.

Has to do with making it so you DON’T have to hit enter to make changes in the inspector stick.[/quote]
Right. That’s what I meant to say. :wink: