Hello Guest it is September 23, 2019, 12:20:22 AM

Author Topic: button code  (Read 2620 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  237 237
    • View Profile
button code
« on: April 28, 2009, 09:00:07 AM »
I have the following code in a button.
There are 4 buttons and I only want the one clicked on to have the led turned on.
Each button has 2 leds.
One is around the button and changes color and the other is a fake button that sits over a transparent button.
The led that is around the button always works.
The led that is a fake button usually does not change.
What am I doing wrong?

If (GetUserLED (1141) = 1) Then
SetUserLED (1141, 0)
Else
If (GetUserLED (1142) = 1) Then
SetUserLED (1142, 0)
Else
If (GetUserLED (1143) = 1) Then
SetUserLED (1143, 0)
End If 
End If
End If 
SetUserLED (1140 , 1)

Bill

Offline jimpinder

*
  •  1,233 1,233
  • Wakefield, West Yorks, UK
    • View Profile
Re: button code
« Reply #1 on: April 29, 2009, 11:25:42 AM »
The leds are either true or false, not 0 and 1. The "0" is 0, but the "1" is "non-zero" not necessarily 1.

Just try If GetUserLED(****) Then  - or - If NOT GetUserLED(****) Then for the "on" or "off"
Not me driving the engine - I'm better looking.

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: button code
« Reply #2 on: April 29, 2009, 01:25:54 PM »
I thought I replied to this yesterday but must be going senile :(
 It could be your buttons/led setup. I know Brett had a lot of trouble trying to put invisible buttons on top of LEDs etc

Hood

Offline Greolt

*
  •  956 956
    • View Profile
Re: button code
« Reply #3 on: April 30, 2009, 04:59:21 AM »
What Hood is referring to is this,

If you have a LED with a transparent button taking up the same screen space then you must assign a transparent png to the button.

Otherwise the LED will not show change of state reliably.

Greg

Offline Bill_O

*
  •  237 237
    • View Profile
Re: button code
« Reply #4 on: April 30, 2009, 12:20:17 PM »
I think I did make and use a transparent png for the button but I will check.
Thanks everyone,
Bill