Peter M. Brigham, MD
pmbrig at gmail.com
Thu Sep 1 17:12:05 EDT 2011
My solution has been to put the following in an invisible button:
send "mouseup" to btn "myDefaultBtn"
on opencard -- or openstack, or whatever
insert the script of btn "myFrontscript" of this card into front
on closecard -- or closestack, or whatever
remove the script of btn "myFrontscript" of this card from front
That way, no matter where the focus is, the default button will get triggered with a returnkey hit.
Peter M. Brigham
pmbrig at gmail.com
On Sep 1, 2011, at 1:59 PM, Bob Sneidar wrote:
> I'm going to say that an active control is one that is not disabled and is targeted. I created a new stack, with only one card and one button. In the mouseUp of the button I put:
> answer "This is the default button" as sheet
> Hitting the return key triggers the mouseUp in the button. All well and good. Now I create a field and click in the field. Hitting the return key does NOT trigger the mouseUp of the button, AS YOU WOULD EXPECT.
> Now I tab out of the field so that there is nothing (that I can see) targeted. I hit return and I get the dialog, also as you would expect.
> NOW I click in the field, then click somewhere in the empty card and hit the return key. I do NOT get the dialog box, the mouseUp is NOT triggered, this is NOT what you would expect!
> I believe this is the source of your intermittent problems getting this to work. There is something about clicking in the empty space of a card that prevents the engine from sending the return key to the button. If anything, THIS is the bug. Tabbing out of the last field and clicking the card should result in the same condition, but obviously it does not.
> Let's get tricky. In the card script I put this:
> on mouseUp
> put the target
> end mouseUp
> NOW I click the card, then hit the return key, and I get the mouseUp in the button triggering every time! Something about trapping the mouseUp message seems to produce the correct condition.
> Can anyone else verify this experiment?
> On Sep 1, 2011, at 10:09 AM, Pete wrote:
>> Thanks everyone.
>> Jacque, Like you I'm currently using a returnKey handler for the card that
>> sends mouseUp to the button to get round this.
>> Craig, If I "put the defaultbutton of this card", I get the correct output.
>> Also, I'm not seeing anything in the dictionary about the button changing
>> size - is that in the defaultButton entry?
>> Mark, maybe the difference between what you did and what I have is that I
>> have 3 field controls on the card in addition to the default Button. Each
>> of the field controls has lockText set to true and traversalOn set to false.
>> Thing is, the dictionary says the default button behavior only works if
>> there is no active control on the card, but it doesn't define what an active
>> control is so I don't know if the way I defined the field controls qualifies
>> them as being inactive or not.
>> I'm getting the behavior I want by using the card level returnKey handler
>> but wondering whether I should enter a bug report about this. There doesn't
>> seem any point in defining a button as the default button unless it acts as
>> defined in the dictionary, but it would be good to know what qualifies as an
>> "active control" before reporting it as a bug.
>> Molly's Revenge <http://www.mollysrevenge.com>
>> On Thu, Sep 1, 2011 at 9:27 AM, Mark Schonewille <
>> m.schonewille at economy-x-talk.com> wrote:
>>> This is what I just did:
>>> 1) create new stack
>>> 2) drag one default button from the tools palette into your stack
>>> 3) edit the script of the button to make it been on mouseUp (and nothing
>>> 4) compile and close script
>>> 5) press return
>>> 6) hear beep
>>> Best regards,
>>> Mark Schonewille
>>> Economy-x-Talk Consulting and Software Engineering
>>> Homepage: http://economy-x-talk.com
>>> Twitter: http://twitter.com/xtalkprogrammer
>>> KvK: 50277553
>>> Send me a friend request on Facebook if you like
>>> On 1 sep 2011, at 17:20, J. Landman Gay wrote:
>>>> On 8/31/11 7:29 PM, Pete wrote:
>>>>> I put a default button a card that has a couple of field controls on it.
>>>>> The field controls all have lockText set to true and traversalOn set to
>>>>> false. Pressing the return key when the card is active does not execute
>>>>> mouseUp handler for the default button as claimed by the dictionary. Is
>>>>> there some other setting of the card/button/controls that I have to use?
>>>> Funny, I never knew about this capability. I've always had to script it
>>> with a returnKey handler in the card, I've never seen a default behavior.
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode