DIAdem Help

Object: ActionObj

  • Updated2024-09-12
  • 3 minute(s) read

Object: ActionObj

The ActionObj provides an element in a bar, which appears as a symbol on the interface.

You can use an ActionObj object in one or more bars. An ActionObj object has a base object or base type that defines which task the ActionObj object executes. For example, the ANADlgChnAdd base type specifies that DIAdem opens a dialog box for the summation of channels. Under certain conditions you can change an ActionObj object that has a base type which refers to a specific function. The function of the ActionObj object remains the same. If you want to create an ActionObj object with any functionality, you can use the base types CustomButton, CustomCheckButton, and CustomPopup.

The ActionObj corresponds to one of the following objects:

ActionObjButton (ToActionObjButtonInt)Button
ActionObjCheckbutton (ToActionObjCheckInt)Button that displays a status.
ActionObjPopup (ToActionObjPopupInt)Button that opens a sub-bar.
ActionObjSeparator (ToActionObjSeparatorInt)Separator

The following example duplicates an existing button, changes the tooltip of the new button, and adds the new button to the toolbar in DIAdem ANALYSIS:

VBScriptPython

 

Call BarManager.ActionObjs.Copy("ANADlgChnAdd","MyANADlgChnAdd")
BarManager.ActionObjs("MyANADlgChnAdd").Tooltip = "My channel add function"
Call Barmanager.Bars("ANAMain").UsedActionObjs.Insert("MyANADlgChnAdd",5)

The following example generates a button with sub buttons and a separator:

VBScriptPython

 

Dim oMyBar
If not BarManager.Bars.Exists("MyBar") Then
  Set oMyBar = BarManager.Bars.Add("MyBar")
Else
  Set oMyBar = BarManager.Bars("MyBar")
  Call oMyBar.UsedActionObjs.RemoveAll
End If

Call CreateActionButton("MyButton_1","expl_star_yellow_add.ico","Starts User Command", "Call MsgBoxDisp(""User Function"")",oMyBar)
Call oMyBar.UsedActionObjs.Add("Separator")
Call CreateActionButton("MyButton_2","expl_star_yellow_delete.ico","Deletes Bar", "Call BarManager.Reset",oMyBar)
Call CreateActionPopupObj("MyPopup", "expl_star_yellow.ico", "Example-Bar", oMyBar, "SCRGroup")

Sub CreateActionButton(sID, sIconName, sToolTip, sCommand, ByRef oBar)
    Dim oButtonObj, sUniqueButton_ID
    sUniqueButton_ID = sID
    If (BarManager.ActionObjs.Exists(sUniqueButton_ID)) Then
      Set oButtonObj = BarManager.ActionObjs(sUniqueButton_ID)
    Else
      Set oButtonObj = BarManager.ActionObjs.Add(sUniqueButton_ID, "CustomButton")
      oButtonObj.Picture = sIconName
      oButtonObj.Tooltip = sToolTip
      oButtonObj.OnClickCode.Code = sCommand
    end if
    oBar.UsedActionObjs.Add(oButtonObj)
End Sub

Sub CreateActionPopupObj(sIDName, sIconName, sToolTip, oActionBar, sActionGroup)
  ' New ActionObject
  dim oExampleAction, sExampleMain_ID
  sExampleMain_ID = sIDName
  If (BarManager.ActionObjs.Exists(sExampleMain_ID)) Then
    Set oExampleAction = BarManager.ActionObjs(sExampleMain_ID)
  Else
    Set oExampleAction = BarManager.ActionObjs.Add(sExampleMain_ID, "CustomPopup")
    oExampleAction.Picture = sIconName
    oExampleAction.Tooltip = sToolTip
    oExampleAction.BarID = oActionBar.ID
  End If
  
  If not BarManager.Bars(sActionGroup).UsedActionObjs.Exists(oExampleAction) Then
    Call BarManager.Bars(sActionGroup).UsedActionObjs.Add(oExampleAction)
  End If
End Sub

Properties

ID | Type