'The Lines program - displays random lines forever 'For IWBasic 1.55 or greater - Compile as a Windows target autodefine "off" WINDOW win INT l,t,w,h,size,x 'open a window and add a menu OPENWINDOW win,0,0,400,300,@SIZE|@MINBOX|@MAXBOX|@CAPTION,0,"Lines",&mainwindow BEGINMENU win MENUTITLE "Options" MENUITEM "Clear",0,1 BEGINPOPUP "Line Size" MENUITEM "1",0,2 MENUITEM "2",0,3 MENUITEM "3",0,4 ENDPOPUP MENUITEM "Quit",0,5 ENDMENU 'get the client size of the menu so we know how long the lines can be GETCLIENTSIZE win,l,t,w,h size = 1 'draw the lines every 10 millesceonds STARTTIMER win,10 'process messages until somebody closes us waituntil IsWindowClosed(win) STOPTIMER win end 'this is the handler subroutine for the WINDOW SUB mainwindow(),INT SELECT @MESSAGE CASE @IDCREATE 'center our window on creation CENTERWINDOW win CASE @IDSIZE 'someone sized the window so get the client size again GETCLIENTSIZE win,l,t,w,h CASE @IDCLOSEWINDOW 'close the window CLOSEWINDOW win CASE @IDTIMER 'draw 10 random lines every 10 milliseconds for x = 1 to 10 LINE win,RND(w),RND(h),RND(w),RND(h),RGB(RND(255),RND(255),RND(255)) next x CASE @IDMENUPICK SELECT @MENUNUM CASE 1 RECT win,0,0,w,h,RGB(255,255,255),RGB(255,255,255) CASE 2 CASE& 3 CASE& 4 SETLINESTYLE win,@LSSOLID,@MENUNUM - 1 size = @MENUNUM - 1 CASE 5 CLOSEWINDOW win ENDSELECT CASE @IDMENUINIT CHECKMENUITEM win,2,size = 1 CHECKMENUITEM win,3,size = 2 CHECKMENUITEM win,4,size = 3 ENDSELECT RETURN 0 ENDSUB