Thread View: comp.lang.forth.mac
1 messages
1 total messages
Started by sorry no email address Peters Ra...
Mon, 21 Dec 1992 15:39
multi windows, pocket forth
Author: sorry no email address Peters Ra...
Date: Mon, 21 Dec 1992 15:39
Date: Mon, 21 Dec 1992 15:39
54 lines
2229 bytes
2229 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads