Puzzling about 'the focusedObject'

dunbarx at aol.com dunbarx at aol.com
Tue Dec 10 19:20:09 EST 2013


Seems counterintuitive to me; I will play around a bit. But it could be standard behavior.

But at least you can rewrite your handler to include a test of the owner of the field. If it is a card or group in the mainstack, then do this. Else do that.

Craig Newman

-----Original Message-----
From: Graham Samuel <livfoss at mac.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Dec 10, 2013 5:16 pm
Subject: Puzzling about 'the focusedObject'

I'm trying to find out which field (if any) in a set of stacks has the focus (if 
the object with the focus is not a field I have other actions to perform which 
are not relevant to this issue). There is a main stack with one card and some 
fields; and a set of palettes. Some of these palettes have fields. The following 
script fragment works if the field with the focus is in the main stack:

if the focusedObject contains "field" then
  select the text of the focusedObject

This seems a nice, robust idea. But if I open a palette and see a flashing 
cursor in a field, that bit of code doesn't work because 'the focusedObject' 
refers to the last field to have the focus in the card in the mainstack.

So, either I've misunderstood the idea of 'the focusedObject' or it doesn't work 
for palettes. The second conclusion would be odd, since 'copy', 'paste' and 
'cut' all work for fields in palettes, without the need to script anything apart 
from the single command, so the engine certainly knows that the focus is in a 
field in a palette. How do these commands know where they are supposed to do the 
cutting or whatever and yet I don't? I can't think of a way of looking this up 
in the documentation, so I am stuck. By the way this is just to implement a very 
simple 'select all' menu item.



use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the use-livecode mailing list