Message dialogs
Under delphi you have several ways of displaying a messagebox. If you want a more elaborate messagebox you would call TApplication.messagebox which takes some flags as a parameter, or you can use good old showmessage() to bring up a very simple message for the user.
Under smart ShowMessage simply calls the browser’s built in alert() javascript function. It halts execution and shows the message.
We also have a more advanced dialog which is a part of TCustomApplication that you invoke using ShowDialog(). Since there is no such thing as a modal requester under javascript, you have to catch the results via an event. You can also check to see if a dialog is presently showing. Here are the functions that deals with the dialog:
[sourcecode language=”delphi”]
procedure ShowDialog(aCaption:String;aText: String;
aOptions: TW3AlertOptions);
procedure CloseDialog;
property DialogActive: Boolean;
property OnDialogSelect: TW3AlertSelectEvent;
[/sourcecode]
To display the dialog you could write:
[sourcecode language=”delphi”]
Application.onDialogSelect:=procedure (Sender:TObject;
aResult: TW3AlertResult)
Begin
case aResult of
roYes, roOK: begin end;
roNo, roCancel: begin end;
end;
end;
application.showdialog(‘Welcome’,’select something’,aoYesNo);
[/sourcecode]
And you get a styled dialog which also blocks any background controls from being accessed: