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

Username:   Password: 
 RegisterRegister   
 Disabling Buttons After Use
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sty1ez




PostPosted: Tue Jan 22, 2008 5:04 pm   Post subject: Disabling Buttons After Use

Im kinda still a newbie to turing ......

I wanted to know how to disable a button after it is pressed since you can't put the disable button command in the procedure itself.

What im asking.. is there an alternate way of disabling a button since the disable command has to be after the button is created and the procedure comes before the button.
Sponsor
Sponsor
Sponsor
sponsor
Gooie




PostPosted: Tue Jan 22, 2008 5:27 pm   Post subject: Re: Disabling Buttons After Use

Use an array of boolean. Similarly to input. Set all the values to true with a for loop, and as the conditions are met set the key to false. There is probably a more elegant way of doing this. Just an Example.
code:

var KeyOn : array char of boolean
var KeyInput : array char of boolean

for i : 1 .. upper (KeyOn)
    KeyOn (chr(i)) := true
end for

loop
    Input.KeyDown (KeyInput)
    if KeyInput ('w') and KeyOn ('w') then
        put "After all this suff is done disable the key"
        KeyOn ('w') := false
    end if
end loop
Sty1ez




PostPosted: Tue Jan 22, 2008 5:36 pm   Post subject: Re: Disabling Buttons After Use

I dont understand arrays yet

and I was talking about a ------>GUI.CreateButton<------- not a key on your keyboard
Gooie




PostPosted: Tue Jan 22, 2008 5:38 pm   Post subject: Re: Disabling Buttons After Use

Sty1ez @ January 22nd, 5:36 pm wrote:
I dont understand arrays yet

and I was talking about a ------>GUI.CreateButton<------- not a key on your keyboard


Ah I see, I avoided GUI, sorry I can't help you there.
ericfourfour




PostPosted: Tue Jan 22, 2008 5:58 pm   Post subject: RE:Disabling Buttons After Use

Styles you should learn arrays before you move to any GUI.

I don't really understand what you are asking. Maybe if you posted some pseudo-code to show what you are attempting, you can get better help.
HeavenAgain




PostPosted: Tue Jan 22, 2008 6:09 pm   Post subject: RE:Disabling Buttons After Use

you cannot disable something when its not there, so im not sure why are you trying to disable your button before it even existed.... and for disabling button, you can just simply do something like
code:
GUI.disable(my_button_name)
and it will be gone for good
Nick




PostPosted: Tue Jan 22, 2008 6:10 pm   Post subject: RE:Disabling Buttons After Use

how about a boolean varible set to true when activated so...

code:
var buttonPressed:boolean:=false

proc thing
    buttonPressed:=true
end thing

loop
    exit when GUI
    if buttonPressed then
        delete button
    end if
end loop
Clayton




PostPosted: Tue Jan 22, 2008 6:37 pm   Post subject: RE:Disabling Buttons After Use

Since Turing's built in GUI uses action procedures, you can simply have your GUI.Disable() as the first line in your procedure so that you don't have need for a silly boolean variable to keep track of as well.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: