Computer Science Canada

How to make button inside a button?

Author:  Wreathe [ Tue May 17, 2011 7:32 pm ]
Post subject:  How to make button inside a button?

I use procedure for it and i can't put another procedure inside it.

import GUI

procedure option1
cls
locate (1, 1)
Font.Draw ("What?", 1, maxy - 50, font1, black)
Font.Draw ("I'm from the Yam's Hotel.", 1, maxy - 100, font1, black)
Font.Draw ("You mean to tell me you didn't know i was coming? (y/n)", 1, maxy - 150, font1, black)

-----I want to create two more buttons here inside of this procedure but can't seem to make it work>-------
%------------------------------------------------------------------------------------------------
procedure option1a
cls
locate (1,1)
Font.Draw ("Are you playing with me... Huh huh?.. HUH?", 1,maxy-50,font1,black)
end option1a

procedure option1a
cls
locate (1,1)
Font.Draw ("Are you playing with me... Huh huh?.. HUH?", 1,maxy-50,font1,black)
end option1b

var button1 : int := GUI.CreateButton (1, maxy - 100, 5, "(a) Yes", option1a)
var button2 : int := GUI.CreateButton (1, maxy - 125, 5, "(b) No!", option1b)

%------------------------------------------------------------------------------------------------------

****This doesn't seem to work. It says summin' like "Procedure's can only be declared at the program,module, or monitor level". What do i use and how do i solve this?****




var button1 : int := GUI.CreateButton (1, maxy - 200, 5, "Yes", option1)
var button2 : int := GUI.CreateButton (60, maxy - 200, 5, "No", option1)


end option1

procedure option2
locate (1, 1)
Font.Draw ("Duude!", 1, maxy - 150, font1, black)

end option2

procedure option3
locate (1, 1)
Font.Draw ("Duude!", 1, maxy - 150, font1, black)

end option3

var button1 : int := GUI.CreateButton (1, maxy - 100, 5, "(a) What's this? Who the hell are you?", option1)
var button2 : int := GUI.CreateButton (1, maxy - 125, 5, "(b) Pardon me... I couldn't hear you!", option2)
var button3 : int := GUI.CreateButton (1, maxy - 150, 5, "(b) You broke into my house? I'm calling the cops!", option3)


loop
exit when GUI.ProcessEvent
end loop
[/b]

Author:  Raknarg [ Tue May 17, 2011 7:37 pm ]
Post subject:  RE:How to make button inside a button?

Turing doesn't let you declare procedures within procedures.

Author:  Raknarg [ Tue May 17, 2011 7:37 pm ]
Post subject:  RE:How to make button inside a button?

And it's not nesessary in most cases anyways.


: