Message dialogs

Top  Previous  Next

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 we have almost the same thing, except here showmessage is called w3_showmessage(). This function can be found in w3system and simply calls the browser’s built in alert() javascript function.

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:

 

procedure ShowDialog(aCaption:String;aText: String; aOptions: TW3AlertOptions);
procedure CloseDialog;
property DialogActive: Boolean;
property OnDialogSelect: TW3AlertSelectEvent;

 

To display the dialog you could write:

 

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);
 

And you get a styled dialog which also blocks any background controls from being accessed:

hm_clip0008

iOS themed alert dialog