Computer Science Canada button help |
Author: | rikku007 [ Fri May 04, 2007 8:00 am ] |
Post subject: | button help |
hi, i have a bit of problem with the buttons. When i change the colour of the happy face, the buttons will not press down since the GUI.ProcessEvent doesnt process, is there any way to get around it yet keep the animation of the smiley? % The "PennyGame" program. import GUI procedure DoNothing end DoNothing View.Set ("graphics:800;600,nobuttonbar") locate (2,50) put "THE PENNY GAME!" var draw : int := GUI.CreateButtonFull (20, 350, 200, "Introduction Animation", DoNothing, 0, '^D', true) var draw1 : int := GUI.CreateButtonFull (20, 300, 200, "Tutorial Animation", DoNothing, 0, '^D', true) var draw2 : int := GUI.CreateButtonFull (20, 250, 200, "Lessons", DoNothing, 0, '^D', true) var draw3 : int := GUI.CreateButtonFull (20, 200, 200, "Questions/Results", DoNothing, 0, '^D', true) var draw4 : int := GUI.CreateButtonFull (20, 150, 200, "Vs. Mode", DoNothing, 0, '^D', true) var draw5 : int := GUI.CreateButtonFull (20, 100, 200, "Exit", DoNothing, 0, '^D', true) randomize loop var col1, col2:int randint (col1,1,255) randint (col2,1,255) Draw.FillOval (500,300,200,200,col1) Draw.FillOval (450,360,20,40,col2) Draw.FillOval (550,360,20,40,col2) Draw.Arc (500,240,120,40,180,360,col2) delay(1000) end loop loop exit when GUI.ProcessEvent end loop |
Author: | Carey [ Fri May 04, 2007 8:38 am ] | ||
Post subject: | Re: button help | ||
Your problem is that your program never actually gets to the 'exit when GUI.ProcessEvent' loop, it only draws the smilies. I hate to use processes because of reasons much dicussed elsewhere, but i think this is one of the times that it's ok because you dont really need it to be accurate and predictable, you just need it to draw a few ovals and such.
That should work for you. Also next time use code or syntax tags (when posting click the 'more tags' link and click the 'code' or 'syntax' button |