Dialog timeout control

Adding a timeout control to a no yes dialog box has some value. While the standard system does not allow you to control a form in this way for boxes, it is possible to modify the system to achieve this.

Using the box::yesnoAxaptaForm control rather than the box:yesno, you are able to modify the box class to achieve a timeout control.

Modify class Box, method yesNoAxaptaForm. Add the f

public client static DialogButton yesNoAxaptaForm(
str _text,
DialogButton _defaultButton,
str _title = “@SYS11132”,
int _timeout = 0
)
{
Args args;
Object formRun;
;
args = new Args();
args.name(formstr(SysBoxForm));
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.setTitle(_title);
formRun.setText(_text);
formRun.setType(DialogBoxType::YesNoBox);
formRun.parmDefaultButton(_defaultButton);
formRun.run();
if(_timeout > 0)
{
formRun.setTimeOut(methodStr(formRun, closeok), _timeout, false);
}
formRun.wait();
return formRun.dialogButton();
}

The lines in red are the new pieces of code. Allowing a new parameter to be passed into the control gives the caller the control of how long the timeout will occur. If you send 10,000 then the control will stay for 10 seconds. If no answer is provided by the user in this time, the default button will automatically return to the caller.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s