CwToolBar
CwToolBar contains one or more buttons which, when pressed, send a command to the parent window.
Protocol
Protocols can be divided into several groups:
•pertaining to creation
•pertaining to the tool bar
•pertaining to a button contained in the toolbar. Those buttons are instances of CwToolButton.
creation
createToolButton: theName argBlock: argBlock
add a CwToolButton as a child of the receiver.
tool bar
deleteAllItems
remove all buttons in the receiver.
deleteItem:
remove the specified button from the receiver.
deleteItems:
remove the specified buttons from the receiver.
items
answer the Buttons in the receiver.
marginHeight
Answer the vertical distance between the button edge and thee edge of the receiver's window.
marginHeight: anInteger
Set the vertical distance between the button edge and the edge o the receiver's window.
marginWidth
Answer the horizontal distance between the button edge and thee edge of the receiver's window.
marginWidth: anInteger
Set the horizontal distance between the button edge and the edge o the receiver's window.
showTips
Answer whether toe receiver will show tooltip on the buttons.
showTips: aBoolean
Set whether toe receiver will show tooltip on the buttons.
Pertaining to the buttons in the tool bar
buttonType
Answer the kind of button in terms of appearance and behavior.
XmPUSHBUTTON - The button is a push button.
XmCHECKBUTTON - The button is a check button.
XmRADIOBUTTON - The button remains pressed until another button in the group is pressed. Exactly one button in the group can be pressed at any one moment. A radio group is defined as consecutive buttons with the XmRADIOBUTTON type.
XmSEPARATOR - The button functions as a separator with a fixed width of 8 pixels.
whether toe receiver will show tooltip on the buttons.
buttonType: anInteger
Answer the kind of button in terms of appearance and behavior.
image
Answer the image displayed by the receiver.
image: aCgPixmap
Set the image displayed by the receiver.
sensitive
Answer whether the receiver will react to input events.
sensitive: aBoolean
Set whether the receiver will react to input events.
separatorWidth
Answer the width of separation for a separator button.
separatorWidth: anInteger
If the button is a separator, set the width of separation.
set
Answer whether the receiver will be displayed as set.
set: aBoolean
Set whether the receiver will be displayed as set.
Callbacks and Events
The tool bar has callbacks or events specific to it.
Single selection
executed when an button is clicked; the call data object is CwValueCallbackData
Example
Create a toolbar wth a single button.
toolBar := CwToolBar
createWidget: 'toolbar'
parent: shell
argBlock: nil.
toolBar manageChild.
toolBar
createToolButton: 'button1'
argBlock: [:w |
w
labelString: 'Button 1';
toolTipText: 'PushButton'].
"This callback catches the button clicks."
toolBar
addCallback: XmNsingleSelectionCallback
receiver: self
selector: #singleSelection:clientData:callData:
clientData: nil.
Last modified date: 04/21/2022