home *** CD-ROM | disk | FTP | other *** search
- {fon:tri}
- As an example for my Wimp idea, first here's a bit of wimp code.
- Actually there's a couple of deliberate mistakes in it, but it's so
- cryptic that the mistakes are not immediately obvious.
-
- $b%="TASK"
- SYS"Wimp_Initialise", 200, !b%, Name$
- REM == load the templates ==
- SYS"Wimp_OpenTemplate",,Dir$+".Templates"
- SYS"Wimp_LoadTemplate",,b%,ptr%,Q%+1000,-1,"info"TO,,ptr%
- SYS"Wimp_CreateWindow",,b% TO Info%
- SYS"Wimp_LoadTemplate",,b%,ptr%,Q%+1000,-1,"control"TO,,ptr%
- SYS"Wimp_CreateWindow",,b% TO Control%
- SYS"Wimp_CloseTemplate"
- REM == Find the iconbar icon ==
- DIM isp% 12
- !b%=-1
- b%!4=0:b%!12=80:b%!8=0:b%!16=80
- b%!20=&3102:$isp%="!"+Name$
- b%!24=isp%:b%!28=1:b%!32=LEN$isp%+1
- SYS"Wimp_CreateIcon", , b% TO ih%
- REPEAT
- SYS"Wimp_Poll", 49, b% TO act%
- CASE act% OF
- WHEN 2:SYS"Wimp_OpenWindow",,b%
- WHEN 3:SYS"Wimp_CloseWindow",,b%
- WHEN 6:PROCButton
- ENDCASE
- UNTIL Quit%
- SYS"Wimp_CloseDown"
- END
- DEFPROCButton
- CASE b%!12 OF
- WHEN Info%
- PROCopenall
- WHEN Control%
- CASE b%!16 OF
- WHEN 1:PROCthis
- WHEN 2:PROCthat
- WHEN 3:PROCother
- ENDCASE
- ENDCASE
- ENDPROC
-
-
- This is what the same thing would look like if there was direct
- support for the Wimp from BASIC. All the standard stuff virtually
- disappears. The procedures that do the work look much the same except
- that the cryptic "b%!12" and "b%!16" have been replaced by meaningful
- variable names.
-
- APPLICATION("MyProg$Dir","MyProg")
- ICONBAR("!MyProg")
- WHENEVER MOUSE_CLICK window$,icon%,button%:PROCbutton
- WIMP_POLL
- END
- DEFPROCbutton
- CASE window$ OF
- WHEN "Info"
- PROCopenall
- WHEN "Control"
- CASE icon% OF
- WHEN 1:PROCthis
- WHEN 2:PROCthat
- WHEN 3:PROCother
- ENDCASE
- ENDCASE
- ENDPROC
-
- I can't that imagine any of this would be very difficult to add to
- the BASIC interpreter. With something like this, it would be possible
- for someone with a little bit of BASIC experience to write simple,
- readable, multitasking programs.
-
- {spr:l03}
- {end}
-