Palettes and the selectedObject

dunbarx at aol.com dunbarx at aol.com
Sun Nov 2 23:39:52 EST 2014


Not dumb at all.


Here is a kluge, but there is a problem with it, that is, making the returned focus stick. This was solved in a thread a while back (that I was part of, but cannot remember how we did it, nor find the thread)


With a few fields on a card, place this in the stack script:



on exitField
      if "field" is in the target then
      set the lastFocus of this stack to "field" && the short name of the target
      end if
end exitfield


on closeField
   exitField
end closeField



on resumeStack
     if  "field" is in the lastFocus of this stack then
      focus on field the lastFocus of this stack
      wait 10 with messages
      focus on nothing
      wait 10 with messages
      select after text of  field the lastFocus of this stack
   end if
end resumeStack



You can see all sorts of stuff happening in the correct field, but focus does not stick. Those silly lines are just tests I tried to make focus stick. I am interested in how we once solved this little issue. Anyway, add that to the kluge, and it should work. I am sure this can be done other ways, like with "focusOut" for example.


On another note,if you place this in a button on the card:


focus on fid 1


Focus sticks. Well, of course. The issue, as before, was making the focus stick with a more "distant" action, rather than "locally", that is, while the card is already in front. Now I am the one asking the dumb question...


Craig Newman



-----Original Message-----
From: Graham Samuel <livfoss at mac.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Sun, Nov 2, 2014 6:25 pm
Subject: Palettes and the selectedObject


Another probably dumb question.

If I am keying in a field in an ordinary stack window and I stop to do something 
on a palette, I had hoped that the focusedObject would remain in the ordinary 
stack - however it turns out that the focusedObject is now the visible card of 
the palette. Does this mean that the previous focusedObject is lost and thus I 
can't use a palette to do an insertion in the field in the ordinary stack? Looks 
like it. But programs like Apple's Keyboard Viewer do it, and I suppose there 
must be stuff like that on Windows. The question is, is there a way to do it in 
LC?

I know I can tell if a field loses focus (e.g. from a focusOut message), but by 
then of course the focusedObject will be somewhere else, by definition. 

Graham


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list