![]() | Programming Guide | WideStudio Index Table of contents |
The file selection dialog
Indication of the file selection dialog
To get the instance of the file selection dialog, call the global function: WSGIappFileSelect(). and call the dialog method: popup() to indicate it.The method popup() returns the result of the dialog status when the selection is done. And get the selected file name by the getFileName() method.
[The file selection dialog](*----------------------------------------------------------*) (*Function for the event procedure *) (*----------------------------------------------------------*) open Swig open Mpfc open Mpfclib let btnep2 obj = (* do something...*) let fs = _WSGIappFileSelect '() in (* A *) fs->setProperty("maskFileName","ml"); (* B *) fs->setProperty("defaultPosition",_True); (* C *) let ret = fs->popup() in (* D *) let msg = _WSGIappMessageDialog '() in (* E *) msg->setProperty("width",500); (* F *) msg->setProperty("height",120); (* G *) msg->setProperty("defaultPosition",_True); (* H *) if get_int ret = get_int _WS_DIALOG_OK then begin (* I *) let str = get_string(fs->getFileName()) ^ " is selected." in ignore(msg->setProperty("labelString",(make_string(str)))); ignore(msg->popup()); end else if get_int ret = get_int _WS_DIALOG_NO then begin (* J *) ignore(msg->setProperty("labelString","Nothing is selected.")); ignore(msg->popup()); end else if get_int ret = get_int _WS_DIALOG_CANCEL then begin (* K *) ignore(msg->setProperty("labelString","The selection is canceled.")); ignore(msg->popup()); end; () let _ = Callback.register "btnep2" btnep2A global instance of WSCfileSelect class is already prepared, and it is possible to access by the global function WSGIappFileSelect() at (A). Set the property of it at (B),(C), and indicate it by the popup() method at (D), and then the popup() method returns that selection is done.
To see the result the file selection dialog,try to indicates the result by the message dialog. At (E),(F),(G),(H),get the global instance of the message dialog and set its property up. At (I),indicate the selected file name. At (J),indicate [Nothing is selected]. At (K),indicate [The selection is canceled ]
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |