![]() |
The file selection dialogIndication of the file selection dialogTo get the instance of the file selection dialog, call the global function: WSGIappFileSelection(). and call the dialog method: popup() to indicate it.![]() [The file selection dialog] The method popup returns the result of the diaolog status when the selection is done. And get the selected file name by the getFileName() method. #include <WScom.h> #include <WSCfunctionList.h> #include <WSCbase.h> #include <WSCfileSelect.h> //(A) #include <WSCmessageDialog.h> //(B) //---------------------------------------------------------- //Function for the event procedure //---------------------------------------------------------- void btnep2(WSCbase* object){ //Access to the global instance of the WSCfileSelection class. WSCfileSelect* fs = WSGIappFileSelect(); //(C) fs->setProperty(WSNmaskFileName,"cpp"); //(D) fs->setProperty(WSNdefaultPosition,True); //(E) long ret = fs->popup(); //(F) //Access to the global instance of the WSCmessageDialog class. WSCmessageDialog* msg = WSGIappMessageDialog(); //(G) msg->setProperty(WSNwidth,500); //(H) msg->setProperty(WSNheight,120); //(I) msg->setProperty(WSNdefaultPosition,True); //(J) if (ret == WS_DIALOG_OK){ //(K) WSCstring str; str << fs->getFileName() << " is selected."; msg->setProperty(WSNlabelString,str); msg->popup(); }else if (ret == WS_DIALOG_NO){ //(L) msg->setProperty(WSNlabelString,"Nothing is selected."); msg->popup(); }else if (ret == WS_DIALOG_CANCEL){ msg->setProperty(WSNlabelString,"The selection is canceled."); msg->popup(); //(M) } }At first, include the header,WSCfileSelect.h, access to them. A global instance of WSCfileSelect class is already prepared, and it is possible to access by the global function WSGIappFileSelect() at (C). Set the property of it at (D),(E), and indicate it by the popup() method at (F), 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 (G),(H),(I),(J),get the global instance of the message dialog and set its property up. At (K),indicate the selected file name. At (L),indicate [Nothing is selected]. At (M),indicate [The selection is canceled ] Document Release 3.0 For Use with Wide Studio Release 3.0, Summer 2002
|