Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 3 out of 5     Rate this Document

Adding customized pull down menus to DIAdem

Primary Software: DIAdem
Primary Software Version: 8.00
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: How can I modify the existing, or add my own pull down menus in DIAdem?

Solution: New to DIAdem 8.0 is the ability to modify or add your own pull down menus to the DIAdem user interface. There are 5 new VBS commands available: MenuItemAdd, MenuItemInsert, MenuItemDel, MenuItemChange, & MenuReset

Having the ability to add or modify the pull down menus can add flexibility to a DIAdem based analysis solution.

The attached example will add a new pull down menu in DIAdem CALC called “Custom Func”, with the associated menu items “Function 1”, “Function 2”, “Plot 1 & 2” and “Calc 1 & 2”.

There are two files associated with example, the first file, “AddMenu.VBS”, contains the code that will modify menus, while “MenuHandle.VBS” interprets what to do when a menu item has been selected.

Looking at a line of code in AddMenu.VBS:

Call MenuItemInsert("CALC","11"+".1","MENUITEM","Function 1","call scriptstart(""MenuHandle"",""func1"")")

The MenuItemInsert command is going to insert a menu in DIAdem CALC in the 11th position. When the user selects this menu item it will run the command scriptstart which in turn runs the subroutine, “func1” in the file “MenuHandle.vbs”

Only run the the AddMenu.VBS once, if you make changes to the file and wish to run it a second time you first need to run the following single line script

Call menureset

Additional information can be found in the DIAdem Help file, search under “Menu”



CODE in AddMenu.VBS



Call MenuItemAdd("CALC","11","POPUP","Custom Func")
Call MenuItemInsert("CALC","11"+".1","MENUITEM","Function 1","call scriptstart(""MenuHandle"",""func1"")")
Call MenuItemInsert("CALC","11"+".2","MENUITEM","Function 2","call scriptstart(""MenuHandle"",""func2"")")
Call MenuItemInsert("CALC","11"+".3","SEPARATOR")
Call MenuItemInsert("CALC","11"+".4","POPUP","Graph Data")
Call MenuItemInsert("CALC","11"+".4.1","MENUITEM","Plot 1","call scriptstart(""MenuHandle"",""plot1"")")
Call MenuItemInsert("CALC","11"+".4.2","MENUITEM","Plot 2","call scriptstart(""MenuHandle"",""plot2"")")
Call MenuItemInsert("CALC","11"+".5","SEPARATOR")
Call MenuItemInsert("CALC","11"+".6","POPUP","Math")
Call MenuItemInsert("CALC","11"+".6.1","MENUITEM","Math 1","call scriptstart(""MenuHandle"",""math1"")")
Call MenuItemInsert("CALC","11"+".6.2","MENUITEM","Math 2","call scriptstart(""MenuHandle"",""math2"")")


CODE for MenuHandle.VBS


sub func1()
msgbox "function 1" 'add code here
end sub

sub func2()
msgbox "function 2" 'add code here
end sub

sub plot1()
msgbox "plot 1" 'add code here
end sub

sub plot2()
msgbox "plot 2" 'add code here
end sub

sub math1()
msgbox "math 1" 'add code here
end sub

sub math2()
msgbox "math 2" 'add code here
end sub


Related Links:

Attachments:


menuhandle.VBSAddMenu.VBS


Report Date: 07/09/2002
Last Updated: 12/05/2004
Document ID: 2N8CPNZL

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit