LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reorder controls within a panel.

Solved!
Go to solution

I have created a UI that visually looks the way that I need it to. It is made up of 24 rows with about 15 columns of UI controls per row. In order to build out this table I did a lot of copy and pasting of UI elements but now in my list of all the UI controls it's bedlam. I want to make it easy for myself or the next developer to easily edit or restyle these controls. So I'd like the control list to show the controls for one column, then the controls for the second column, etc.

I see absolutely no way to reorder these controls. But it seems crazy that this functionality doesn't exist.

 

To be clear I'm not trying to put elements in front of or behind other elements visually but adjust the list of controls in the upper right corner of the screen (and I think that is directly related to the resource IDs that get assigned in .h file).

0 Kudos
Message 1 of 9
(2,895 Views)
Solution
Accepted by topic author JoshGinter

This can easily be done by clicking once on the panel and pressing Ctrl + T (or executing Edit >> Tab Order... menu function which is the same): in Edit Tabbing Order window click on the controls on the window in the order you want to have them listed in the Resource Editor (the list in the upper-right corner); accept the reordering b pressing Ok to have it saved in the .UIR and .H files and have the list updated. Remember that this will also be the order in which controls will be activated when pressing Tab key at runtime.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 9
(2,861 Views)

I think the right panel displays the controls according to their tab order.

To change the tab order open the uir and Edit>>Tab Order

[Edit] It seems Roberto was faster 🙂

0 Kudos
Message 3 of 9
(2,857 Views)

Just a couple ideas about your UI.

First of all, the last note I put in my previous reply should be considered: the order you are trying to put your controls may be better from the programmer's point of view but is probably not optimal for the user. If the logic the user follows in editing the controls is by row your control arrangement is the worst given the 24 x 15 size of the  UI!

 

Your description of the UI makes me think to a tabular schema, where control in the same "column" represent the same element, something like that:

Step  Type Duration  Param1  Param2     
 1    Work   15min     1        2
 2    Rest   1hour
.....
24    Work    1min    14       20

If this is your schema then you can consider that multiple controls can be selected on screen (e.g. the "Type" column) and edited at the same time, while preserving the tab order by row that is better from the user point of view.

 

Next idea. Since editing 24 controls is boring and prone to errors, you could consider to create the panel with the first row only and duplicate controls at runtime before showing the panel. In my opinion this approach has some advantages: on one hand you can easily rearrange the panel to show say 10 or 30 lines, and editing one control only is enough to have all controls in the column with the same aspect



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 9
(2,849 Views)

you could also consider grouping your controls by using ControlArrays

0 Kudos
Message 5 of 9
(2,845 Views)

I will be using controlArrays. But I still end up with a really messy list of controls and a really messy looking .h file with all my resource IDs being a little crazy.

 

Almost none of my controls are actual "controls" they're text fields that will be set by application to let the user know the status tests and info about the devices under test. So this is purely an exercise in trying to wrangle some organization into this mess.

 

The Tab order does appear to be what I want to change but the interface is a huge problem. My controls are too densely packed to be able to easily see which controls are referred to by which "black|white" boxes in the tab order UI. Many of my text fields are smaller than the ui for describing what the order of the tab is... Making it almost impossible to click the correct field in the dense sections of my UI. And then I have to start over at tab order 0 everytime so I can't temporarily space out the dense sections and take another pass...

 

It's absurd that I can't simply drag the list items in that control list to change the order. Or edit a xml or .h file or something manually...

0 Kudos
Message 6 of 9
(2,831 Views)

You don't need to always start from 0 when editing the tab order: simply write down the desired index in the highlighted box and the next control you click will have that index

image.png

 

On the other end, since your controls are mainly texts I wonder if a simple table couldn't be better instead of a huge series of controls.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 7 of 9
(2,829 Views)

Okay. I didn't seem like I could type in that box. But I can. I can use this to get to where I want now. Thanks a lot.

You're probably right that a table might be better... Maybe I'll look into that again for the next UI. Thanks again.

0 Kudos
Message 8 of 9
(2,823 Views)

When designing multiple rows (or columns) of identical controls, you should put only the 1st row (or column) in your UIR file, and then dynamically create the other rows by copying the 1st at execution time.

I know of at least 5 methods:

 

- list the control constants of the 1st row in a C array and copy every one of them with DuplicateCtrl(), keep the resulting Ctrl numbers in your array and use that instead of the constants. Place appropriately with simple geometric rules. That's the most tedious.

- put your 1st row in a child panel, and simply copy the child panel for each row at run time. Keep the list of child panels in an array (and keep an IndexForPanel list), but otherwise use the constant names to index your controls.

- put your 1st row of controls into a ControlArray and copy that at run time.

- Use a table with only 1 row (if your controls are similar) and copy the 1 row at execution time. Use table function to figure out who's who.

 

Some methods require surprisingly little code and little time to work on the UI.

0 Kudos
Message 9 of 9
(2,776 Views)