Removing Menus and Panels from DIAdem

Updated Jun 12, 2023

Environment

Software

  • DIAdem

This article demonstrates how to customise the DIAdem™ User Interface (UI) by removing default panels and menu items. This modification may be useful for applications where the user experience:
  • Prevents users from accessing certain menu items such as the File >> Save As... option.
  • Limits users to specific DIAdem panels.
For demonstration purposes, the example below illustrates how to remove the File menu item and DIAdem panels. To remove other menu items, the same concept can be applied.

Modifying or removing DIAdem panels and menus requires changing the Desktop file (.DDD). This file stores settings for DIAdem's behaviour, data formats and channel properties. Refer to Configuring DIAdem for further information.

Follow the instructions below to remove DIAdem menus and panels:

1. Open DIAdem and navigate to the SCRIPT panel.
2. Select File >> New VBS to create a new script.
3. Underneath the Option Explicit line, enter the following to declare some array variables:

Dim i, MyPanels, MyMenus
  
MyPanels = Array("NAV", "VIEW", "ANA", "REP", "SCR")
MyMenus = Array("NAVIGATOR", "VIEW","ANALYSIS", "REPORT", "SCRIPT")


4. Call the Reset method to reset the BarManager to it's default state by entering Call BarManager.Reset.
  • The BarManager object is used to access panels and bars in DIAdem. Refer to Object: BarManager for more details.
  • Note: this step is optional but ensures that the DIAdem environment always starts from it's default saved state.
5. Next, create a For Loop that iterates through the variable arrays to remove the File menu item.
  • This section utilises the BarManager.Bars.Remove() method to remove a specific menu item. Refer to Method: Remove for Bars for the method definition.
  • Copy and paste the lines below to achieve this.
MyPanels = Array("NAV", "VIEW", "ANA", "REP", "SCR")
For i = 0 to 4
  Call BarManager.Bars.Remove(MyPanels(i) & "Main")
  Call MenuItemDel(MyMenus(i), "1")
Next


6. Use the WndShow() command, as shown, to sequentially show the results of calling BarManager.Bars.Remove().
Call MsgBoxDisp("Press OK to observe that the File menu has been removed from each Panel.")
WndShow("NAVIGATOR")
Pause(1)
WndShow("VIEW")
Pause(1)
WndShow("ANALYSIS")
Pause(1)
WndShow("REPORT")
Pause(1)
WndShow("SCRIPT")


7. To remove the DIAdem panels, leverage the functionality of the BarManager.Bars.RemoveAll method. The script lines below can be copied.
Call MsgBoxDisp("Press OK to observe that all panels and menus have been removed.")
BarManager.Bars.RemoveAll
WndShow("NAVIGATOR")
Pause(1)
WndShow("SCRIPT")


8. Finally, as an optional step, call the BarManager.Reset method to reset DIAdem back to it's default.

Call msgBoxDisp("DIAdem will now revert to the default UI layout.")
Call BarManager.Reset
  • Note: this is a recommended step if the changes made to the .DDD file should not be permanently saved.
  • When closing DIAdem, ensure that Exit and Do Not Save is selected from the dialog pop-up to avoid permanent modifications.


Do not save DDD.png

After following the steps above, the script file should resemble the following code.
Alternatively, download the attached Removing Panels and Menus.VBS file.

Option Explicit  'Forces the explicit declaration of all the variables in a script.

Dim i, MyPanels, MyMenus
  
MyPanels = Array("NAV", "VIEW", "ANA", "REP", "SCR")
MyMenus = Array("NAVIGATOR", "VIEW","ANALYSIS", "REPORT", "SCRIPT")
  
'--Reset the Bars and Menus to start with DIAdem's default settings
Call BarManager.Reset

'--Delete the Icon Bars and File menus from all DIAdem Panels
MyPanels = Array("NAV", "VIEW", "ANA", "REP", "SCR")
For i = 0 to 4
  Call BarManager.Bars.Remove(MyPanels(i) & "Main")
  Call MenuItemDel(MyMenus(i), "1")
Next

'-- Display each Panel to show the removed menu item --'
Call MsgBoxDisp("Press OK to observe that the File menu has been removed from each Panel.")
WndShow("NAVIGATOR")
Pause(1)
WndShow("VIEW")
Pause(1)
WndShow("ANALYSIS")
Pause(1)
WndShow("REPORT")
Pause(1)
WndShow("SCRIPT")

'-- Remove the Panels --'
Call MsgBoxDisp("Press OK to observe that all panels and menus have been removed.")
BarManager.Bars.RemoveAll
WndShow("NAVIGATOR")
Pause(1)
WndShow("SCRIPT")

Call msgBoxDisp("DIAdem will now revert to the default UI layout.")
Call BarManager.Reset