Computer Science Canada GUI running with loop |
Author: | Abdiwahab [ Mon Jan 14, 2008 8:00 pm ] | ||
Post subject: | GUI running with loop | ||
I have a computer game ISP due Wednesday. So far, I got everything down fine, but I'm stuck now. My teacher said that we had to include a button in the game screens that goes back to main menu if the user wants to opt out of playing and return to the start screen. But what sucks is my GUI doesn't work cuz I have a loop running in the same procedure. Can anyone help me?
^That doesn't work. Is there anyway to make a button and a loop run at the same time without the button just uselessly sitting there? |
Author: | Tony [ Mon Jan 14, 2008 8:24 pm ] |
Post subject: | RE:GUI running with loop |
You need to place GUI.ProcessEvents inside the loop, so that it can process any events that might happen to GUI (such as mouse clicks, etc). |
Author: | Abdiwahab [ Mon Jan 14, 2008 9:06 pm ] | ||
Post subject: | Re: GUI running with loop | ||
Thanks Tony! I added this:
...but this loop gets in the way of the other loop and makes it so that the other loop isn't displayed. ![]() How can u make it so that the two loops run at the same time? |
Author: | Tony [ Mon Jan 14, 2008 9:35 pm ] |
Post subject: | RE:GUI running with loop |
why not just combine the contents of the loops together? |
Author: | Abdiwahab [ Mon Jan 14, 2008 9:49 pm ] |
Post subject: | RE:GUI running with loop |
Anywhere I put it, its still waiting for the GUI to be clicked before doing anything else. |
Author: | Tony [ Mon Jan 14, 2008 9:55 pm ] |
Post subject: | RE:GUI running with loop |
that would largely depend on your logic flow. Try to step through your program, one line at a time, and see how loops and if-conditions affect the flow. If you get stuck anywhere (for example, loop doesn't exit, or the program is waiting for user input), then that's the problem. |
Author: | Abdiwahab [ Mon Jan 14, 2008 10:00 pm ] | ||
Post subject: | RE:GUI running with loop | ||
LOL just as I sent the last reply I noticed that if-statements work even better then exit when which is what u said right now:
Thanks for all your help ![]() Compsci is awesome ![]() |