LabVIEW Project Providers

Highlighted
Solved! Go to solution

Add a preference page to LabVIEW options dialog

Hello dear LabVIEW community.

 

Does anyone know if there is a way to hook LabVIEW Options Window (Tools menu bar) in order to add a custom configuration panel? For example when you install FPGA and Mathscript they are new menus you can access (cf. screenshot). I don't know if this can be achieved through LabVIEW project providers but I can't find any information about this subject.

 

Thank you in advance to anyone who can provide help or informations.

Arcale | CLA, CLED, CTD | LabVIEW enthusiast
0 Kudos
Message 1 of 11
(687 Views)
10 REPLIES 10
Highlighted

Re: Add menu to LabVIEW Options Window

Hi Nicolas,

 

You'd need to start looking in this directory: C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\dialog\PreferencesDialog (or your equivalent, for 32/64-bit and LV version)

 

In there are the "PreferencesDialog.vi" which gives the frame, and then a subdirectory for "PreferencePages", which contains a folder for each page.

You might be able to add a folder and have it display, but I haven't tried.

 

Inside that directory (the PreferencePages, not one of its subdirectories) is a template VI called "pageTemplate.vit". That seems like a good starting point for your own page, and lists some details you should follow.


GCentral
0 Kudos
Message 2 of 11
(671 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

I'm also interested in getting this working

 

I tried:

  1. Creating a new VI from pageTemplate.vit called perfPage_TomMcQuillan.vi
  2. Changed the window title to be 'Tom McQuillan' <- as this is what sets the category label
  3. Added a control and registered it on the BD
  4. Restarted LabVIEW (a couple of times)
  5. No luck - didn't appear

I've rooted around program files and can't find where to "enable" the new page. I think it should be possible as when you download new modules, new items appear in the options window.

 

Let me know if you have more luck 

0 Kudos
Message 3 of 11
(655 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

Thank you 

 

Arcale | CLA, CLED, CTD | LabVIEW enthusiast
0 Kudos
Message 4 of 11
(651 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

Can't find much documented on this, but you can do it with pure G code.

 

Check out this folder: \LabVIEW 20XX\project\

 

VIs added to that folder appear in the tools menu (after a LV restart, the menu is filled during launch).

 

If you want to add a submenu, add a named folder.

 

If you want to hide things, pre-pend the folder or VI names with an underscore and they won't show up.

 

Look through that folder, you'll see what I mean 🙂

Craig H. | CLA CTA CLED | Applications Engineer | National Instruments
0 Kudos
Message 5 of 11
(636 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

I migh not have been enough accurate in my first post but I don't want to add a new submenu in Tools menu but in the parameters window (see the screenshot in my first message).

Arcale | CLA, CLED, CTD | LabVIEW enthusiast
0 Kudos
Message 6 of 11
(633 Views)
Highlighted
Solution
Accepted by topic author Nicolas_Bats

Re: Add menu to LabVIEW Options Window

Unfortunately, shipping LabVIEW does not provide a way to plug in to the Tools > Options dialog. All of the pages (even the FPGA and MathScript ones) are hard-coded in the LabVIEW C code.

 

However, I have a workaround for you, if you don't mind overwriting a shipping VI in your LabVIEW folder. Follow these steps:

 

1. Backup the following VI: [LabVIEW 20xx]\resource\dialog\PreferencesDialog\PreferenceDialog.vi

2. Replace that VI with the one attached to this post (LabVIEW 2014 or later).

3. Create the following folder: [LabVIEW 20xx]\resource\dialog\PreferencesDialog\PreferencePages\User

4. Create a new VI from the following template: [LabVIEW 20xx]\resource\dialog\PreferencesDialog\PreferencePages\pageTemplate.vit

5. Save the new VI from step (4) into the User folder you created in step (3), making sure to save the VI with a prefPage_ prefix.

6. Mass compile the PreferencesDialog folder.

 

Congratulations, you now have your own page in Tools > Options. A couple of things to keep in mind:

 

a. Change the window title of your prefPage VI, and that's what will appear in the page list in Tools > Options.

b. Don't change the connector pane of your prefPage VI.

c. Don't do anything with any of the 'TagSet' references in your prefPage VI. These are used by the C code, which you're bypassing. This includes removing the subVI call in the <Close Event> of the event structure.

d. Since you aren't using the 'TagSet' stuff at all, you'll need to implement your own handling of reading/writing configuration. Assuming your page uses the LabVIEW INI file to store configurations, you can do this with the VIs here: [LabVIEW 20xx]\resource\dialog\lvconfig.llb.

e. If you add multiple pages, they will be added to the end of the Tools > Options list in alphabetical order based on prefPage VI file name.

 

Alrighty, have fun. Hopefully it's obvious that everything above is definitely *not* supported by NI through official channels. I did, however, file Bug 1004153 to see about adding these hooks to a future LabVIEW release.

DNatt, NI
Message 7 of 11
(594 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

Hello Darren,

 

Many thanks this is exactly what I was looking for ! I tried a couple of things with PreferencePages folder but I was missing the "PreferenceDialog.vi". You just saved me hours of blind research ^^

 

Since I intend to release the tool I'm developing for internal purposes at first there is no problem to edit LabVIEW VI files and manage my own storage for settings but it would be very cool if the system could be fully integrated with LabVIEW. And it could make IDE customization tools a lot easier to share publicly.

Arcale | CLA, CLED, CTD | LabVIEW enthusiast
0 Kudos
Message 8 of 11
(573 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

Hi all,

a bit sad Darren was faster. 🙂

 

I have a pretty similar solution but without changing the original PreferenceDialog.vi file so you can have it a bit more under control.

I only renamed it to "PreferenceDialog (original).vi" and call it from my wrapper (attached).

I modified the rules to be the same - prefPage_ prefix in the User directory but you can collect those pages paths your own way.

pageUserTemplate.vit is a modified template using LabVIEW.ini.

 

Enjoy

H;p

 

Extra tip: You can call this new PreferenceDialog.vi directly for testing your own pages.

 

Tested in LabVIEW 2017, saved for 2014.

Download All
Message 9 of 11
(561 Views)
Highlighted

Re: Add menu to LabVIEW Options Window

FYI to all, Nicolas sent me a PM asking about another possible extension point. Since I couldn't find a way to send attachments in private messages, I'll post the reply here in case it helps anybody else.

 

Nicolas also wanted to know how to add his own pages to the EXE build spec properties dialog. Those pages are defined in the following VI:

 

[LabVIEW 20xx]\vi.lib\AppBuilder\AB_Classes\EXE\Framework_Initialize.vi
 
Below I have attached a copy of this VI with its password removed, saved in LabVIEW 2014. If you replace the VI in the path specified above (backup the shipping VI first), you can then hack around in the new VI to add pages. I've also attached a copy of one of the pages with its password removed (also saved in LabVIEW 2014), so you can see how the interface to the page framework works:
 
[LabVIEW 20xx]\resource\Framework\Providers\Builds\AppBuilder\AB_UI_Page_Info.vi
(Note that this is where all the page VIs live. When you add your own, they need to go in this same folder).
 
As before, this is a wildly unsupported scenario, so if you have problems, you're on your own.
DNatt, NI
Download All
0 Kudos
Message 10 of 11
(468 Views)
Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.