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

Re: FILENAME for open file

From: Mike Ghan <MikeGhan_at_logix-controls.com>
Date: Mon, 13 Jun 2005 13:36:58 -0700

In TRY, the line=20
   [OBJECTS MFDclass MAKES MFD OBJECTS]
is creating a *temporary* instance of the object MY-OFN-DIALOG which is
valid only inside TRY. The filename buffer is part of the object. You
can either double buffer it as with ZCOUNT PAD ZPLACE or change MFD to a
static object:

MFDclass BUILDS MFD

: TRY ( -- zstr|0 )
   MFD CHOOSE
   IF MFD FILENAME ( zStr )
   THEN 0 ( canceled ) ;

Or you could pass a buffer address to TRY.

Hope this helps,
Mike

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf
Of Anil Rodrigues
Sent: Monday, June 13, 2005 12:41 PM
To: sftalk_at_forth.com
Subject: [sftalk] FILENAME for open file

Can someone explain what I am missing as described below ? ( Mike ?)

Following is a stripped down section to get a filename for opening the
file. It works fine, using try pad zcount r/o open-file

However if I remove the "pad zcount zplace" from "try"
and let FILENAME leave the addr on the stack , it does not work.

Alternately; as is, " try pad zcount type " types the name correctly,
but with "pad...." removed, " try zcount type" prints junk.

The code follows:
Thanks, Anil

PACKAGE OFN-DIALOGS ( Re-open Package )

FILENAME-DIALOG SUBCLASS MY-OFN-DIALOG

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

END-CLASS

PUBLIC
MY-OFN-DIALOG SUBCLASS MFDclass

END-CLASS
END-PACKAGE

: TRY ( -- )
   [OBJECTS MFDclass MAKES MFD OBJECTS]
   MFD CHOOSE
   IF MFD FILENAME ( zStr ) zcount pad zplace
                             \ ^ remove these words
   THEN ;
----------------------------------------------------------------------
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
----------------------------------------------------------------------

----------------------------------------------------------------------
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 Mon Jun 13 2005 - 13:32:52 PDT

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