Active field when opening card?
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller
Active field when opening card?
Hi all,
I'm converting many stacks from HyperCard to Revolution. Several of these have many fields, like address book stacks. One problem I have not yet gotten past: When a card opens, one of the fields is selected (active). So, among other problems, if I accidentally type something, the field text is destroyed.
How can I turn off this auto-select behavior? Where is it set?
Thanks --
David
I'm converting many stacks from HyperCard to Revolution. Several of these have many fields, like address book stacks. One problem I have not yet gotten past: When a card opens, one of the fields is selected (active). So, among other problems, if I accidentally type something, the field text is destroyed.
How can I turn off this auto-select behavior? Where is it set?
Thanks --
David
-
- Livecode Opensource Backer
Re: Active field when opening card?
Check out these in the dictionarydwolff wrote:So, among other problems, if I accidentally type something, the field text is destroyed.
focus
Use the focus command to make a control active--that is, to make it receive any keystrokes the user types.
(obviously, you will choose to set the focus on a control *other* than the field... for instance an "ok" button or some non editable nterface element)
traversalOn
Setting a field's traversalOn to true enables the user to tab into or click in the field for editing (if the field's lockText property is false). If a field's traversalOn and lockText properties are both set to true, the user can select text, but not change it, and can scroll within the field using the keyboard. If the traversalOn is true and the lockText is false, the field can be edited. If the lockText is true and the traversalOn is false, the user can neither select nor edit the field's text.
Assuming that Revolution always focuses on field 2 while you want field 1 to be focuses on openCard, the following script does the job:
on preOpenCard
repeat with x = 1 to number of fields
set the traversalOn of fld x to false
end repeat
end preOpenCard
on openCard
repeat with x = 1 to number of fields
set the traversalOn of fld x to true
end repeat
focus on fld 2
end openCard
Best,
Mark
on preOpenCard
repeat with x = 1 to number of fields
set the traversalOn of fld x to false
end repeat
end preOpenCard
on openCard
repeat with x = 1 to number of fields
set the traversalOn of fld x to true
end repeat
focus on fld 2
end openCard
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Yes, you can use the "on opencard" in the card's script and focus on any
object you wont, of course avoiding the objects you don't want focused
on.
In the documentation, scroll down to "focus".
focused on in order to take the focus away from any object you don't
want the focus on.
-Garrett
object you wont, of course avoiding the objects you don't want focused
on.
In the documentation, scroll down to "focus".
I imagine though that you'll need another object that has the ability to beSummary:
Places the insertion point in a field or makes a control active.
Examples:
focus on field "Label"
focus on the mouseControl
focus on graphic "Move Me"
focused on in order to take the focus away from any object you don't
want the focus on.
-Garrett
Hi Garrett,
First of all, you don't need another object. However, even if you had another object to take the focus away, as you call it, opening the card would automatically re-focus the first field. That is why I turn off the traversalOn of all fields on preOpenCard and turn then on again on openCard, in my example. There may be a simpler way, but at least I know that this method never never fails.
Best,
Mark
First of all, you don't need another object. However, even if you had another object to take the focus away, as you call it, opening the card would automatically re-focus the first field. That is why I turn off the traversalOn of all fields on preOpenCard and turn then on again on openCard, in my example. There may be a simpler way, but at least I know that this method never never fails.
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Active field when opening card?
So. Revolution always focuses on a traversable field on every OpenCard, yes? (This is not documented that I can find. It's also different from HyperCard behavior, so it's snagged me.)marielle wrote:Check out these in the dictionarydwolff wrote:So, among other problems, if I accidentally type something, the field text is destroyed.
<snippage>
traversalOn
Setting a field's traversalOn to true enables the user to tab into or click in the field for editing (if the field's lockText property is false). If a field's traversalOn and lockText properties are both set to true, the user can select text, but not change it, and can scroll within the field using the keyboard. If the traversalOn is true and the lockText is false, the field can be edited. If the lockText is true and the traversalOn is false, the user can neither select nor edit the field's text.
Is there anywhere a list of what messages are sent during various events such as opening a card?
Now I'm looking for a simple way to lock things. Just checked the "cantmodify of this stack" and apparently that does not prevent editing fields!
Thanks --
David
I decided to take this course. (BTW, I couldn't find any documentation that matches your quote... where is that?)Garrett wrote:Yes, you can use the "on opencard" in the card's script and focus on any
object you wont, of course avoiding the objects you don't want focused
on.
In the documentation, scroll down to "focus".
I imagine though that you'll need another object that has the ability to beSummary:
Places the insertion point in a field or makes a control active.
Examples:
focus on field "Label"
focus on the mouseControl
focus on graphic "Move Me"
focused on in order to take the focus away from any object you don't
want the focus on.
-Garrett
The stack script now has this handler:
Code: Select all
On OpenCard
Focus on bg field "EatRevFocusKludge"
Pass OpenCard
End OpenCard
The idea of un-setting and re-setting a property for every field on the card (possibly 10-20!) on every card open seemed... non-optimal.
It doesn't seem to want to focus on a button, as was suggested above, only a (traversable and enabled) field. Which however can be hidden behind another field. This has the disadvantage of eating left-arrow and right-arrow keys but I could add a script to the field to deal with this.
Again, is there a list of all messages sent by various actions?
Thanks --
David
No. There are the functions commandnames and functionnames, but there is no messagenames. So, there is no list of actions and related messages and there isn't even a list of messages. However, you can enter "message" as a query in the docs and you will get a list of all messages.Again, is there a list of all messages sent by various actions?
I don't think it is doable to compile an exhaustive list of all possible user actions and all invoked messages, such as: open a card, closeCard, openCard, preOpencard, possibly preOpenStack and openStack, etc etc etc.
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
I must be really unclear.Mark wrote:<snippage>Again, is there a list of all messages sent by various actions?
I don't think it is doable to compile an exhaustive list of all possible user actions and all invoked messages, such as: open a card, closeCard, openCard, preOpencard, possibly preOpenStack and openStack, etc etc etc.
Is there a list of the messages that Revolution automatically sends on various events, for example when going to a different card?
For example, in HyperCard, somewhere I have a list of what HyperCard sends when I delete a card (closeCard, deleteCard, then openCard; possibly with some xxxBackground messages if it was the last card in the background).
A book, maybe?
Thanks --
David
Hi David,
I think you cut out the wrong part of the quote. As I wrote in me previous message:
...you can enter "message" as a query in the docs and you will get a list of all messages.
As far as I know, this is the only practicle way to get a list of messages.
Best,
Mark
I think you cut out the wrong part of the quote. As I wrote in me previous message:
...you can enter "message" as a query in the docs and you will get a list of all messages.
As far as I know, this is the only practicle way to get a list of messages.
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 9852
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
And of it were it'd be too tedious to read.Mark wrote:I don't think it is doable to compile an exhaustive list of all possible user actions and all invoked messages, such as: open a card, closeCard, openCard, preOpencard, possibly preOpenStack and openStack, etc etc etc.Again, is there a list of all messages sent by various actions?
It may be more helpful to examine messages interactively with the Message Watcher.