Beispiel-Listing: Kreisdemo

Zur Realisierung des Kreisdemo-Programmes, mssen nur in lediglich drei Userroutinen eintragungen
vorgenommen werden. So sahen die Prozeduren aus, wie faceVALUE sie erzeugte: 

PROCEDURE user_on_open 

' 

' This procedure is called when the program is run, after the RSC is 

' loaded and just before the main loop. You can open program windows, 

' toolboxes etc. here, or init things for your program like 

' loading an *.INF or .DAT file. 

' 

' If run as an accessory, this procedure is called EVERY TIME 

' THE ACCESSORY IS OPENED. If you need to do anything just ONCE, 

' like disable menu-entries spesific to PROGRAM execution, set a global 

' flag here to avoid doing things EVERY time the accessory is opened. 

' 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - Wrinkle code: (don't change or delete this flag) 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - End of Wrinkle code: (don't change or delete this flag) 

' 

RETURN 

PROCEDURE user_window_content(index&,userhandle&,off_x%,off_y%,cx&,cy&,cw&,ch&) 

~GRAF_MOUSE(256,0) !hidem - to avoid "mousedroppings" 

' 

' This procedure is called when a user window needs to be redrawn. 

' ALL of the window content should be drawn here. The x & y offsets 

' will be automatically updated by the system and are ALWAYS current. 

' DO NOT alter the clipping rectangle, it is set (walking the 

' rectangle list) BEFORE calling this procedure. 

' 

' All your coordinates should be relative to the upper left of 

' the work area of the window, except for blitting wich is relative 

' to the upper left of the screen. If the window is scrollable/has sliders, 

' subtract <off_x&> from ALL x-coordinates and <off_y&> from ALL 

' y-coordinates. 

' 

' <index&> is the index of this window in window_array&(index&,x) 

' <userhandle&> is the userhandle you gave when opening the window 

' <off_x%> is the x offset of the window contents 

' <off_y%> is the y offset of the window contents 

' <cx&>,<cy&>,<cw&>,<ch&> is the clipping rectangle set 

' 

' 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - Wrinkle code: (don't change or delete this flag) 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - End of Wrinkle code: (don't change or delete this flag) 

' 

~GRAF_MOUSE(257,0) !showm - display pointer again 

RETURN 

PROCEDURE user_rsc_interact(index&,tree&,object&,mc&,sub_me&) 

' 

' <index&> is the index of this window in window_array&(index&,x) 

' If the object tree is the normal menu bar, <index&>=-1 

' <tree&> is the object tree number 

' <object&> is the object that was selected (clicked on OR shortcut) 

' <mc&> is the number of clicks (1=normal/2=double clicked/1 if shortcut) 

' <sub_me&> is the chosen menuitem in a popup menu 

' 

SELECT tree& 

' 

' ------------------------------------------------------------------------ 

' 

CASE mainmenu& 

SELECT object& 

CASE mm_about& 

CASE pix50& 

CASE pix75& 

CASE pix100& 

CASE mm_quit& 

exit_program!=TRUE 

ENDSELECT 

' 

' ------------------------------------------------------------------------ 

' 

' 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - Wrinkle code: (don't change or delete this flag) 

' [U+2126][U+2126]wsnippet[U+2126][U+2126] - End of Wrinkle code: (don't change or delete this flag) 

' 

ENDSELECT 

RETURN 

So wurden die Routinen dann abgendert, um die komplette Kreisdemo aufleben zu lassen: 

PROCEDURE user_on_open 

' 

' Beim Programmstart sofort das Fenster ffnen: 

' 

LOCAL handle& 

LET handle&=@win_open(" Kreise ","",simple_window%,backgrnd&,800,800,16,16,7,20,20,400,300,-1) 

LET kreisfenster&=@win_get_index(handle&) 

' 

RETURN 

PROCEDURE user_window_content(index&,userhandle&,off_x%,off_y%,cx&,cy&,cw&,ch&) 

' 

' Fensterinhalt Zeichnen: 

' 

LOCAL dr& 

~GRAF_MOUSE(256,0) 

SELECT userhandle& 

CASE 7 ! fr das Kreisfenster 

SELECT pix50_var& 

CASE 1 

dr&=50 

CASE 2 

dr&=75 

CASE 3 

dr&=100 

ENDSELECT 

FOR r&=20 TO 1000 STEP dr& 

CIRCLE 320-off_x%,200-off_y%,r& 

NEXT r& 

BOX 1-off_x%,1-off_y%,798-off_x%,798-off_y% 

TEXT 50-off_x%,50-off_y%," Die uere Box zeigt die Fenstergre bzgl. der Scrollbalken (800x800) " 

TEXT 50-off_x%,70-off_y%," Hinweis: bei manchen VDI-Versionen knnen Lcher in den Kreisen entstehen." 

TEXT 50-off_x%,86-off_y%," Das ist ein Fehler des jeweiligen VDIs" 

ENDSELECT 

~GRAF_MOUSE(257,0) 

' 

RETURN 

PROCEDURE user_rsc_interact(index&,tree&,object&,mc&,sub_me&) 

' 

' Auf Meneintrge reagieren: 

' 

SELECT tree& 

CASE mainmenu& 

SELECT object& 

CASE mm_about& 

CASE pix50& 

' Fensterinhalt neu zeichnen: 

@win_send_redraw(kreisfenster&,-1,-1,-1,-1) 

CASE pix75& 

@win_send_redraw(kreisfenster&,-1,-1,-1,-1) 

CASE pix100& 

@win_send_redraw(kreisfenster&,-1,-1,-1,-1) 

CASE mm_quit& 

exit_program!=TRUE 

ENDSELECT 

ENDSELECT 

' 

RETURN 