WideStudio Logo
WideStudio
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 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.

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
def btnep2(object)
  # Access to the global instance of the WSCfileSelect class.
  fs = Mwt::WSGIappFileSelect()                 #(A)
  fs.setProperty("maskFileName","rb")            #(B)
  fs.setProperty("defaultPosition",Mwt::True)   #(C)
  ret = fs.popup()                              #(D)

  # Access to the global instance of the WSCmessageDialog class.
  msg = Mwt::WSGIappMessageDialog()             #(E)
  msg.setProperty("width",500)                   #(F)
  msg.setProperty("height",120)                  #(G)
  msg.setProperty("defaultPosition",Mwt::True)  #(H)

  if ret == Mwt::WS_DIALOG_OK                   #(I)
    str = fs.getFileName() + "  is selected." 
    msg.setProperty("labelString",str) 
    msg.popup() 
  elsif ret == Mwt::WS_DIALOG_NO                #(J)
    msg.setProperty("labelString","Nothing is selected.") 
    msg.popup() 
  elsif ret == Mwt::WS_DIALOG_CANCEL            #(K)
    msg.setProperty("labelString","The selection is canceled.") 
    msg.popup() 
  end
end

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 ]

Document Release 3.80 for WideStudio ver 3.80, Jan 2005


WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2005 Last modified: Jan 05, 2005