Creating a Custom Dialog Box - WinRunner

A custom dialog box has a custom title, up to ten edit fields, up to ten check boxes, an “execute” button, and a Cancel button. You specify the label for the “execute” button. When you click the “execute” button, a specified function is executed. The function can be either a TSL function or a userdefined function.

You use the TSL function create_custom_dialog to create a custom dialog box. This function has the following syntax:

create_custom_dialog ( function_name, title, button_name, edit_name1-n,
check_name1-m );

  • function_name is the name of the function that is executed when you click the “execute” button.
  • title is an expression that appears in the title bar of the dialog box.
  • button_name is the label that will appear on the “execute” button. You click this button to execute the contained function.
  • edit_name contains the labels of the edit field(s) of the dialog box. Multiple edit field labels are separated by commas, and all the labels together are considered a single string. If the dialog box has no edit fields, this parameter must be an empty string (empty quotation marks).
  • check_name contains the labels of the check boxes in the dialog box. Multiple check box labels are separated by commas, and all the labels together are considered a single string. If the dialog box has no check boxes, this parameter must be an empty string (empty quotation marks).

When the “execute” button is clicked, the values that the user enters are passed as parameters to the specified function, in the following order:

edit_name1,... edit_namen ,check_name1,... check_namem
In the following example, the custom dialog box allows the user to specify startup parameters for an application. When the user clicks the Run button, the user-defined function, run_application1, invokes the specified Windows application with the initial conditions that the user supplied.

res = create_custom_dialog ("run_application1", "Initial Conditions", "Run",
"Application:, Geometry:, Background:, Foreground:, Font:", "Sound,
Speed");

CREATING A CUSTOM DIALOG BOX

If the specified function returns a value, this value is passed to the variable res. If the Cancel button is clicked, an empty string (empty quotation marks) is passed to the variable res.

Note that you can precede any edit field label with an exclamation mark. When the user types input into the edit field, each character entered is represented by an asterisk. You use an exclamation mark to prevent others from seeing confidential information, such as a password.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics