Computer Science Canada

Menu Won't Work In Loop

Author:  Siavash [ Mon Apr 06, 2009 9:22 pm ]
Post subject:  Menu Won't Work In Loop

Turing:
import GUI

View.Set ("graphics:250;150,nobuttonbar,offscreenonly")
var first : int       % The menus.
var item : int % The menu items.
var m, p : int := 1

var name : string (20) := "Quit"

% Create the menus
first := GUI.CreateMenu ("First")
item := GUI.CreateMenuItem (name, GUI.Quit)

loop
    if p = maxx then
        m := -m
    end if
    if p < 0 then
        m := -m
    end if
    p := p + m
    drawfillbox (p, 100, p + 10, 110, black)
    exit when GUI.ProcessEvent
    View.Update
    cls
end loop 


if i put :first := GUI.CreateMenu ("First") and item := GUI.CreateMenuItem (name, GUI.Quit) in the loop, it creates new menu each time and if i dont (like example), it goes away and i cant make a menu. any solutions or ideas?

Author:  Dusk Eagle [ Tue Apr 07, 2009 11:35 pm ]
Post subject:  Re: Menu Won't Work In Loop

Why did you create a new thread for this when you have this one? You may end up making two people work on the same problem, which wastes one person's time.

Author:  Siavash [ Wed Apr 08, 2009 4:30 pm ]
Post subject:  RE:Menu Won\'t Work In Loop

I noticed that I am not allowed to use "Help" in my title so i reposted then i dont know how to delete post.

Author:  RYAN191 [ Thu Apr 09, 2009 5:32 pm ]
Post subject:  RE:Menu Won\'t Work In Loop

before the loop put cls


: