Change disabled button text color

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ac11ca
Posts: 41
Joined: Sun Mar 16, 2008 2:22 am

Change disabled button text color

Post by ac11ca » Fri Apr 24, 2009 10:51 am

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

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Apr 24, 2009 11:32 am

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

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Post by magice » Fri Apr 24, 2009 3:18 pm

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.

ac11ca
Posts: 41
Joined: Sun Mar 16, 2008 2:22 am

Post by ac11ca » Sun Apr 26, 2009 5:30 am

Thanks guys, good suggestions. I went with the backcolor/bottomcolor commands simply because they meant less code changes for me.

Cheers,
Adrian

Post Reply