home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!netnews.upenn.edu!meded6.med.upenn.edu!user
- From: sorry no email address (Peters, Randolph)
- Newsgroups: comp.lang.forth.mac
- Subject: multi windows, pocket forth
- Message-ID: <sorry?no?email?address-211292102652@meded6.med.upenn.edu>
- Date: 21 Dec 92 15:39:34 GMT
- Sender: news@netnews.upenn.edu
- Followup-To: comp.lang.forth.mac
- Organization: Hospital of the University of Pennsylvania
- Lines: 54
- Nntp-Posting-Host: meded6.med.upenn.edu
-
-
- In regards to multiple windows in pocket forth, I figured out the answer to
- the question I asked last week; since there seem to be a few pocket
- forthers
- out there, I thought this post might be of general interest.
-
- ( general use window words )
- : select ( windowptr -- ) 2>r ,$ a91f ; ( _SelectWindow )
- : set ( windowptr -- ) 2>r ,$ a873 ; ( _SetPort )
- : show ( windowptr -- ) 2>r ,$ a915 ; ( _ShowWindow )
- : >front ( windowptr -- ) 2dup select set ;
-
- : nuw
- 0 0 2>r 128 >r 0 0 2>r -1 s>d 2>r
- ( rstack: 0L resid 0L -1L )
- ,$ a9bd ( _GetNewWindow )
- ( rstack: windowptr )
- 2r> 2dup show 2dup >front ;
-
- 0 +md 2@ 2constant w1 ( forth window )
- nuw 2constant w2 ( test window )
-
- : d= ( double1 double2 -- bool )
- rot = rot rot = and ;
-
- : hello ." Hello" cr ;
- : goodbye ." Goodbye" cr ;
-
- : evtwindow ( -- windowptr ) 150 +md 2@ ;
-
- : myact ( bool -- )
- if ( becoming active )
- evtwindow w2 d= if w2 >front hello then
- else ( becoming inactive )
- evtwindow w2 d= if goodbye w1 >front then
- then ;
-
- page
-
- ' myact 12 +md ! ( install new activate event handler )
-
-
- Please note that if you want to install event-loop code in the activate
- handler, then put it where "hello" goes above; it should be in the form
- of a loop that exits when a deactivation event is posted (so you could
- also set a flag or something during activation and deactivation, which
- will be tested inside the loop). This way, when your window is activated,
- the associated code will be invoked.
-
-
- Randolph M. Peters
- 3rd Floor Silverstein Suite C
- Hosp of the Univ of Pennsylvania
- Philadelphia PA 19104
-