Jacqueline Landman Gay wrote:

> David Bovill wrote:
>> 
>> I have a field in a stack and a substack that I open as a palette. I want to
>> know what field has the selection point inside it when I click on the
>> palette, and having problems help appreciated:
>> 
>> on mouseUp
>> put the focusedObject & return & the selectedChunk
>> end mouseUp
>> 
>> This is the script in the button in the palette. And it works fine if there
>> is more than 1 character selected. If the insertion point is within the
>> field but no character selected then both lines are empty
> 
> I just finished setting up the same kind of palette, and had a similar
> experience. What I think is happening is that when you click on the
> palette to bring it to the front, the focus is shifted to the palette --
> and the old focus from the original stack is lost.
> 
> To compensate, I had to do an ugly work-around. Maybe someone else knows
> a better approach, but this seems to work:
> 
> on openField
> global gActiveSel
> put the selectedChunk into gActiveSel
> end openField
> 
> on enterInField -- we use Enter to deselect; you may not want this
> global gActiveSel
> select empty
> put "" into gActiveSel
> end enterInField
> 
> on selectionChanged
> global gActiveSel
> put the selectedChunk into gActiveSel
> end selectionChanged
> 
> on rawKeyUp which
> global gActiveSel
> put the selectedChunk into gActiveSel
> pass rawKeyUp
> end rawKeyUp
> 
> This catches most of the field messages; you may want to add more, such
> as a "closeField" handler to empty the global. When the palette needs to
> interact with the stack, it just reads the global variable to get the
> user's last selection.

A lot of work to get around something the Mac OS already provides for:

When a field has an active selection but loses focus, the selection is still
retained, marked with an outlining boundary.

How do other OSes handle active-but-not-focused selections?

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Multimedia Design and Development for Mac, Windows, UNIX, and the Web
 _____________________________________________________________________
 [EMAIL PROTECTED]                 http://www.FourthWorld.com
 Tel: 323-225-3717           ICQ#60248349            Fax: 323-225-0716



Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to