
-----------------------------------
bvbjules13
Wed Oct 31, 2012 9:32 pm

Back button
-----------------------------------
What is it you are trying to achieve?
going back to the last procedure that is previously made, i have a start page and an instruction page, i want to go from start page to instruction page and back to start page with the instruction button still there


What is the problem you are having?
the lines of codes matter so i cant, i would have to keep copying pasting infinite lines of code






import GUI
View.Set ("graphics: 550, 400")

procedure Back
    cls
    put "PROGRAM CODE"
    var instructions : int := GUI.CreateButton (10, 10, 0, "Instructions", Instructions1)
    var start : int := GUI.CreateButton (100, 10, 0, "Start", Start1)
    loop
        exit when GUI.ProcessEvent
    end loop
end Back

procedure Instructions
    cls
    put "HOW TO PLAY THIS GAME:"
    put "\nThe point of this game is to get to the end destination, to get to\nthe end point you must enter a maze and find it on your own."
    put "You must enter either north (for going up), south (for going down),\neast (for going right), and west (for going left) when the game\nrequires you to."
    put "\nYou will have a limit of 25 moves, and a maximum of 100 HP (health\npoints), once either health, moves, or both equal zero, the game\nends."
    put "\n\nHINT: When hitting a wall or gate, advancing in that direction is\nimpossible"
    var back : int := GUI.CreateButton (10, 10, 0, "Back", Back)
end Instructions

procedure Start
    put "PROGRAM CODE"
end Start

var instructions : int := GUI.CreateButton (10, 10, 0, "Instructions", Instructions)
var start : int := GUI.CreateButton (100, 10, 0, "Start", Start)

loop
    exit when GUI.ProcessEvent
end loop




Please specify what version of Turing you are using
4.1

-----------------------------------
Tony
Wed Oct 31, 2012 9:57 pm

Re: Back button
-----------------------------------

going back to the last procedure that is previously made
When a procedure completes, the control flow automatically goes back to the previous location (from where the procedure was called). E.g.
[code]
procedure second
   put "second"
end second

procedure first
   put "first"
   second
   put "first again"
end first

first
[/code]

The second part of it all is that there is no such thing as "a page" in Turing. You have one program, with one screen, and everything lives together in this one place. Going forward might seem easy -- it's okay to just draw new stuff on top of the old stuff; but all of the GUI elements still remain. Unless you use [tdoc]GUI.Dispose[/tdoc] or [tdoc]GUI.Hide[/tdoc], you'll just end up with layers of buttons on top of each other.

-----------------------------------
bvbjules13
Wed Oct 31, 2012 11:39 pm

Re: Back button
-----------------------------------
thanks tony! that helped a lot, i think i'm understanding what u're saying

-----------------------------------
bvbjules13
Thu Nov 01, 2012 9:41 am

Re: Back button
-----------------------------------
actually tony that doe not work because both procedures rely on each other

-----------------------------------
Tony
Thu Nov 01, 2012 12:08 pm

RE:Back button
-----------------------------------
[tdoc]forward[/tdoc]
