Page 1 of 1

Change disabled button text color

Posted: Fri Apr 24, 2009 10:51 am
by ac11ca
Hi there,

I have a button labeled "A". When pressed its label changes to "B" and the button is disabled for one second. After that second, the button resets (i.e., becomes enabled again and is labeled "A"). Basically, I want users to see the label change in that one second, but I know that users will be trying to click as fast as possible on the button to get to the next phase. I have tried to get around this by disabling the button for the one second, so that they cannot click in that time. This method sort of works, but the disabled button label text fades to a grey, which is bad.

Can anyone think of a way of changing the disabled button color to black? Or any other way of achieving what I want (stopping users from clicking really fast and hence not noticing the label change).

Cheers,
Adrian

Posted: Fri Apr 24, 2009 11:32 am
by SparkOut
There's probably a million ways you could apply here, but

Code: Select all

on mouseUp
   set the disabled of me to true
   set the label of me to "B"
   set the backcolor of me to black
   send "reactivateButton" to me in 1 second
end mouseUp

on reactivateButton
   set the disabled of me to false
   set the backcolor of me to red --or the usual colour you want for the button
   set the label of me to "A"
end reactivateButton
This should work. You can still set the properties of a disabled button. In this case, backcolor should be the thing you need. You may possibly have to fiddle with the Appearance Manager, but I think this should get you going.
HTH

Posted: Fri Apr 24, 2009 3:18 pm
by magice
another possibility is just take way the script it performs for 1 second instead of disabling it.

Code: Select all

 on mouseUp
global tPreventUse
if tPreventUse <> true
then
   put true into tPreventUse
   set the label of me to "B"
   send "reactivateButton" to me in 1 second
end if
end mouseUp

on reactivateButton  
  global tPreventUse
 set the label of me to "A"
   put false into tPreventUse
end reactivateButton
this way the button doesn't get disabled. It just becomes useless for 1 second.

Posted: Sun Apr 26, 2009 5:30 am
by ac11ca
Thanks guys, good suggestions. I went with the backcolor/bottomcolor commands simply because they meant less code changes for me.

Cheers,
Adrian