SolidWorksMakroprogrammierung

Methode · CommandTabBox

AddCommands-Methode (CommandTabBox)

Fügt dem Feld der Registerkarte Schaltflächen hinzu, je Befehls-ID eine.

Syntax

Function AddCommands( _
   ByVal CommandIDs As Variant, _
   ByVal TextDisplayStyles As Variant _
) As Boolean
bErfolg = swTabBox.AddCommands(aIds, aText)

Parameter

CommandIDsVariantByVal
Array der Befehls-IDs der Schaltflächen.
TextDisplayStylesVariantByVal
Array mit der Textanzeige je Schaltfläche, als Werte aus swCommandTabButtonTextDisplay_e.

Rückgabewert

True, wenn die Schaltflächen hinzugefügt wurden, sonst False.

Beispiel

' Im Add-in: swTabBox ist ein Feld (CommandTabBox), swCmdGrp eine aktivierte Befehlsgruppe mit den Einträgen nIndex0 und nIndex1.
Dim aIds(2) As Long, aText(2) As Long
aIds(0) = swCmdGrp.CommandID(nIndex0)
aIds(1) = swCmdGrp.CommandID(nIndex1)
aIds(2) = swCmdGrp.ToolbarId                              ' die ganze Symbolleiste
aText(0) = swCommandTabButton_TextHorizontal
aText(1) = swCommandTabButton_TextHorizontal
aText(2) = swCommandTabButton_TextHorizontal Or swCommandTabButton_ActionFlyout
If False = swTabBox.AddCommands(aIds, aText) Then Debug.Print "Nicht hinzugefügt"

Bemerkungen

Du kannst Einträge von Befehlsgruppen und Flyouts hinzufügen. Die IDs holst du bei Flyouts mit FlyoutGroup.CmdID, bei Befehlsgruppen nach CommandGroup.Activate mit CommandGroup.CommandID oder CommandGroup.ToolbarId. Im C#-Beispiel „Create Flyouts in the CommandManager“ verknüpft die Hilfe die Textanzeige für die ToolbarId und für ein Flyout mit Or mit swCommandTabButton_ActionFlyout aus swCommandTabButtonFlyoutStyle_e. Was die Flyout-Stile im Einzelnen bewirken, sagt die Hilfe nicht.

Aus einem Makro heraus liefert SldWorks.GetCommandManager Nothing; Registerkarten gibt es nur in einem Add-in.

Siehe auch

Verfügbarkeit

SOLIDWORKS 2008

Englisches Original: ICommandTabBox::AddCommands in der SOLIDWORKS API-Hilfe ↗ (dort mit dem .NET-Namen)

Fragen zu diesem Befehl oder ein Befehl fehlt? Frag im Discord.