Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-File' ** Window demonstration ' WIND_SMP.GFA ' DEFFILL 1,2,4 PBOX 0,19,639,399 DEFFILL 1,0 ' DIM message_buffer&(7) ! 16 Bytes adr_mes%=V:message_buffer&(0) ' ABSOLUTE word0&,adr_mes% ABSOLUTE x&,adr_mes%+8 ABSOLUTE y&,adr_mes%+10 ABSOLUTE w&,adr_mes%+12 ABSOLUTE h&,adr_mes%+14 ' handle&=WIND_CREATE(&X101111,0,19,639,380) ' title$="Window"+CHR$(0) adr_title%=V:title$ ~WIND_SET(handle&,2,CARD(SWAP(adr_title%)),CARD(adr_title%),0,0) ~WIND_OPEN(handle&,100,100,200,100) ~WIND_GET(handle&,4,wx&,wy&,ww&,wh&) PBOX wx&,wy&,wx&+ww&,wy&+wh& ' finish!=FALSE REPEAT ~EVNT_MULTI(&X110000,0,0,0,0,0,0,0,0,0,0,0,0,0,adr_mes%,100,d%,d%,d%,d%,d%,d%) SELECT word0& ' Depending on word0&, one of the following cases is dealt with: CASE 22 ! WM_CLOSED - closed finish!=TRUE CASE 23 ! WM_FULLED - full size ~WIND_SET(handle&,5,1,19,638,380) ~WIND_GET(handle&,4,wx&,wy&,ww&,wh&) PBOX wx&,wy&,wx&+ww&,wy&+wh& word0&=0 CASE 27,28 ! WM_SIZED, WM_MOVED - re-sized or moved IF w&<100 w&=100 ENDIF IF h&<80 h&=80 ENDIF ~WIND_SET(handle&,5,x&,y&,w&,h&) ~WIND_GET(handle&,4,wx&,wy&,ww&,wh&) PBOX wx&,wy&,wx&+ww&,wy&+wh& word0&=0 ENDSELECT UNTIL finish! ~WIND_CLOSE(handle&) ~WIND_DELETE(handle&) --> First a Message Buffer is allocated, as in the example program MENU_SMP.GFA, and some words within it are given variable names. Then the window is created and its handle number determined with WIND_CREATE(), and a title is assigned to it with WIND_SET(). After opening the window with WIND_OPEN() the coordinates of the work area of the window are found with WIND_GET(), and the whole area is covered with a white rectangle. In the REPEAT-UNTIL loop, control of the window elements is supervised by EVNT_MULTI(). Different events (signalled by word0&, the first word in the message buffer) are dealt with by the associated CASE selection. If the 'Close Window' symbol is clicked, the loop terminates and so does the program, after closing the window and deleting it from memory.