Show pageOld revisionsBacklinksAdd to bookBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Button ====== Button control for executing actions and controlling dialog. {{ :scripting:dialogs:button.png|Button control demo}} \\ ===== Properties ===== ^ Property ^ Default Value ^ Description ^ | **id** | empty | id (name) of the button control | | **title** | empty | title of the control. | | **admin** | false | [[wp>User_Account_Control|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 | [[scripting:dialogs:align|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 [[scripting:api:application:dialog|Application.dialog(...)]].| ===== Events ===== ^ Event ^ Description ^ | **[[scripting:dialogs:events:onclick|onclick]]** | event handler (function name) to be called, if button is clicked| ===== Predefined Return Values ===== ^ ID ^ Positive ^ | //none// | false| | //cancel// | false| | //ok// | true| | //yes// | true| | //no// | false| | //abort// | false| | //retry// | true| | //continue// | true| | //close// | false| | //help// | false| | //other// | false| ===== Example ===== <file javascript button.hejs> var varStorage = new Storage(); var dialog_template = '@<dialog title="Test Dialog" resizing="both"> \ <group> \ <paragraph text="&Required field:" style="required"/> \ <edit cuebanner="Enter here something" required="true" minwidth="25"/> \ </group> \ <group> \ <paragraph text="&Positive button:"/> \ <button title="&Save" returnval="save" positive="true"/> \ </group> \ <group> \ <paragraph text="&Admin button:"/> \ <button title="&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="&OK" default="true" returnval="ok"/> \ <button title="&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); }</file>