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

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




PostPosted: Tue Jun 09, 2009 12:44 pm   Post subject: highscore problem

there is my code below. when i run it,it works fine but once i click on the "ENTER" buttton it opens another window which i don`t want it to do
[/quote]
var firstwin : int

firstwin := Window.Open ("position:top;center,graphics:700;700")
var font1 : int
font1 := Font.New ("mono:18")
var nameTextField, addressTextField : int
var font : int
var done1 : boolean := false
var ch1 : string (1)
var name : string := ""
var value : int := 65
var x, y, z : int := 0
font := Font.New ("times:36:bold")
Font.Draw (chr (value), 300, 300, font, blue)
var rank : array 1 .. 10 of int
function ptinrect (h, v, x1, v1, x2, v2 : int) : boolean
result (h > x1) and (h < x2) and (v > v1) and (v < v2)
end ptinrect

process nameo
loop
getch (ch1)
if ord (ch1) = 203 and value > 65 then
value := value - 1
elsif ord (ch1) = 205 and value < 90 then
value := value + 1
elsif ord (ch1) = 32 then
name := name + chr (value)
Font.Draw (name, 200, 200, font, blue)
end if
drawfillbox (290, 290, 350, 350, white)
Font.Draw (chr (value), 300, 300, font, blue)
exit when done1 = true
end loop
end nameo
Font.Draw ("ENTER YOUR NAME", 20, 380, font1, 255)
locatexy (10, 25)
put "ENTER"
drawbox (10, 20, 100, 50, 255)

procedure signin
done1 := true
var f1 : int
var x : string
x := name
open : f1, "FirstFile.ext", write
write : f1, x
close : f1
end signin
fork nameo
loop
buttonwait ("down", x, y, z, z)
if ptinrect (x, y, 10, 10, 100, 50) then
signin
Window.Close (firstwin)
end if
end loop


*ihave the 1st windw.Open becuse i`m including it in another progam
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Tue Jun 09, 2009 1:48 pm   Post subject: RE:highscore problem

If you close the window and the program isn't finished it will open another make sure you exit all of your loops etc

http://compsci.ca/v3/viewtopic.php?t=21162&highlight=window+close
yodu123




PostPosted: Tue Jun 09, 2009 1:56 pm   Post subject: RE:highscore problem

i double check the program and i exit all the loops
BigBear




PostPosted: Tue Jun 09, 2009 2:15 pm   Post subject: RE:highscore problem

To check just stop the program while it is running and it will show you which line it is on when it was stopped

This should show you the loop it isn't exiting
Kharybdis




PostPosted: Tue Jun 09, 2009 2:39 pm   Post subject: RE:highscore problem

well, your problem is that you don't exit the process. You close the window, but the process is running, so it opens the window again and does the naming again. You exit the loop in the process.. but you don't actually exit the process itself..

To get rid of your opening window problem, just comment out Window.Close(yourwindowID). It's not needed.
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: