Search:     Advanced search

function NewButton(Left, Top, Caption, ButtonType = mrNone)

Article ID: 314
Last updated: 24 Sep, 2010
Views: 794
Posted: 12 Dec, 2008
by Thomas B.
Updated: 24 Sep, 2010
by Murray D.

 

Description:

Creates a New Button. (Returns an object of class TButton.)

Notes:

Parameters

Left (This is an integer value for the left position of the button on the form.)

Top (This is an integer value for the top position of the button on the form.)

Caption ( This is a string value for the caption of the label.)

Button Type (optional - default is mrNone.)
this is the value that the form will return when the click the button.  If this value is not mrNone, when they click the button, it will close the form, and return the button value (see example).  This allows the script to determine which button was clicked on the form.

Possible Vaues

mrOk ( This makes the button an "Ok" button.)

mrCancel (This makes the button a "Cancel" button.)

mrYes (This makes the button a "Yes" button.)

mrNo (This makes the button a "No" button.)

mrNone (This is the default value with no result.)

Pascal Example:

Form := NewForm(200,200, 'Are you sure?');
YesButton := NewButton(20,20 'Yes',mrYes);
NoButton := NewButton(20,60,'No',mrNo);
if Form.ShowModal = mrYes then;
  //User click Yes Button
  ShowMessage('You have clicked the yes button');
if Form.ShowModal = mrNo then
  //User click no Button
  ShowMessage('You have clicked the no Button');
 

Visual Basic Example:

Form = NewForm(200,200, "Are you sure?")
YesButton = NewButton(20,20 "Yes",mrYes)
NoButton = NewButton(20,60,"No",mrNo)
if Form.ShowModal = mrYes then
  //User click Yes Button
  ShowMessage("You have clicked the yes button")
End if
if Form.ShowModal = mrNo then
  //User click no Button
  ShowMessage("You have clicked the no Button")
End if


Enterprise and Developer editions

This article was:  
Prev  Not what you're looking for? Suggest a topic  Next
function NewEdit(Left, Top, DefaultText = "")     function NewRadioButton(Left, Top, Caption)