05-29-2013 05:07 PM
ElectroLund,
I'm having trouble reproducing this on my end. Here's the process I followed:
1) Create a new UIR file with 4 numeric controls, with names A, B, C and D
2) Right-click each and add to a control array. I did them in this order: B, A, C, D.
3) Save UIR file, close and open it.
At this point, the control array was still in the same order as I originally specified--I did not see it automatically order in reverse alphabetical order. Then, I tried this:
4) Save UIR.
5) Edit a property of one of the controls.
6) Observe control array, save UIR, close, reopen
After this, I still did not see any changes to the order of the controls. Granted, I only tried it maybe 5-6 times. Does this happen fairly infrequently, or most of the time?
I'll look forward to your reply--I'm sure there's a step in the process that I'm missing, and if we can reproduce this, I can file a report on it so that it can be investigated by a developer.
05-30-2013 07:51 AM
Huh, that's interesting. Ok, I did a bunch of tests to reproduce the array assignments that I've experienced. Here's what I found...
Doing exactly what you did, yes I confirm -- the order of the controls is retained, no matter how I add them into an array.
But here's how I have been creating my arrays. I'm lazy, so I copy and paste a lot. If you create one of the numeric controls, name it what you want (either numeral or alpha), and then copy and paste it N times, rename all controls, then the order will always be in reverse alpha or reverse numeral.
If I create each control from scratch (without copying / pasting), then order retains. Very curiously, if I then copy that entire bank of controls, add to a new array, order is still retained.
It appears to be a situation only when you copy/paste single controls and then add to an array.
Now of course is the question: is the above contributing to the original reordering bug I've been seeing only very occasionally? I don't know, but it's a good starting place for you to try duplicating.
So that's what I have. Thanks for your help!
05-31-2013 04:37 PM
ElectroLund,
I'm still working on trying to reproduce it, but unfortunately I still haven't been successful. I'm doing this:
1) Create UIR file.
2) Add numeric control, rename to "A"
3) Right click > Create Control Array
4) Copy+paste control A a few times
5) Rename each of the copies to B, C and D, and add to the control array
6) Change properties of the numeric controls (such as data type) to try and see a reordering
I haven't yet seen the order of controls in the array get reordered. Am I doing something differently in my process, or do I need to do some other action to see the reordering take place? I'll keep working on it, but I'll look forward to your reply.
06-06-2013 12:10 PM
Well, that's very interesting!
When I repeat your steps, I still get reverse ordered elements. See my attachments.
My LabWindows CVI is just behaving differently than yours.
06-07-2013 04:38 PM
It's very strange that we would see different results. Is there anything else you might be doing in the process, such as saving the UIR file or compiling a set of code attached to the UIR? If I could get to a point where I can reproduce this, that'd be very helpful toward filing a report that we can send to our developers to investigate the issue further.
06-10-2013 10:44 AM
Indeed. I fired up another computer we have here, running LabWindows CVI, same version. This is a Win7 laptop.
I got much the same results as I have on my primary dev machine, a WinXP desktop. To reiterate, I am opening a new instance of LW CVI, not saving, or even creating any underlying code. I'm only working with a UIR file.
On the laptop, I never got the selection order to retain after creating the control array. In fact, the order was somewhat more random; in a few cases, I order something like this: "RING4, RING 2, RING3, RING 1" when I had selected in ascending or descending order. Selecting a different way resulted in an unchanged order in the array.
I'm not sure what else to do. It would be interesting if others here could attempt this and see how they fare.
06-11-2013 09:15 AM
I know that you previously said this occurs when you change a property of one of the controls--could you give me an example of what property that might be?
I had one of my colleagues try to reproduce it as well, and he was also unable to do so. I feel like we must be doing something differently that's causing us to not see the same behavior.
In any case, if this issue persists, I would still recommend generating the control array programmatically as a way to avoid the issue.
06-18-2013 07:37 AM
Daniel, I'm about to migrate over to the programmatic method. I had to make some significan UIR changes yesterday to my production software, and the changes broke a lot of the array ordering again. Beginning to pull too much of my hair out.
Would it be possible to send you my UIR to see if you have similar results to me?
06-18-2013 10:11 AM
Daniel-E wrote:
You'd create a control array by first calling NewCtrlArray, and then use InsertCtrlInArray to add controls to it.
I implemented this solution and it works nicely so far. Just for clarity, the element insert function name is actually InsertCtrlArrayItem.
Sure makes for a big block of code (130 lines!), but with block selection and a macro editor, it didn't take long.
06-19-2013 04:41 PM
ElectroLund,
Glad to hear that's working for you. I think the programmatic approach might be best for ensuring correctness every time, and it makes the code a bit more portable if you decide to change the UIR later. If you do run into any more issues with the control arrays, please let us know.