10-14-2015 10:50 AM
Does anyone know how to obtain a reference to a tab control's page indicator programmatically?
Curently I have a typedef'd control (a tab) with its tabs hidden but its page indicator showing (i.e. which showing the user which tab is selected by displaying its name in a box). I control the position of that indicator programmatcaly to ensure that all my page elements align corectly in case I accidentally move something whist editing the front panel.
I control the posiiton of the tab page indicator by using a reference that I obtain while right clicking on the indicator.(in the image below, the tab isnt a typedef but you get the idea).
My problem is that every time I modify the tab control typedef, it destroys the reference to the page indicator and it breaks my VI.
I'm looking for help to find a way to get the reference programmatically so that I can edit the typedef and not lose the reference to the page indicator.
Thanks
10-14-2015 10:55 AM
I don't think you can... you can't even browse to the page selector when right clicking a reference and selecting "Link to".
A workaround would be to just have your own separate enum indicator which you move around and set the value of whenever the user changes a tab.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-14-2015 11:55 AM
Thanks James - I was hoping I had just missed something.
That's a pity - I use the page index to navigate around my UI for dev purposes when it's not running. Although I could easily display the name of the current tab I would't be able to use it to select tab pages unless the code is actually running.
10-14-2015 12:16 PM
If you want to use it when it's not running you could make your own XControl with this functionality that you want. It would take some work, maybe more work than it's worth for you.
My initial thought would be a Tab XControl, where a property of the XControl is the coordinates of the enum. The Facade of the XControl would be a regular tab control with the matching enum.
An XControl is always running when placed on a front panel even if you're not running the VI.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-23-2015 04:38 AM
Thank you James.
I had never created an XControl before but I tried it out with an XControl consisting of a tab control and a teext ring. On start up, the names of the tab pages get copied into the text ring. When I click on tab pages, the name in the text ring changes. When I click on the text ring I can select the appropriate tab control page and it changes.
I do all this in the event handler in facade.vi
Should I be initialising the page display ring control in init?
The only remaining problem is that my client has LV2013 Ful version (not Professional) and this prevents them from creating and editing XControls although I have the profession version. They want to be able to edit / recompile everything that I create for them but the whole UI resides in pages in this tab control so I can't use this method directly although I am glad that you pointed me in this diection and I have learned how to do it.
It's just possible that they might accept an XControl if I can make it generic by which I mean using it in this way:
1. I (or my client) create a tab control in the main application fully editable in LV2013.
2. I create an XControl which somehow uses the Refnum of the tab in the main application.
That way, they can tinker with the contents and pages of the tab control and still have the page name display change and control the navigation.
I don't know if that is possible or if you can point me the right way to do it. You have already answered this query for the way that I asked it so I accept tthat this is mission creep!
Thank you.
Steve
10-23-2015 07:45 AM
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-23-2015 07:57 AM - edited 10-23-2015 07:59 AM
As all the UI elements (probably about 200) are in the tab pages, they would need to be able to add controls and indicators to the tab pages, rename / reorder / add / delete tab pages without editing the XControl.
For example, one of the tab pages has about 30 numerical controls on it for various parameters within the system. They would need to be able to add, delete or rename controls on this page.
The only thing they don't need to be able to do is change the way that the tab control and text ring control/update each other and display the tab page names.
So what I was wondering was if there were a way to link the existing tab with its client-editable controls and indicators to the behaviour of the XControl tab/text ring that I have created.Or something to that effect!
10-23-2015 10:21 AM - edited 10-23-2015 10:22 AM
Well now that I'm looking in to it, it does seem like a bit of a pain to work with a Tab Control within an XControl without access to the XControl.
Apparently if you have a tab control on your front panel, you can't add controls to the tabs through the main VI since the XControl is really a running VI itself. Its similar to how you can't change the size, shape, color of any control while the VI is running.
think your own workaround here is going to have to be code within your interface VI that handles the tab control changes and accompanying enum changes.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-23-2015 11:25 AM
Thanks for taking the time to think about it.
At least I have learned how to make basic XControls work 🙂
Steve