DIAdem Help

Content Type
Programming Language
Current manual

Collection: UsedActionObjs

Collection: UsedActionObjs

Collection of all elements used in a bar. The elements that a bar contains are references to elements of the ActionObj collection. When you access a UsedActionObjs collection you receive the element of the ActionObjs collection.

To access an individual bar element in a script, use the Item method, or enter the index or the name in parentheses.

Note  If you press <Shift-Ctrl> and idle the cursor on a bar element, DIAdem displays a tooltip with the name of the bar, the name of the bar element, and the name of the base object, which is called the base type. DIAdem also copies this information, separated by a space, to the clipboard.

The following example generates the bar element MyButton if this bar element does not already exist and adds this element to the DIAdem SCRIPT toolbar:

VBScriptPython

 

Dim oMyActionObj
If BarManager.ActionObjs.Exists("MyButton") Then
  Set oMyActionObj = BarManager.ActionObjs("MyButton")
Else
  Set oMyActionObj = BarManager.ActionObjs.Add("MyButton","CustomButton")
  oMyActionObj.Tooltip = "MyButton"
  oMyActionObj.OnClickCode.Code = "Call MsgBoxDisp(""Hello"")"
  oMyActionObj.Picture = "favicon.ico"
End If
BarManager.Bars("SCRMain").UsedActionObjs.Add(oMyActionObj)

The following example deletes the button that opens the SCRIPT panel, from the panel bar:

VBScriptPython

 

Call BarManager.Bars("DIAPanels").UsedActionObjs.Remove("DIAPanelSCRIPT")

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

Count

Methods

Add | Exists | Find | Insert | Item | Move | Remove | RemoveAll

Returned From

Bar.UsedActionObjs

Was this information helpful?

Previous

Panels

Previous

Panels