WideStudio Logo
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
use mpfc;

sub btnep2 {
  my ($object) = @_;
  # Access to the global instance of the WSCfileSelect class.
  $fs = mpfc::WSGIappFileSelect();                               #(A)
  $fs->setProperty("maskFileName","pl");                         #(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 = sprintf("%s is selected.", $fs->getFileName() );
  }elsif ($ret == $mpfc::WS_DIALOG_NO){                          #(J)
    $msg->setProperty("labelString","Nothing is selected.");
  }elsif ($ret == $mpfc::WS_DIALOG_CANCEL){               #(K)
    $msg->setProperty("labelString","The selection is canceled.");

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