CommandBarControl properties

The CommandBarControl interface supports the following properties:

BeginGroup 
Access  Read/write 
Type  Boolean 
Description  Returns true if the control is preceded by separator. You can set this property to true to add a separator. 
Usage 
JScript 
var = CommandBarControl_object.BeginGroup;
CommandBarControl_object.BeginGroup = boolSeparator;
 
VBScript 
var = CommandBarControl_object.BeginGroup
CommandBarControl_object.BeginGroup = boolSeparator
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1); 
// add a separator 
cmdBarControl.BeginGroup = true;  
Application.alert(cmdBarControl.BeginGroup);
 

BuiltIn 
Access  Read-only 
Type  Boolean 
Description  Returns true for a built-in control; false for a custom control. 
Usage 
JScript  CommandBarControl_object.BuiltIn;  
VBScript  CommandBarControl_object.BuiltIn 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.Add("MyCommandBar");
cmdBar.Controls.Add();  // add a button
cmdBar.Controls.Add(5);  // add a command bar pop up
var cmdBarControl = cmdBar.Controls.item(1);
// returns false (0)
Application.alert(cmdBarControl.BuiltIn);   
var stdCmdBar = cmdBars.item("Standard");
// get the first button
var stdCmdBarControl = stdCmdBar.Controls.item(1);  
// returns true(1)
Application.alert(stdCmdBarControl.BuiltIn);  
 

DescriptionText 
Access  Read/write 
Type  Variant 
Description  Returns the current description for the specified control, or sets the new one; the description is displayed in the status bar of the application when the user positions the mouse cursor over the control. 
Usage 
JScript 
vbl = CommandBarControl_object.DescriptionText;
CommandBarControl_object.DescriptionText = strText;
 
VBScript 
vbl = CommandBarControl_object.DescriptionText
CommandBarControl_object.DescriptionText = strText
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);  
Application.alert(cmdBarControl.DescriptionText);
// assign some text
cmdBarControl.DescriptionText = "some descriptive text";  
Application.alert(cmdBarControl.DescriptionText);
 

Enabled 
Access  Read/write 
Type  Boolean 
Description  Returns the control's current enable state or sets the new enable state; for built-in controls, setting Enabled to true causes the application to determine its state, but setting it to false will force it to be disabled.  
Usage 
JScript 
vbl = CommandBarControl_object.Enabled;
CommandBarControl_object.Enabled = boolState;
 
VBScript 
vbl = CommandBarControl_object.Enabled
CommandBarControl_object.Enabled = boolState
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);  
Application.alert(cmdBarControl.Enabled);
cmdBarControl.Enabled = false;  // disable 
Application.alert(cmdBarControl.Enabled);
 

Height 
Access  Read/write 
Type  Long 
Description  (Not implemented in HoTMetaL PRO 1.0) 
Usage 
JScript  CommandBarControl_object.Height;  
VBScript  CommandBarControl_object.Height 

Id 
Access  Read-only 
Type  Integer 
Description  Returns the command ID for built-in controls; a control's ID determines the built-in action for that control; the value of Id for all custom controls is 1. 
Usage 
JScript  CommandBarControl_object.Id;  
VBScript  CommandBarControl_object.Id 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);  
// display command bar control ID
Application.alert(cmdBarControl.Id);  
 

Left 
Access  Read/write 
Type  Long 
Description  (Not implemented in HoTMetaL PRO 1.0) 
Usage 
JScript  CommandBarControl_object.Left;  
VBScript  CommandBarControl_object.Left 

OnAction 
Access  Read/write 
Type  Variant 
Description  Returns or sets the name of the HoTMetaL PRO macro that will be run when the user clicks or changes the value of the control. 
Usage 
JScript 
vbl = CommandBarControl_object.OnAction;
CommandBarControl_object.OnAction = strName;
 
VBScript 
vbl = CommandBarControl_object.OnAction
CommandBarControl_object.OnAction = strName
 
Example 

Create a macro file as follows:

<MACRO name="MyMacro" key="Ctrl+Shift+Q" lang="JScript">
Application.alert("test");
</MACRO>

The CommandBarControl object below calls `MyMacro'.

// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.Add("MyCommandBar");
cmdBar.Controls.Add();  // add a button
cmdBar.Controls.Add(5);  // add a command bar pop up
// get the button control
var cmdBarControl = cmdBar.Controls.item(1);	
// assign the OnAction property to execute
// "MyMacro" when the button is clicked.
cmdBarControl.OnAction="MyMacro";
  
 

State 
Access  Read/write 
Type  Integer 
Description  Returns or sets the button's state. The allowed values are:
  • 0: unset
  • 1: up
  • 2: down
 
Usage 
JScript 
vbl = CommandBarButton.State;
CommandBarButton.State = intState;
 
VBScript 
vbl = CommandBarButton.State
CommandBarButton.State = intState
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarButton = cmdBar.Controls.item(1);  
Application.alert(cmdBarButton.State);
 

TooltipText 
Access  Read/write 
Type  Variant 
Description  Returns or sets the control's tooltip text.  
Usage 
JScript 
vbl = CommandBarControl_object.TooltipText;
CommandBarControl_object.TooltipText = strText;
 
VBScript 
vbl = CommandBarControl_object.TooltipText
CommandBarControl_object.TooltipText = strText
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.Add("My Command Bar");
cmdBar.Controls.Add();  // add a button
cmdBar.Controls.Add(5);  // add a command bar pop up
var cmdBarControl = cmdBar.Controls.item(1);
cmdBarControl.TooltipText = "My tool tip";
 

Top 
Access  Read/write 
Type  Long 
Description  (Not implemented) 
Usage 
JScript  CommandBarControl_object.Top;  
VBScript  CommandBarControl_object.Top 

Type 
Access  Read-only 
Type  Integer 
Description  Returns the type of control; the allowed values are:
  • 1: button
  • 5: popup (menu)
 
Usage 
JScript  CommandBarControl_object.Type;  
VBScript  CommandBarControl_object.Type 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("Standard");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);  
// display control type
Application.alert(cmdBarControl.Type);  
 

Visible 
Access  Read/write 
Type  Boolean 
Description  Returns true if the specified control is visible. Visible is true by default for newly created custom command bar controls. Hide a control by setting this property to false
Usage 
JScript 
vbl = CommandBarControl_object.Visible;
CommandBarControl_object.Visible = boolState;
 
VBScript 
vbl = CommandBarControl_object.Visible
CommandBarControl_object.Visible = boolState
 
Example 
// SoftQuad Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item("My Command Bar");
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);  
cmdBarControl.Visible = false;
 

Width 
Access  Read/write 
Type  Long 
Description  (Not implemented) 
Usage 
JScript  CommandBarControl_object.Width;  
VBScript  CommandBarControl_object.Width 


Right arrow
Next Topic
Left arrow
Previous Topic
Table of contents
Table of Contents

Copyright © SoftQuad Software Inc. 1999