Re: : CLICKS.F tutorial

From: Rick VanNorman <rvn_at_forth.com>
Date: Thu, 28 Jan 1999 06:19:03 -0800

>Original sender: Howard Shapiro <hms_at_shapirolab.com>

Howard,

>At line 104 in file D:\SWIFTFORTH\SRC\SAMPLES\CLICKS3.F
> CLASSNAME APPLICATION-CALLBACK DefaultClass DROP ;
> ^
>
>Am I not in the right vocabulary?

The version has bitten you! The comment noted version 1.50.3 -- in which
the new words DefineClass and DefaultClass were implemented. Here are
the definitions for the version impared.

Rick

{ --------------------------------------------------------------------
These words are provided to simplifiy the windows api for
RegisterClass. Windows requires a data structure to be build
just for the purpose of registering a class -- then the info
is discarded. These words use a temporary structure built
on the return stack, and after windows is through with the
data, the structure is automatically discarded.

DefindClass builds a WNDCLASS structure with the 10 parameters
supplied and registers the class.

DefaultClass builds a WNDCLASS structure with the user specified
values for the class name and the callback address, simple default
values for the other parameters, and registers the class.
-------------------------------------------------------------------- }

: DefineClass ( style callback xclass xwin inst icon cursor brush menu
name -- hclass )
   10 CELLS R-ALLOC 0 9 DO ( ... a )
      TUCK I CELLS + !
   -1 +LOOP RegisterClass ;

: DefaultClass ( zname callback -- hclass ) SWAP >R >R
      0 CS_HREDRAW OR \ redraw on horizontal resize/move
        CS_VREDRAW OR \ or on vertical resize/move
        CS_OWNDC OR \ each window in the class has its own
DC
      R> \ the address of the callback to use
      0 \ extra bytes for the class
      0 \ extra bytes for each window in the
class
      HINST \ instance value of the executing program
      HINST 101 LoadIcon \ handle of the icon to represent it
      NULL IDC_ARROW LoadCursor \ the default cursor
      WHITE_BRUSH GetStockObject \ the default background brush
      0 \ no menu
      R> \ class name
   DefineClass ;

.
Received on Thu Jan 28 1999 - 06:19:03 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.