Button

Button control for executing actions and controlling dialog. Button control demo

Property Default Value Description
id empty id (name) of the button control
title empty title of the control.
admin false UAC icon to indicate actions requiring Administrator rights.
default false [Indicates default button - button that is automatically executed, if user press Enter. There shall be only one default button on dialog for correct processing.
align stretched Alignment of the control
positive false Indicates positive buttons that shall be disabled if all required fields on dialog are not filled
returnval empty Dialog return value. If there is no onclick event is bound, dialog will be automatically closed, after button click and returnval is returned by Application.dialog(...).
Event Description
onclick event handler (function name) to be called, if button is clicked
ID Positive
none false
cancel false
ok true
yes true
no false
abort false
retry true
continue true
close false
help false
other false
button.hejs
var varStorage = new Storage(); 
var dialog_template = 
'@<dialog title="Test Dialog" resizing="both"> \
	<group> \
		<paragraph text="&amp;Required field:" style="required"/> \
		<edit cuebanner="Enter here something" required="true" minwidth="25"/> \
    </group> \
    <group> \
		<paragraph text="&amp;Positive button:"/> \
		<button title="&amp;Save" returnval="save" positive="true"/> \
    </group> \
	<group> \
		<paragraph text="&amp;Admin button:"/> \
		<button title="&amp;Format C:\\" returnval="format" admin="true"/> \
	</group> \
	<group> \
		<paragraph text="Action button:"/> \
		<button title="Click Me" onclick="onButtonClick"/> \
	</group> \
    <group minwidth="75" minheight="23" uniform="true" align="center"> \
   		<button title="&amp;OK" default="true" returnval="ok"/> \
   		<button title="&amp;Cancel" returnval="cancel"/> \
    </group> \
</dialog>@';
 
Output().writeln("Dialog returns: " + dialog(dialog_template, varStorage));
 
function onButtonClick() {
	alert("Control Text: " + this.Text + "\r\nControl Name: " + this.Name);
}