programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

browse for file

From: Dr. Roger Dube <rogerdube_at_dathq.com>
Date: Thu, 4 May 2006 19:08:28 -0400

Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit
We have a strange problem. The following code is used to employ a windows
file browser to select a file. execute "in-file" and a window pops up, one
browses to a file, selects it, and the address and count of the filename are
left on the stack.

Here's the mystery: in the same SwiftForth session, if we invoke "in-file"
again, and then move the mouse two or three times WITHOUT CLICKING over some
files, the window and the swiftforth sessions vanish.

Here's the code. note we have added debugger statements to trap values and
steps to a file, but we have not succeeded in determining what is going
wrong.

Does anyone see an obvious problem? Note that this behavior does not occur
on all machines. only some.

- Roger

create infile 256 allot

OPENFILENAME SUBCLASS FILENAME-DIALOG1

   256 BUFFER: FILENAME

   0 OFN_HIDEREADONLY OR

      OFN_LONGNAMES OR

   CONSTANT DEFAULT-OPEN-FLAGS

   0 OFN_HIDEREADONLY OR

      OFN_NOCHANGEDIR OR

      OFN_LONGNAMES OR

      OFN_OVERWRITEPROMPT OR

      OFN_EXTENSIONDIFFERENT OR

   CONSTANT DEFAULT-SAVE-FLAGS

   CREATE ALL-FILES

      ,Z" All files (*.*)" ,Z" *.*" 0 ,

      : DEFAULTS ( -- )

      StructSize OPENFILENAME SIZEOF ERASE

      OPENFILENAME SIZEOF StructSize !

      HINST Instance ! HWND Owner ! 1 FilterIndex !

      FILENAME zFile ! 254 MaxFile ! FILENAME OFF ;

   DEFER: CUSTOM ( -- title filter flags )

      Z" Choose a file to transmit" ALL-FILES DEFAULT-OPEN-FLAGS ;

   DEFER: ACTION ( addr -- bool ) IOR_UNRESOLVED THROW ;

   : CHOOSE ( -- bool )

      DEFAULTS CUSTOM Flags ! zFilter ! zTitle !

      StructSize ACTION ;

END-CLASS

FILENAME-DIALOG1 SUBCLASS OFN-DIALOG1

   : ACTION ( addr -- bool ) :: GetOpenFileName ;

END-CLASS

 OFN-DIALOG1 SUBCLASS EDIT-FILE-DIALOG1

   : CUSTOM ( -- title filter flags )

      Z" Select a file:" ALL-FILES ( FORTH-FILES)

      DEFAULT-OPEN-FLAGS ;

END-CLASS

: in-file ( --addr cnt )

   [objects edit-file-dialog1 makes efd objects]

 efd choose

 if

   efd filename zcount infile 256 erase infile zplace

   infile zcount

 else

  0 0

 then ;

-- Roger
 --------------------------------------------
 Dr. Roger Dube
 President and Chief Science Officer
 Digital Authentication Technologies, Inc.
 561.392.7404 (office)
 561.892.2474 (eFax)
 RogerDube_at_datHQ.com

 http://www.datHQ.com

 1900 Glades Road Suite 441
 Boca Raton, FL 33431

 ----------------------------------------------------------------------
 This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. Any views expressed in this message are those of
the individual sender, except where the sender specifically states them to
be the views of Digital Authentication Technologies, Inc.

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Thu May 04 2006 - 16:09:01 PDT

This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 03:04:21 PST