Back Button Help
Author |
Message |
McDermaid16
|
Posted: Fri Apr 17, 2009 1:19 pm Post subject: Back Button Help |
|
|
HI i was wondering if there is any possible way to create a back button which would bring you back to the beginning of the program so kind of like a restart button i have searched already and have yet to find anything that has worked. My code is below the button would be put after you have selected which shape to draw.
Turing: |
/* Author:Ryan McDermaid
Version: 1
Date: April 6th 09
Description:Puts a different shape on screen dependent upon choice*/
%Shows The Mouse On Screen
mouseshow
%Declares Font Variable To Make Arial Font
var font := Font.New ("arial:18")
%Draws A Fillbox
drawfillbox (20, 140, 200, 240, black)
%Puts Word In Arial Font In Specific Spot On Screen
Font.Draw ("Maple Leaf", 45, 188, font, white)
%Draws A Fillbox
drawfillbox (210, 200, 390, 300, magenta)
%Puts Word In Arial Font In Specific Spot On Screen
Font.Draw ("Box", 275, 245, font, black)
%Draws A Fillbox
drawfillbox (400, 145, 580, 245, red)
%Puts Word In Arial Font In Specific Spot On Screen
Font.Draw ("Oval", 459, 188, font, black)
%Draws A Fillbox
drawfillbox (210, 90, 390, 190, green)
%Puts Word In Arial Font In Specific Spot On Screen
Font.Draw ("Arc", 275, 140, font, black)
%Declares Varaibles
var x, y, btn : int
%Starts Loop
loop
%Finds Mouse On Screen
mousewhere (x, y, btn )
%Starts Conditional Statement to on what to do dependent upon the mouses location
if x >= 100 and x <= 200 and y >= 100 and y <= 200 and btn = 1 then
%Clears Screen
cls
%Draws A Maple Leaf
drawfillmapleleaf (210, 100, 410, 290, red)
%Puts What Ever Is In Quotes On Screen
put "Here Is The Maple Leaf"
%Exits loop
exit
%Starts Conditional Statement to on what to do dependent upon the mouses location
elsif x >= 210 and x <= 390 and y >= 200 and y <= 300 and btn = 1 then
%Clears Screen
cls
%Draws A Fill Box
drawfillbox (210, 200, 310, 300, red)
%Puts What Ever Is In Quotes On Screen
put "Here Is The Box"
%Exits loop
exit
%Starts Conditional Statement to on what to do dependent upon the mouses location
elsif x >= 400 and x <= 580 and y >= 145 and y <= 245 and btn = 1 then
%Clears Screen
cls
%Draws A Filled Oval
drawfilloval (210, 200, 100, 100, red)
%Puts What Ever Is In Quotes On Screen
put "Here Is The Oval"
%Exits loop
exit
elsif x >= 210 and x <= 390 and y >= 90 and y <= 190 and btn = 1 then
%Clears Screen
cls
%Draws An Arc
drawarc (300, 100, 250, 250, 0, 180, red)
%Puts What Ever Is In Quotes On Screen
put "Here Is The Arc"
%Exits loop
exit
%Ends If Statement
end if
%Ends Loop
end loop
|
Im using version 4.1.1a |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Euphoracle
|
Posted: Fri Apr 17, 2009 3:37 pm Post subject: RE:Back Button Help |
|
|
Wow, that is a ridiculous amount of superfluous commenting. |
|
|
|
|
|
BigBear
|
Posted: Fri Apr 17, 2009 8:01 pm Post subject: RE:Back Button Help |
|
|
you could make it a procedure and call it multiple times |
|
|
|
|
|
TheGuardian001
|
Posted: Fri Apr 17, 2009 11:44 pm Post subject: Re: Back Button Help |
|
|
I would probably go with a procedure too, unless of course you haven't learned those yet, in which case you could use nested loops, by wrapping the entire program (minus declarations) in a loop. This would cause the program to repeat without being prompted, but you can probably figure it out from there.
Some other things I should point out:
-mousehide and mouseshow are not currently implemented and will do nothing.
-is there any point in having a loop that will exit after 1 run no matter what? |
|
|
|
|
|
Tallguy
|
Posted: Mon Apr 20, 2009 7:27 am Post subject: RE:Back Button Help |
|
|
and way too many comments lol |
|
|
|
|
|
80660134
|
Posted: Wed Nov 05, 2014 9:43 pm Post subject: RE:Back Button Help |
|
|
I have a problem with going back botton too because I use GUICreateButton |
|
|
|
|
|
|
|