![]() | 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 #---------------------------------------------------------- import mpfc def btnep2(object): # Access to the global instance of the WSCfileSelect class. fs = mpfc.WSGIappFileSelect(); #(A) fs.setProperty("maskFileName","py"); #(B) fs.setProperty("defaultPosition",mpfc.True); #(C) ret = fs.popup(); #(D) # Access to the global instance of the WSCmessageDialog class. msg = mpfc.WSGIappMessageDialog(); #(E) msg.setProperty("width",500); #(F) msg.setProperty("height",120); #(G) msg.setProperty("defaultPosition",mpfc.True); #(H) if (ret == mpfc.WS_DIALOG_OK): #(I) str = fs.getFileName() + " is selected."; msg.setProperty("labelString",str); msg.popup(); elif (ret == mpfc.WS_DIALOG_NO): #(J) msg.setProperty("labelString","Nothing is selected."); msg.popup(); elif (ret == mpfc.WS_DIALOG_CANCEL): #(K) msg.setProperty("labelString","he selection is canceled."); msg.popup(); return mpfc.WSGFfunctionRegister("btnep2",btnep2)A 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 |