From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-04-2012 03:46 PM
Are there any characters that are not valid in a LabVIEW custom ItemName?
If you create an ItemName such as 'One_Two_Three' under a File Item, or even at the top-level it is displayed wrong.
Item Name: One_Two_Three
Displayed as: OneTwo_Three
It seems the first 'underscore' is being cutoff. When displayed it actually looks like the T (in Two) is underlined.
Is that expected behavior?
I was working on some code to display a Recently Used File List in the File menu. I was hoping to just read the filename (as ItemNames) but items with an initial underscore are causing this error. I suppose there are some workarounds where I could just replace all "_" with some other character but that seems like more work than is necessary.
Thanks,
PH
Solved! Go to Solution.
05-04-2012 03:53 PM
I should mention: Using LabVIEW 2010 SP1.
05-04-2012 08:46 PM - edited 05-04-2012 08:48 PM
Yes, it is expected behavior.
Using the underscore character ahead of a menu item defines that letter to be a shortcut for when you use the keyboard. So it defines the T as the shortcut to pick that menu line. Look at the regular LabVIEW menu and you'll see numerous menu items with underlined characters.
Is there a reason why you want to use an underscore character in your menu? That is unusual and probably not recommended by some Microsoft UI guideline somewhere.
You could use a double underscore character for that first one. Then it will appear as a single underscore character. But then that will define the underscore as the shortcut key. Or you could define a the letter O, n, or e as a shortcut, then that will free up that _T to become shown with an underscore and not defined as a shortcut of T.
05-05-2012 03:42 PM
I wanted to put in the full path for recently used files in the File Menu. It works fine except for paths with underscores in them.
Notice, though, what I said the 'underscore' is NOT at the beginning but it replaces the first underscore it sees, no matter where the position is located.
"One_Two_Three" is what I want to display in the menu.
What actually displayed is:
OneTwo_Three
So if any of my paths contain a "_" ANYWHERE in them it gets removed by LabVIEW as the ItemName.
Thanks,
PH
05-05-2012 05:47 PM
I never said it was at the beginning of the menu item. It is ahead of a character that you want to make a shortcut letter. Often it is at the beginning such as before the F in File or S in Save., but it can be used anywhere in the menu item.
05-06-2012 10:27 AM
Thank you for the response,
I am still in the process of adding a 'Recent Files' submenu from the File menu. I wanted to display the FULL path to any files that the user recently opened. For example:
File -> Recent Files
Would display the full path, whatever that might be ( including any "_" characters ), such as these belo
C:\Program Files\Project1\Test2_2.INI
C:\Program Files\Project1\Test3_1.INI
I noticed that LabVIEW somehow gets around this, if open a VI with a "_" character the correct filename is displayed in the 'File->Recent Files' submenu.
How do they manage to do that? Is there some escape character for underscores?
My current workaround is to replace all "_" with "~" when displaying the item in the menu and then reversing the process when the user selects the file to display.
Thanks,
PH
05-07-2012 10:04 AM
I found that if you add "__" ( two underscores) for the first underscore it will resolve to display just one "_" in the ItemName displayed in the menu. So my logic will have to read an INI file, where I keep the list of recent files opened, replace the first "_" with "__" and set this as the actual ItemName in my Recent Files menu.
When a user selects a Recent Files menu item, I will have go back the opposite way to change "__" back to "_" in the ItemName selected.
Thanks,
PH