george seifert Posted July 7, 2009 Report Share Posted July 7, 2009 I need to build a tab control with many pages (I won't say how many because someone will surely scold me). I'm too lazy to go through and keep doing "Add page after". Is there another way to do this? I've searched through all the invoke and property nodes. There was an entry at NI for doing this with Labwindows, but that doesn't help. George Quote Link to comment
Ton Plomp Posted July 7, 2009 Report Share Posted July 7, 2009 I need to build a tab control with many pages (I won't say how many because someone will surely scold me). I'm too lazy to go through and keep doing "Add page after". Is there another way to do this? I've searched through all the invoke and property nodes. There was an entry at NI for doing this with Labwindows, but that doesn't help. George Well I think the NI LabVIEW APIs (scripting) toolkit should be able to do that. Ton Quote Link to comment
PaulG. Posted July 7, 2009 Report Share Posted July 7, 2009 (edited) I need to build a tab control with many pages (I won't say how many because someone will surely scold me). I'm too lazy to go through and keep doing "Add page after". Is there another way to do this? I've searched through all the invoke and property nodes. There was an entry at NI for doing this with Labwindows, but that doesn't help. George Scripting gives you Invoke Node > Add Page. But if you want to create an executable I don't know what you can do except what I've done in the past and that is to create as many tab pages as you think you will ever need and make them visible/invisible using the Pages array and page visible properties. It sounds kind of clunky but that's all I can offer. Edited July 7, 2009 by PaulG. Quote Link to comment
Norm Kirchner Posted July 7, 2009 Report Share Posted July 7, 2009 George I would strongly suggest that you investigate another option involving sub-panels and utilizing a listbox to choose the appropriate 'Page' (something like the LV Options page) Although tabs afford the user some good user interactivity points, it is limiting when attempting something more dynamic which it sounds like your doing. You will find that a listbox with subpanels are extremely more flexible albeit a hair more exotic with the process of getting information from the subpanels back to the top level.... but that is another discussion altogether with a variety of very good solutions. If you CAN NOT live without a tab control, you will still need to use sub-panels anyway and you would create the sub-panel VI on the fly with scripting and adding / removing tabs that way. (a creative yet very flawed solution) Good luck ~,~ Norm Kirchner 2 Quote Link to comment
Aristos Queue Posted July 7, 2009 Report Share Posted July 7, 2009 Tab controls have a fixed number of pages compiled into them. If you're not working in the development environment, you cannot add more pages. And even if you are in the dev environment, you cannot add more pages while the VI in question is reserved for run. The only workaround I can think of might not be too appealing: You could drop a picture control and draw your own tabs. (Note that Norm's alternative is a better solution generally... I was just trying to workaround the "you need tabs" problem, not solve the wider UI issue...) Quote Link to comment
crelf Posted July 8, 2009 Report Share Posted July 8, 2009 I would strongly suggest that you investigate another option involving sub-panels and utilizing a listbox to choose the appropriate 'Page' (something like the LV Options page) Here's an example of exactly that - a subpanel controlled by a list of categories (subVIs that are loaded into the subpanel). It's a half-arsed job that I was mucking around with, so use at your own risk. There are three VIs: the preferences dialog itself, a template preferences page and an example preferences pages (there are some OpenG dependancies that you'll need too). One added bonus is that the preferences dialog saves an ini file of all the values on the FPs of the preference pages, and recalls them from that file each time you show the preferences dialog again. The implementation I had it in would look in a particular folder for any VIs with "prefpage_" at the start of it's name, and attempt to include it in the category list. The top bar updates to the title of the subVI too. PreferencesDialog.zip 1 Quote Link to comment
unicorn Posted July 8, 2009 Report Share Posted July 8, 2009 I thinks it's no good idea to have many tabs. The user (as I always do) gets easily confused because the tabs are organized in rows above the main panel area and the order of the rows always changes if one clicks a tab in another row. I think using a listbox is the better style. And for three tabs its not worth while to make some scripting. Quote Link to comment
george seifert Posted July 8, 2009 Author Report Share Posted July 8, 2009 I thinks it's no good idea to have many tabs. See, I knew somebody was going to chide me for having too many tabs. Really, in this case I need them. Thanks for the ideas. George Quote Link to comment
Norm Kirchner Posted July 8, 2009 Report Share Posted July 8, 2009 Really, in this case I need them. Then you need to define an upper limit and do the fanciness of hiding/showing all tabs up to your limit and using tab-captions to dynamically re-name the visible tab names (or do the hacky way of having a non-running VI present in the sub-panel that you can edit at runtime but not run) If you resolve yourself to that, then you have a solution (which i'm sure plenty of others have done in the past to do this exact thing) Quote Link to comment
PJM_labview Posted July 8, 2009 Report Share Posted July 8, 2009 The only workaround I can think of might not be too appealing: You could drop a picture control and draw your own tabs. (Note that Norm's alternative is a better solution generally... I was just trying to workaround the "you need tabs" problem, not solve the wider UI issue...) I actually saw a an example somewhere (maybe on NI website ) from somebody that created a Tab control using a picture control (this was prior to NI having a native tab control). PJM Quote Link to comment
ESST Posted July 8, 2009 Report Share Posted July 8, 2009 I need to build a tab control with many pages (I won't say how many because someone will surely scold me). I'm too lazy to go through and keep doing "Add page after". Is there another way to do this? I've searched through all the invoke and property nodes. There was an entry at NI for doing this with Labwindows, but that doesn't help. George Hi, You could try downloading the scripting.vit from Labview API Group, then modify the "FP" case to something like this: . Quick and (really) dirty, but seems to work. This adds "Test1" to "Test5" as the first five pages of the selected Tab controls when the button is pushed (your tab controls parent vi, must be in edit mode). You will need to have scripting installed, due to the TabControl "Add Page" method. Espen Quote Link to comment
george seifert Posted July 8, 2009 Author Report Share Posted July 8, 2009 Hi, You could try downloading the scripting.vit from Labview API Group, Espen Thanks for the link (Ton's original post with that link didn't work) and the example. Not to put a stop to all the other ideas, but I only needed to add tabs while in edit mode. Truth be told, it was a lot less work to just add them manually. George Quote Link to comment
huotom Posted July 11, 2009 Report Share Posted July 11, 2009 Hi, You could try downloading the scripting.vit from Labview API Group, then modify the "FP" case to something like this: . Quick and (really) dirty, but seems to work. This adds "Test1" to "Test5" as the first five pages of the selected Tab controls when the button is pushed (your tab controls parent vi, must be in edit mode). You will need to have scripting installed, due to the TabControl "Add Page" method. Espen I'm using LV8.6, but I can't find the "Add Page" Invoke node you are using for TabCtl anywhere. Quote Link to comment
ESST Posted July 12, 2009 Report Share Posted July 12, 2009 I'm using LV8.6, but I can't find the "Add Page" Invoke node you are using for TabCtl anywhere. I have not done anything spesial with Labview ini or anything like that. As long as you have Labview Scripting installed, and you are using a tab control refrence (I needed the "to more specific class" function), I can se no reason why you should not find it. Espen Quote Link to comment
huotom Posted July 13, 2009 Report Share Posted July 13, 2009 Oh yeah, I got it. After I downloaded the toolkit and actived it , I find it finally. Thank you! Quote Link to comment
HHHHLLLL Posted August 4, 2009 Report Share Posted August 4, 2009 Oh,Yeah, Nice, but Why it is an error as I run the vi ? Quote Link to comment
jgcode Posted August 4, 2009 Report Share Posted August 4, 2009 Oh,Yeah, Nice, but Why it is an error as I run the vi ? Guessing - is the VI you're pointing to idle? Quote Link to comment
Francois Normandin Posted August 4, 2009 Report Share Posted August 4, 2009 Oh,Yeah, Nice, but Why it is an error as I run the vi ? You cannot do this while a VI is running. That is: "A.vi" has your code to add a page to a tab located in "B.vi". If B is not running, you won't get an error. Quote Link to comment
HHHHLLLL Posted August 4, 2009 Report Share Posted August 4, 2009 You cannot do this while a VI is running. That is: "A.vi" has your code to add a page to a tab located in "B.vi". If B is not running, you won't get an error. OK ,Thanks, clear. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.