Problems with the focusedObject
Graham Samuel
livfoss at mac.com
Fri Sep 19 12:55:41 EDT 2008
Bonjour Eric
Thanks for the quick reply. Sadly the selectedField returns empty in
the circumstances. I do find this very mysterious. For example, if I
put some text in a field and invoke my 'cut' menu, which executes this
script fragment from the menuPick handler dealing with "Cut":
cut
if clipboardData["text"] is not empty then
put the selectedfield
....
The clipboard data can be shown to be as expected (i.e. what was in
the field), but the selectedField is just empty.
There must be some way for the handler in the menu to detect what the
cut (or paste or clear) operation was operating on, but I can't find it.
Best wishes from la France profonde
Graham
On 1Fri, 19 Sep 2008 15:39:58 +0200, Eric Chatonet <eric.chatonet at sosmartsoftware.com
> wrote:
>
> Bonjour Graham,
>
> May be the selectedField could be your friend?
>
> if the selectedField <> empty then put the long name of the
> selectedField into tSourceField
>
> Le 19 sept. 08 à 15:34, Graham Samuel a écrit :
>
>> I'm trying to implement a simple Undo for a text entry screen
>> consisting of a grid of fields acting as cells (not a single table,
>> but individual fields). To do this, when the user selects say "Cut"
>> from the available menu, I want to record not only the currently
>> selected text - no problem - but also the ID (or better, the name)
>> of the field/cell where the text was before it was cut. However
>> when I execute a script line like
>>
>> put the short name of the focusedObject into lastFieldCut
>>
>> the name is that of the underlying card. This doesn't seem to be
>> what the documentation says is supposed to happen. The
>> documentation suggests that the underlying card is returned when
>> nobody has the focus, yet I have seen the cursor blinking just as I
>> pull down the menu.
>>
>> I think that by invoking a menu I somehow have altered the focus,
>> albeit temporarily.
>>
>> Can anyone explain how I can find out which field was in play when
>> the menu was invoked?
>>
>> TIA
>>
>> Graham
>
> Best regards from Paris,
> Eric Chatonet.
More information about the use-livecode
mailing list