Answer dialog focus on OSX using mousedown call

Sarah Reichelt sarah.reichelt at gmail.com
Tue May 22 18:46:39 EDT 2007


On 5/23/07, Jeff Reynolds <jeff at siphonophore.com> wrote:
> If i call and ask dialog from a mousedown handler, the ask dialog
> buttons in the dialog box does not appear to have the screen focus
> when its brought up so it takes two clicks to activate a button (ie
> one to bring the window into focus and the second to activate the
> button.) if i do the same call from a mouseup the ask dialog comes up
> with the proper focus.
>
> any ideas of how to work around this so that it can be called from
> the mousedown handler? tried a lot of fiddles, but only calling the
> ask from a mouseup will make it work 100% of the time. appears to be
> something with the mouseup message from the button the ask dialog was
> called from stealing focus or the ask window after its brought up.


You may be able to use a variation of this trick. Normally, when you
do an "ask" with some default text, the complete text is selected. I
wanted to have the cursor after the text as I knew the required prefix
but needed the user to add to it. I used a "send" to alter the
selection just after the dialog appeared.

on mouseUp
        -- other script

        send "selectAfterAskText" to me in 1 tick
        ask info "Enter the barcode:" with tDefault

       -- other script
end mouseUp

on selectAfterAskText
    select after text of fld id 1119 of stack "Ask Dialog"
end selectAfterAskText


You could possibly alter this to change the focus to the default
button on the answer dialog.

Cheers,
Sarah



More information about the use-livecode mailing list