Ultra Light Client Guide and Reference


Button general advice

Code examples

The following code creates a button with the label Delete:

UlcButton new label: 'Delete'

UlcAbstractButton and its subclasses use the standard Smalltalk callback mechanism to notify clients when they are pressed. Methods to register callbacks for ULC events are categorized under ULC-API-Callbacks.

SomeWindow>>#createDeleteButton
 
 | button |
 
 ^(button := UlcButton new label: 'Delete')
   addActionCallbackFor:self
   selector: #deleteButtonClicked: clientData: callData: clientData: nil;
 yourself
 
SomeWindow>>#deleteButtonClicked: aButton clientData: clientData callData: callData
 "handle the delete action triggered by aButton"
 aButton disable.
 .... "delete now"
 

Tooltips, enablers, and mnemonics are features supported by all button-like classes.

Enablers

A feature required for buttons and menu items is to change their enable or disable state depending on the state of another widget. In ULC, this is done with enablers. An enabler informs its registered widgets that it has changed its state, and effects the change of the enable or disable state on those widgets. The following classes can serve as enablers:

The following classes can serve as concatenated enablers:

The following code uses UlcTable as the enabler for UlcButton:

(UlcButton new label: 'Delete';yourself) setEnabler: UlcTable new

The UlcTable instance tells the button to change its state to enable whenever there is a item selected in the table.

Mnemonics

UlcButton also supports mnemonics (a single character). When the user presses that key with the Alt key, the button behaves as if clicked. The following code sets aButton's mnemonic to the A key:

aButton setMnemonic: $A

The mnemonic character is parsed from the label automatically provided the marker is the tilde (~) character.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]