Solution for closeField problem
Ken Ray
kray at sonsothunder.com
Fri Jun 1 18:39:03 EDT 2007
On Fri, 1 Jun 2007 08:05:14 -0400, Michael Binder wrote:
> Paul wrote:
>> The problem occurs when the user clicks a button, or uses the menu to
>> leave the card. On OS X the closeField command is not sent when leaving
>> a field under these circumstances - the field never loses focus.
>>
>> Is there a good way to send a message (like closeField) when the user
>> edits a field then clicks elsewhere?
>
> Ken wrote:
>> Ah, now I understand... if you select from the menu, you're doing a
>> mouseDown on the button that drops the Edit menu, which would trigger
>> the "select empty" and remove the hilite from the currently selected
>> text so there's nothing to copy.
>>
>> So I guess the "select empty" fix would have to check to see if the
>> object you're mousing down on is a button in a menugroup.
>
> So then, 'select empty' does work in the mousedown of non menu buttons?
> For menu buttons, how about just putting the 'select empty' in the
> menupick handler?
Well the original problem was triggering a closeField in a field with
the insertion point on OS X when clicking on a button. So in the case
of menu buttons, you *don't* want it to select empty, but to leave the
insertion point where it is. So for all buttons other than those in a
menugroup, you'd execute a select empty (easier in a frontscript), but
exclude menu buttons. Something like this frontscript:
on mouseDown
if (the short name of the owner of the target <> the menubar of the
defaultStack) then
select empty
end if
pass mouseDown
end mouseDown
Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list