Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Back button
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bvbjules13




PostPosted: Wed Oct 31, 2012 9:32 pm   Post subject: 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




Turing:


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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Oct 31, 2012 9:57 pm   Post subject: Re: Back button

bvbjules13 @ Wed Oct 31, 2012 9:32 pm wrote:

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


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 GUI.Dispose or GUI.Hide, you'll just end up with layers of buttons on top of each other.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
bvbjules13




PostPosted: Wed Oct 31, 2012 11:39 pm   Post subject: Re: Back button

thanks tony! that helped a lot, i think i'm understanding what u're saying
bvbjules13




PostPosted: Thu Nov 01, 2012 9:41 am   Post subject: Re: Back button

actually tony that doe not work because both procedures rely on each other
Tony




PostPosted: Thu Nov 01, 2012 12:08 pm   Post subject: RE:Back button

forward
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: