LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change tab control page order programmatically?

Hi,

 

I am trying to change the page order of a tab control programmatically based on certains conditions but I can't find a property node for this. It is posible to do this in any way?

Ferdinand Martinez
FMO Automation LLC
0 Kudos
Message 1 of 10
(5,360 Views)

via kludge yes.

 

Set-up an off-screen control associated with tab key and use an event structure to trigger when tab is pressed then use set key focus to the controls in the order you want.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 10
(5,357 Views)

I think Ben is talking about the tab order of controls.  The OP is wanting to change the order of tabs in a tab control, I think.

 

Try using an invoke node (method) "rearrange pages"

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 3 of 10
(5,350 Views)

Ben,

 

Thank for the response and sorry about my ignorance, but I don't understand what you mean. Key focus is to receive key pressed on the keyboard and what I want to do is change the order of the pages in the tab control. Let say I have a tab control with 3 pages (tabs). Tab 0, 1 and 2, then based on any condition in my code, I want to make tab 2 became 0 and tab 0 became 2.

Ferdinand Martinez
FMO Automation LLC
0 Kudos
Message 4 of 10
(5,347 Views)

vt92,

 

I don't have a "method" invoke node in my right click option.

Ferdinand Martinez
FMO Automation LLC
0 Kudos
Message 5 of 10
(5,335 Views)

please forgive that shot to left field.

 

If the method mentioned by VT92 is not a script node, you may have to upgrade to get it.

 

Not sure off-hand what else to offer as an idea beside yet another hack.

 

Just diabling some of the tabs probably will not meet your req's.

 

I'll post if I think of something.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 10
(5,328 Views)

Ben is correct, it is a script node.  I should have noticed that. 

 

You could probably using scripting and a subpanel to get it to work.

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 7 of 10
(5,322 Views)

"Silly bear!" (Christopher Robins, Winnie the Pooh)

 

Hide the tab lables and show the tab captions so you can change the label.

 

For all tab pages that can cahnge implment those as sub-panels, so...

 

Start-up sets config #1 that set the tab labels and loade the sub-panels and hide un-used tabs.

 

When the mode changes, relable the tabs and move the sub-panels to the proper page and show the active tabs.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 10
(5,321 Views)

Thanks a lot for your help guys.

 

Let me explain a little bit more my problem, maybe you guys get a good way to do this.

 

Ok, I have a tab control with 4 tabs (Auto Mode, Manual Mode, Troubleshooting and Configuration) in that order. In the "Auto Mode and Manual Mode tabs I have a selector switch to select the operation mode (auto or manual). Now, when I have the switch in auto mode, the manual mode tab page is hidden, when I change the selector switch to manual mode the manual mode tab page is unhide, the auto mode tab page is hide and the manual mode tab page is automatically selected. This happens because my manual mode page is the second one and when the page before is hidden the next one get active. The problem came up when I change the switch back to manual mode. I want that the auto mode page unhide, the manual mode page hide and the auto mode page get active, but instead the page that came active is the troubleshooting page since this is the one after the manual mode page.

 

So, what I was planning to do was to rearrange the pages order when auto or manual mode are selected so that the second page be always the hidden one.

 

Maybe I confuse you guys more, but that'sthe idea. If something came out of your mind, I really appreciate the help.

Ferdinand Martinez
FMO Automation LLC
0 Kudos
Message 9 of 10
(5,305 Views)

I like to use invisible Tabs in GUIs (ie. body of the Tab control, but a different selector (listbox usually).  I also like to use the page selector without the body, kind of like a nice UI (especially with images on the Tabs) for an enum.  It is not often that I actually use the selector and the body together (ie. the way nature intended).  Just doesn't feel right sometimes.

 

I do not know how many different arrangements you have (please not too many I personally dislike moving targets on my UI, screws up my muscle memory).  You could decouple the selector(s) from the working Tab.  Make a few different Selector only Tab controls, choose the visible one depending on your wishes, use these selectors to drive the Tab Control which has the actual controls.  Here is an example for two different Tab arrangements.  I align the two Selector Tabs on the FP and float the working one over the top of them both (with a transparent frame).  You float an object over the tabs my moving with the arrow keys.

 

ShuffleTabs.png

 

Easier than subpanels?  I do not know, probably depends on what you are used to.

 

 

0 Kudos
Message 10 of 10
(5,304 Views)