Help with Turing GUI.Quit problem
Author |
Message |
rumman
|
Posted: Thu Jan 05, 2006 5:25 pm Post subject: Help with Turing GUI.Quit problem |
|
|
I am creating this program, which creates a line, and uses multiple choice questions to ask the user the slope of a line.
The only problem that I have is that I want my program to close when the user presses the "Quit the Program" button, which only appears after the person has pressed the "Finished" button. I cannot get my program to close, and stop the execution.
Instead of copying the whole source code, I have attached my file.
Description: |
|
Download |
Filename: |
FINAL OJECT.T |
Filesize: |
73.32 KB |
Downloaded: |
649 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Thu Jan 05, 2006 5:40 pm Post subject: (No subject) |
|
|
Question 16 has two correct answers: 5/5 and 6/6. You really need to reduce those fractions.
You really didn't need to take 1700 lines to code that. I'm pretty sure it could be done in under 100 lines. You see how all your questions are pretty much the same code? That's a repeating pattern that you can use to your advantage. And when I say advantage, I'm talking about 1250 lines of code, not to mention enough time to spell check the filename.
As for your question, it works fine for me. It's well known that Turing's GUI.Quit is messed up, though I can't remember how at the moment. Perhaps someone will know, or perhaps you could clarify the problem a little more, from your end?
|
|
|
|
|
|
rumman
|
Posted: Thu Jan 05, 2006 5:45 pm Post subject: (No subject) |
|
|
Oh yes, the coding is pretty much the same, I have no idea how to reduce the coding for the questions.
BTW, thanks for letting me know the problem about question 16.
The assignment that I have says that whenever the user wishes, they can quit the program, and the program window should close. I am trying to accomplish that using the following procedure: (Line 334 of my application)
code: | procedure quitforsure
GUI.Quit
loop
exit when GUI.ProcessEvent
end loop
Window.Hide (windowB)
Window.Hide (windowC)
Window.Hide (defWinID)
Window.Hide (windowA)
end quitforsure |
I cannot figure out how to stop the program's execution. The only thing I can possibly do is hide the program, but it seems it is impossible to stop the execution of the whole program.
|
|
|
|
|
|
Cervantes
|
Posted: Thu Jan 05, 2006 9:23 pm Post subject: (No subject) |
|
|
You just have to exit all your loops. Since you're using Turing's GUI, that probably means having GUI.ProcessEvent return true, and to do that requires calling GUI.Quit.
In your quit_for_sure procedure (note: it's terribly hard to read names like quitforsure, but much easier to read quit_for_sure or quitForSure), why do you have another one of these?
code: |
loop
exit when GUI.ProcessEvent
end loop
|
What happens if you eliminate that?
|
|
|
|
|
|
Albrecd
|
Posted: Thu Jan 05, 2006 9:29 pm Post subject: (No subject) |
|
|
Quote: It's well known that Turing's GUI.Quit is messed up, though I can't remember how at the moment.
I believe the problem is instead with the command "quit," not as a GUI export. The problem with it is that it forces an error that causes turing to close. I could be wrong, but I don't think there's anything wrong with GUI.Quit, nothing worth crying over or boycotting it for anyway.
|
|
|
|
|
|
Cervantes
|
Posted: Thu Jan 05, 2006 9:49 pm Post subject: (No subject) |
|
|
The quit command is totally different from GUI.Quit. quit ends the program by creating a RunTime error, while GUI.Quit() does sets some boolean variable to true so that GUI.ProcessEvent() returns true, which exits your GUI loop.
Who said anything about boycotting Holtsoft? Although...
rumman, I don't know if this will help you or not (haven't looked carefully at your source due to its... largness), but there's a GUI.ResetQuit procedure for Turing 4.0.5. It resets the boolean flag that GUI.Quit sets to true. If you don't have Turing 4.0.5, you could try to implement it yourself. Just find where GUI.Quit is, and set the flag that GUI.Quit uses to true.
|
|
|
|
|
|
rumman
|
Posted: Fri Jan 06, 2006 3:47 pm Post subject: (No subject) |
|
|
Quote: In your quit_for_sure procedure (note: it's terribly hard to read names like quitforsure, but much easier to read quit_for_sure or quitForSure), why do you have another one of these?
Code:
loop
exit when GUI.ProcessEvent
end loop
What happens if you eliminate that?
I tried doing that but it stays the same, the program does not stop the execution.
Quote: rumman, I don't know if this will help you or not (haven't looked carefully at your source due to its... largness), but there's a GUI.ResetQuit procedure for Turing 4.0.5. It resets the boolean flag that GUI.Quit sets to true. If you don't have Turing 4.0.5, you could try to implement it yourself. Just find where GUI.Quit is, and set the flag that GUI.Quit uses to true.
I used GUI.ResetQuit in my program after each question is finished. However, I am not sure how I can use GUI.ResetQuit in my exit code to stop the execution of the program.
Also, I have Turing 4.0.5. Is it worth trying to find out how to stop the program, or should I just tell my teacher I can't do it?
|
|
|
|
|
|
Da_Big_Ticket
|
Posted: Wed Jan 11, 2006 6:22 pm Post subject: (No subject) |
|
|
Why dont you make a closing screen. During the program have a "Exit" button using GUI so when it is clicked it will open a closing screen. On the closing screen say someting like "Thanks for using my program" and use another GUI button which will do a window.close procedure. Window.close will stop execution for sure you can count on that. Its easy too:
procedure totaled
window.close (winid)
end totaled
var quitButton := GUI.CreateButton (420, 22, 0, " Quit", totaled)
loop
exit when GUI.Processevent
end loop
something along those lines.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|