User Tools

Site Tools


DzButton

DAZScript abstract base class for button widgets.

More...

Inherits :

Inherited By : DzCheckBox, DzPushButton, DzRadioButton and stepbutton_dz

Properties

Methods

DAZ Script
voidtoggle ()

Signals

voidclicked ()
voidpressed ()
voidreleased ()
voidstateChanged ( Number state )
voidtoggled ( Boolean onOff )

Detailed Description

DzButton implements an abstract button base. Subclasses specify how to respond to user interaction, and how to present the button to the user. If you want to create a button, create a DzPushButton.

DzPushButton provides both push and toggle buttons. The DzRadioButton and DzCheckBox classes provide only toggle buttons.

The difference between down and on is, when a user clicks a [toggle] button to toggle it on, the button is first pressed and then released into the On state (on is true, down is false). When the user clicks it again (to toggle it off), the button is first pressed and then released to the Off state (on and down are false).

Properties


Boolean : autoRepeat

Whether autoRepeat is enabled. false by default. If enabled, the clicked() signal is emitted at regular intervals if down is true. This property has no effect on toggle buttons.


Number : autoRepeatDelay

The initial delay, in milliseconds, before auto-repetition begins


Number : autoRepeatInterval

The length of the auto-repetition interval, in milliseconds


Boolean : checkable

Whether or not the button is checkable. false by default.


Boolean : checked

Whether or not the button is checked. Only applies to checkable buttons.


Boolean : down

Whether the button is pressed. true if the button is pressed down. false by default. The signals pressed() and clicked() are not emitted when this property set to true.


Pixmap : pixmap

The Pixmap shown on the button. If the Pixmap is monochrome (e.g. its depth is 1) and it does not have a mask, the Pixmap will be its own mask. This allows transparent bitmaps to be drawn, which are important for toggle buttons. 0 if no pixmap is set.


String : text

The text displayed on the button. undefined by default. An ampersand (&) in the String automatically creates an accelerator for it using the character that follows the ampersand, as the accelerator key. Any previous accelerator will be overwritten, or cleared if no accelerator is defined by the text.


Boolean : toggleButton

Whether the button is a toggle (Read Only). false by default.

Methods


void : toggle()

Toggles the state of a toggle button.

Signals


void : clicked()

Signature:“clicked()”

Emitted when the button is pressed and then released.

Example:

function handleButtonClicked(){
	print( "Button clicked." );
}
 
//... build a DzDialog
 
var wButton = new DzPushButton( wDlg );
wButton.clicked.connect( handleButtonClicked );

void : pressed()

Signature:“pressed()”

Emitted when the button is pressed.

Example:

function handleButtonPressed(){
	print( "Button pressed." );
}
 
//... build a DzDialog
 
var wButton = new DzPushButton( myDialog );
wButton.pressed.connect( handleButtonPressed );

void : released()

Signature:“released()”

Emitted when the button is released.

Example:

function handleButtonReleased(){
	print( "Button released." );
}
 
//... build a DzDialog
 
var wButton = new DzPushButton( wDlg );
wButton.released.connect( handleButtonReleased );

void : stateChanged( Number state )

Signature:“stateChanged(int)”

Emitted when toggleState on this button has changed.


void : toggled( Boolean onOff )

Signature:“toggled(bool)”

Emitted when the button is toggled.

Parameter(s):

  • onOff - true if the button is on, false if the button is off.

Example:

function handleButtonToggled( bArg ){
	print( String( "Button toggled: %1" ).arg( bArg ) );
}
 
//... build a DzDialog
 
var wButton = new DzPushButton( wDlg );
wButton.toggled.connect( handleButtonToggled );