To download NI software, including the products shown below, visit ni.com/downloads.
Overview
To demonstrate how to make toolbars and menu bars with a dedicated palette
Description:
LabVIEW lets you create toolbars and menu bars with a dedicated palette. Nevertheless, you can not do anything with the LabVIEW menu palette and can hardly customize it. Here's a tiny API that will enable you to create a .NET Menu bar.
Instructions:
To implement this example:
To execute this example:
Requirements
Software
LabVIEW 2012 or compatible
Hardware
-
**This document has been updated to meet the current required format for the NI Code Exchange.**
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Very Nice,
Menu with Icons, excellent.
-Artur
It would be more effective, if its possible to set the key board short cut keys to drop down items.
--mahesh y t
Hi, I see an issue with using this .NET control. If there is a Labview control below the "menu item" you are clicking in the .NET menustrip, Labview ignores the click on the .NET control and executes the MOUSE DOWN event on the Labview Control. Do you have any idea how to make this work. Procedure to replicate the issue:
1. Place a Labview Control just below the MENUSTRIP. (May be a Boolean Control)
2. Run the Example Program VI and click the Menu Item Just above the Boolean control that you placed.
3. You can see that it clicks the boolean control and not the menu strip. Sometimes, it does click on the menu item too.. Any workarounds for this?
Thank you!
Quick work arounds:
Move control or disable temporary, while operating .net menu
I haven't used this .net control, but overall my experience with .net controls in LabVIEW environment was that they always stay on top - i.e. ignore LabVIEW order (and even been re-drawn sometimes, while hidden), so that you always clicking on .net controls not LabVIEW controls.
-Artur
Eric_M,
Are there a way to force the text to be interpreted as Unicode (in ToolStripMenuItem)?
Regards,
Jean-Marc
Not sure, but check what you can do with "Font" property under ToolStripMenuItem. Setting GdiCharSet or FontName might be the ticket...
-Artur
Unfortunately, this is not working (I already tried a Unicode font and GdiCharSet is a only read property).
The problem in my understanding (I could be wrong) is that LabVIEW is an ANSI software:
“ A window class is supported by a window procedure. Your application can register a window class by using either RegisterClassA or RegisterClassW. New applications should typically use RegisterClassW.
If the application registers the window class using RegisterClassA, the function informs the operating system that the windows of the created class expect messages with text or character parameters to use a Windows (ANSI) code page character set.”
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319108%28v=vs.85%29.aspx
I think that ToolSripMenuItem expects, in LabVIEW, an ANSI string.
I just wonder if someone have an idea how to force ToolSripMenuItem to expect (in LabVIEW) an Unicode string.
JM
Font constructor allows you to set what you need.
I do not think that labview is the problem here, text value is unicode in .net.
Try it,
-Artur
LabVIEW handles a char as a 8-bit data type (UTF-8 or Latin1). If you want to use "true" unicode that allows you to display any language like chinese or russian, the chars must be 16-bits capable. C# does handle chars as 16-bits so you can create a menu displaying russian, BUT all the strings must be hard-coded into an assembly built from Visual Studio. If you use the regular strings from LabVIEW to call .NET, the Component Language Runtime will just take your LV string so it will not work.
Sorry for the bad news 😕
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
I missed that "ToolStripMenuItem" accepts "text" as string only not a reference - thats a bummer...
-Artur