WideStudio/MWT Logo
WideStudio/MWT
Programming Guide
WideStudio/MWT 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 file selection dialog]

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.

#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 WSCfileSelect 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.90 for WideStudio/MWT ver 3.90, Jul 2005


WideStudio/MWT documents index | Table of contents

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: Jul 31, 2005