
-----------------------------------
jwang
Thu Dec 07, 2017 2:39 pm

GUI buttons help
-----------------------------------
I'm trying to change my main menu's 3 option buttons into. GUI buttons. Here's my program code

%Declaration Section
var guess:int
var answer:int
var choice:string
var playchoice:string:="a"
var exitchoice:string:="b"
%Random Number
procedure randNum
    randint(answer,10,30)
end randNum

%Program Title
procedure title
    locate(1,25)
    put"The Guessing Game"
    put""
end title

%Goodbye Screen
procedure goodbye
    cls
    drawfillbox(0,0,maxx,maxy,yellow)
    colorback(yellow)
    title
    locate(15,1)
    colorback(yellow)
    put"Thanks for playing the guessing game!"
    put""
    put"This program was written by: "..
    put"Jerry Wang"
end goodbye

%Program pauseProgram
procedure pauseProgram
    var reply:string(1)
    put""
    put"Press any key to continue...."..
    getch(reply)
end pauseProgram

%Program Introduction
procedure introduction
    cls
    title
    randNum
    put"This program will allow you to guess a number."
    put"You have three chances to get it right."
    pauseProgram
end introduction

%User Input
procedure userInput
    cls
    title
    put""
    put"Integers only please!"
    put""
    put"Plase enter an integer between 10 and 30: "..
end userInput   

%Program error window
proc errorwindow
    var errorwin:=Window.Open("position:250;250,graphics:450;250")
    Window.Show(errorwin)
    if choice not=playchoice and choice not=exitchoice then
        put"Sorry, you must enter a or b. Please try again." 
        put"Press any key to continue "..
        loop
            exit when hasch
        end loop
    elsif guess >30 or guess  answer then
        put"the number is too high"
    elsif guess < answer then
        put"the number is too low"
    else
        put"Right on! This is the correct answer"
    end if      
end display

%
procedure 
    

%Main Program
introduction
    for decreasing x: 2..0 %For loop
    %If statements for main menu
        mainmenu
        if choice not=playchoice and choice not=exitchoice then
            loop
                errorwindow
                mainmenu
                exit when choice=exitchoice or choice=playchoice
            end loop
        end if
        exit when choice = exitchoice
    %If statements for display
        display
        if guess >30 or guess 