Page 1 of 1

Button highlighting (too slow?) does not show

Posted: Thu Apr 09, 2015 1:19 pm
by Havanna
(LC 7.0.1 Android 4.4.4)

Click (or tap) on a button starts some extensive database queries in background (3-4 secs), results being prepared on a different card.
To have the button change appearance when tapped I set the colors in mouseup.

on Mouseup
global D, F, L, S
set backColor of me to L["Col_HotButtonBG"]
set foreColor of me to L["Col_HotButtonText"]
lock screen
... do processing and prepare results on card "display" ...
unlock screen
go card "Display"
end Mouseup

This looks straightforward to me, and works in the IDE, but on android the button never changes color, not giving any visual feedback.

I've tried to put a small image (animated gif) on top and show this before the "lock screen", but it only shows in IDE, not on android.
Any hint, as to where I am wrong?

Re: Button highlighting (too slow?) does not show

Posted: Thu Apr 09, 2015 7:59 pm
by jacque
I'm doing this on android and it works. I do use "textcolor" rather than "forecolor" but they're synonyms so it should be the same. I also always uuse "the" with properties. I know the dictionary says it's optional but it's a good habit to get into. So my statement looks like this:

set the textcolor of btn "submit" to "255,255,255"

What happens if you hard-code the color RGB as a test? I wonder if your array doesn't have the correct values for some reason.

Re: Button highlighting (too slow?) does not show

Posted: Fri Apr 10, 2015 12:32 pm
by Havanna
Thanks, Jacque,
I've tried your suggestions - no success.

Finally this made it work:

set the backColor of me to L["Col_HotButtonHiliteBG"]
set the textColor of me to L["Col_HotButtonHiliteText"]
wait for 6 ticks
lock screen

looks like the button just never gets to change color because the db-functions get all the attention (the Gif animation can be seen too with the wait, but it stops after same frames - not helpful)?
I would have expected the processing to be linear.
It just looks strange to me that an extra wait should be necessary to keep the user from tapping around because he didn't get that button feedback.

(just for information: no difference with/without "the", no difference between textColor/foreColor)

Re: Button highlighting (too slow?) does not show

Posted: Fri Apr 10, 2015 4:26 pm
by jacque
Another difference in my script is that I change the color on mouseDown and do the processing on mouseUp. That allows the engine time to do the color change before proceeding with the rest of the task. That might work for you too.

I also use an animated gif like you do and I see the same thing. I get one frame of the animation and then it stops while the database is contacted. I don't think there is much we can do about it, the database is blocking until the results are returned.

Re: Button highlighting (too slow?) does not show

Posted: Wed Apr 15, 2015 11:22 am
by Havanna
Yeah, I finally got to use the mousedown too, although it means to handle the mouseRelease has as well.

It's good to know the gif trouble isn't my programming (only), so I can stop looking for mistakes and wait for the next release :)
Tanks again