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

Re: simplest swoop windows application

From: Azedia of DOLFINA <dolfina_at_dolfina.org>
Date: Wed, 17 Apr 2002 12:30:25 -0700

I get an error on permission for this link.

Jodell

>
> Dear Constant Reader,
>
> Below, separated by very ugly headers of lots of asterisks, please
> find three files for your consideration. The files, if extracted
> into a single directory, constitute the simplest Windows application
> built from the Swoop framework classes. My intention in presenting
> this is to give the most basic foundation to start building an edifice
> with.
>
> Later installments will embellish on this modest starting point.
>
> The files are also available for your download from
>
> ftp.forth.com/pub/SwiftForth/examples/one
>
> Please let me know of any problems found, etc.
>
> Thanks,
> Rick
>
>
> **********************************************************************
> **********************************************************************
> **********************************************************************
> main.f
> **********************************************************************
> **********************************************************************
> **********************************************************************
>
> { ====================================================================
> Window skeletons to hang applications on
>
> Copyright (C) 2002 FORTH, Inc. <br> Rick VanNorman rvn_at_forth.com
>
> This file implements the simplest complete Windows application written
> in SwiftForth utilizing the Swoop class framework. The window itself
> does nothing. Literally, nothing.
> ==================================================================== }
>
> \ We factor our application into multiple files to separate the
> \ logical functions. Not so important now, but very important
> \ for later.
>
> INCLUDE APPWIN \ the main window application
> INCLUDE STARTUP \ startup code
>
> .(
>
> Type "GO" to run the application from SwiftForth.
> Type "PROGRAM filename" to save the application as an executable file.
>
> )
>
> **********************************************************************
> **********************************************************************
> **********************************************************************
> appwin.f
> **********************************************************************
> **********************************************************************
> **********************************************************************
>
> { ====================================================================
> appwin.f
>
> Copyright (C) 2002 FORTH, Inc. <br> Rick VanNorman rvn_at_forth.com
> ==================================================================== }
>
> { --------------------------------------------------------------------
> APPWIN is the main application window. It is built from the base class
> GENERICWINDOW with a few appropriate over-rides specified. Note that
> MyClass_ClassName and MyWindow_WindowName _must_ be specified in any
> user-defined class -- leaving these as defaults will work in this simple
> example but will bite you hard in the butt later.
> -------------------------------------------------------------------- }
>
> GENERICWINDOW SUBCLASS AppWindow
>
> \ Over-ride base defaults
>
> : MyClass_ClassName ( -- zname ) Z" Skeleton" ;
> : MyWindow_WindowName Z" Skeleton" ;
>
> : MyWindow_Shape ( -- x y cx cy ) 10 10 600 350 ;
>
> : MyClass_hbrBackground ( -- hbrush )
> GRAY_BRUSH :: GetStockObject ;
>
> : OnClose ( -- res )
> mHWND :: DestroyWindow 0 ;
>
> END-CLASS
>
>
> **********************************************************************
> **********************************************************************
> **********************************************************************
> startup.f
> **********************************************************************
> **********************************************************************
> **********************************************************************
>
> { ====================================================================
> startup.f
>
> Copyright (C) 2002 FORTH, Inc. <br> Rick VanNorman rvn_at_forth.com
> ==================================================================== }
>
> { ----------------------------------------------------------------------
> Build a static instance of the application class for debugging purposes.
> This can be omitted in a production version, but will be harmless.
> ---------------------------------------------------------------------- }
>
> AppWindow BUILDS APP
>
> : GO ( -- ) APP CONSTRUCT ;
>
> { ----------------------------------------------------------------------
> MAIN is the entry point for all stand-alone Windows applications.
> Setting 'MAIN to zero will trigger the OnDestroy method to execute
> PostQuitMessage (see the source for GENERICWINDOW) and terminate the
> DISPATCHER loop. Under normal circumstances, 'MAIN is non-zero and
> the OnDestroy method will not call PostQuitMessage.
>
> The instantiation of the object APP in the [OBJECTS .. OBJECTS] phrase
> acutally triggers its construction and causes the window to be
> created. DISPATCHER handles all windows messages directed to it until
> PostQuitMessage, then ExitProcess terminates the whole shebang. Simple,
> huh?
> ---------------------------------------------------------------------- }
>
> : MAIN ( -- ) 0 'MAIN !
> [OBJECTS AppWindow MAKES APP OBJECTS]
> DISPATCHER 0 ExitProcess ;
>
> ' MAIN 'MAIN !
>
>
>
> ----------------------------------------------------------------------
> sftalk_at_forth.com The SwiftForth programming discussion email list
> To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/sftalk -- check them out!
> Search the archives! Visit http://www.forth.com/search for details.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
----------------------------------------------------------------------
sftalk_at_forth.com      The SwiftForth programming discussion email list
To unsubscribe,  send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives!    Visit http://www.forth.com/search for details.
Received on Wed Apr 17 2002 - 12:32:00 PDT

This archive was generated by hypermail 2.2.0 : Fri Nov 21 2008 - 03:04:22 PST