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!
When tabbing into some fields, I need the text to be highlighted. The following code does this, however, there's an annoying flicker which occurs. It appears that the cursor first gets positioned at the end of the text then the text gets highlighted, thus the "flicker". Is there a way around this?
instead of using the openField message, use the tabkey message. Of course, you will have to write a different script for each field or apply some trick with cursom properties.
on tabKey
select text of fld "Next Field"
end tabKey
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
That approach is not practical. It also doesn't help with tabbing backward (shift-tab). Anyway, I'll just deal with the flicker and post a QCC report. Thanks anyway.
Mark wrote:Hi Bill,
instead of using the openField message, use the tabkey message. Of course, you will have to write a different script for each field or apply some trick with cursom properties.
Why is't it practical? You have to write a script to make it practical. You can expect that Rev does everything for you.
You didn't say you want it to go the reverse if the shiftkey is pressed. You can check whether the shiftkey is pressed in your script and select the text of a different field.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
More importantly, what operating system/environment do you have? There's various quirks in the display (that for instance, lockscreen doesn't prevent, although I believe it should) on my runtimes in various ways, but I get no flicker at all in testing your original openField script.
Granted, it's only one card, but I made several very large fields and they all tabbed and selected with no quirk in the display.
I use Rev Studio 3 on Windows XP, mainly.
local tLastFieldNumber
on tabKey
put the number of fields into tFieldNumbers
if tLastFieldNumber is "" then put 0 into tLastFieldNumber -- first time
if the shiftkey is not down then
if tLastFieldNumber < tFieldNumbers then
add 1 to tLastFieldNumber
select text of field tLastFieldNumber
else
put 1 into tLastFieldNumber
select text of field tLastFieldNumber
end if
else -- shiftKey is down
if tLastFieldNumber > 1 then
subtract 1 from tLastFieldNumber
select text of field tLastFieldNumber
else
put tFieldNumbers into tLastFieldNumber
select text of field tLastFieldNumber
end if
end if
end tabKey
almost no flicker with this. Although the flicker is barely noticeable on my Mac 2.2 Mhz. Give your user a nickel if he notices the flicker (as an incentive)
bernd
You can also let the engine do the hiliting whenever the user 'tabs' between fields. Select your field, open the Inspector and tick the checkbox 'Tab on return' in the 'Basic properties' panel - or if you'd rather do it by script
You can also let the engine do the hiliting whenever the user 'tabs' between fields. Select your field, open the Inspector and tick the checkbox 'Tab on return' in the 'Basic properties' panel - or if you'd rather do it by script
that works perfectly, without the hassle of scripting the tab or openfield and Bill, no FLICKER.
That's a great solution, but note that the field layers have to be in a particular order for this to work.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Thanks Jan. Odd, but, that works! How do you know this stuff? I guess you stumbled on it one day?
While it shouldn't be an issue for most of my fields, losing the ability to use the Return key to generate a carriage return within a field may be a concern (for larger text fields). But, as that may be the exception rather than the norm, other techniques could be used for that.
But, regardless, your technique provides the highlight without flicker nice and easy.
Thanks!
Bill
Janschenkel wrote:You can also let the engine do the hiliting whenever the user 'tabs' between fields. Select your field, open the Inspector and tick the checkbox 'Tab on return' in the 'Basic properties' panel - or if you'd rather do it by script
I'm not even sure where I got that information - it must have come up on the use-revolution list at one point and it stuck in my head (which is odd, as I usually have the memory of a goldfish)
It's a funky property, as it allows the user to only enter a return if it doesn't cause the field to 'scroll' - so if you have a field that is tall enough to hold 4 lines of text, then the user can enter up to 4 lines of text and the next time he hits the return key the focus will jump to the next field.
But the jump to the next field and the hiliting behaviour is great for data entry forms as you don't have to go about and script individual 'tabKey' and 'returnInField' handlers to move things on their merry way.
Excellent. Thanks for the clarification on the return key. Awesome tips here. They're now in my personal RR notes db.
Thanks
Bill
Janschenkel wrote:I'm not even sure where I got that information - it must have come up on the use-revolution list at one point and it stuck in my head (which is odd, as I usually have the memory of a goldfish)
It's a funky property, as it allows the user to only enter a return if it doesn't cause the field to 'scroll' - so if you have a field that is tall enough to hold 4 lines of text, then the user can enter up to 4 lines of text and the next time he hits the return key the focus will jump to the next field.
But the jump to the next field and the hiliting behaviour is great for data entry forms as you don't have to go about and script individual 'tabKey' and 'returnInField' handlers to move things on their merry way.