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

Username:   Password: 
 RegisterRegister   
 new window help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nin




PostPosted: Fri Jan 05, 2007 5:12 pm   Post subject: new window help

i need help because i'm trying to make another window for the guessing part. The problem is that it doesnt show like the second window.
The main idea of this program is to create a separate window for the error messages.
_____________________________________________________________
code:

% Global Declaration Section
var key : string (1)
var number, randomNum : int

var try := 0
var mainWin := Window.Open ("postion:300;300,graphics:400;400")
var playBtn, quitBtn : int := 0

%Title
procedure title
    cls
    locate (1, 33)
    put "Guessing Game"
    put ""
end title

%Pause Program
procedure pauseProgram
    put " "
    put "Press any key to continue: " ..
    getch (key)
end pauseProgram

%Introduction
procedure introduction
    title
    locate (4, 1)
    put "This program will allow you to guess a number between 10 and 65."
    pauseProgram
end introduction

%New Window
proc drawWindow2
    var winID2 := Window.Open ("position : 200;200, graphics : 200;100 ")
    locate (2, 1)
    put "Please try again. Remember to put a number between 10 and 65"
    locate (6, 1)
    put "To try again, please press any key" ..
    loop
        exit when hasch
    end loop
    Window.Close (winID2)
end drawWindow2

%GoodBye
title
proc goodBye
    locate (12, 25)
    put "This program was brought to you by: "
    locate (13, 35)
    put "******** ******"
    locate (14, 39)
    put "Goodbye!"
    delay (2500)
    Window.Close (mainWin)
end goodBye


%Procedure randNum
proc randNum
    randint (randomNum, 10, 65)
end randNum

%User Input
procedure userInput
    title
    put "Please enter a number between 10 and 65: " ..
    get number
    if number < 10 or number > 65 then
        drawWindow2
        userInput
    end if
end userInput

%New Window
proc drawWindow3
    var winID3 := Window.Open ("position : 200;200, graphics : 200;100 ")
    if number < randomNum then
        put "Too low! Please try again."
        put "Try number:", try

    else
        put "Your guess is too high! Please try again."
    end if

    if try = 3 then
        locate (6, 1)
        put "The random number chosen was: ", randomNum
    end if

    locate (6, 1)
    put "To try again, please press any key" ..
    loop
        exit when hasch
    end loop
    Window.Close (winID3)
end drawWindow3

%Display
proc display
    title
    try := try + 1
    if number = randomNum then
        locate (3, 1)
        put "Good Job!"
        put "Try number: ", try
    end if
    pauseProgram
end display

%Main Program
introduction
randNum
loop
    userInput
    display
    exit when number = randomNum or try = 3
end loop
goodBye

%End of Program
[/code]
Sponsor
Sponsor
Sponsor
sponsor
Ultrahex




PostPosted: Fri Jan 05, 2007 5:22 pm   Post subject: (No subject)

Maybe This Program Will Help You Understand How To Do What You Want...

code:

var winID1 := Window.Open ("position:top;0,graphics:200;200")
var winID2 := Window.Open ("position:top;212,graphics:200;200")
var winID3 := Window.Open ("position:top;424,graphics:200;200")
put : winID1, "Window 1"
put : winID2, "Window 2"
put : winID3, "Window 3"
nin




PostPosted: Mon Jan 08, 2007 8:12 pm   Post subject: (No subject)

tnx you =)
Clayton




PostPosted: Mon Jan 08, 2007 8:22 pm   Post subject: Re: new window help

there is also a good tutorial in the Turing Walkthrough about the Window. module, perhaps you should check that out as well. Normally, when in doubt about something in Turing, head to the Turing Walkthrough.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: