![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I have been reading Petzold a bit and converted a
sample program from C++ to SF. Here is a snipit from
my code.
PAINTSTRUCT BUILDS PS
TEXTMETRIC BUILDS TM
0 VALUE 'TM
TM DUP TO 'TM AveCharWidth DROP
0 VALUE 'PS
PS DUP TO 'PS DC DROP ( what's the tidy way to do
this? )
: STARTING
hwnd GetDC
DUP 'TM GetTextMetrics DROP
TM AveCharWidth @ CXCHAR !
It works. The funny thing is that when you use the
instance of the class, it changes the search context
and puts the address of the instance on the stack and
also expects to find the name of a member which
consumes the instance from the stack. Fair enough but
I can't just use the instance by himself in order to
pass him to a Windows function because SF is still
looking for a member. So I give the address to a
VALUE. I use an arbitrary member and then DROP it
because all I was using it for was to tell SF to stop
looking for a member. I find that If I don't do this
then I can't use a Windows function. SF acts like it
isn't in the dictionary.
INCLUDE C: ForthInc SwiftForth User sysmets Sysmets1.f
GetDC ? hwnd GetDC
At line 76 in C: ForthInc SwiftForth User sysmets
Sysmets1.f
Question. Isn't there a more tidy way to do this? I
didn't catch it in the documentation or in any of the
source code files.
Thanks!
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.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 Jan 31 2005 - 14:59:44 PST
This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 03:04:24 PST