On 04/03/14 22:41, Richmond wrote:
I have 2 completely independent mainstacks:

1. "Cruddy_Text"; this is a stack containing one selectable textField and nothing else.

2. "palette_keyboard"; this contains a single button " 1122.png" containing this code:

on mouseUp
   set the useUnicode to true
   put the short name of me into MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   -----
      set the unicodeText of the selectedText to numToChar(MAGIC)
   -----
select after the selectedText
end mouseUp

this stack also has this in its stackScript:

on openStack
   palette stack "palette_keyboard"
end openStack

--------------------------------

What I am trying to do is build a floating palette that will let me enter Unicode chars into any selected textField regardless of whether it is in another substack of a collection
of stacks, or a free-standing stack.
--------------------------------

What happens is that, having clicked into the textField in stack "Cruddy_Text" I then click on my button in the palettised stack "palette_keyboard" . . .

When I click on the button the field in the other stack is deselected.

And the IDE throws an error:

executing at 10:29:27 PM
Type    Chunk: no target found
Object    1122.png
Line    set the unicodeText of the selectedText to numToChar(1123)
Hint    c

which is a bit worrying.

-----------------------------------

The last time I made a palettised stack was about 3 years ago with LC 4.5 on Mac (currently working with 6.6 on Linux), and it changed the thickness of the title bar of the stack, so it was obvious it was a palette; this does not seem to
happen just now (although the stack does become a palette).

Richmond.





Well, here I am (just for a change) answering my own message.

I had to set up 2 fields in the "palette_keyboard" stack, and then alter my button script to this:

on mouseUp
   put fld "FEELD" into FEELD
   put fld "STAK" into STAK
   set the useUnicode to true
   put the short name of me into MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   delete the last char of MAGIC
   -----
set the unicodeText of fld ID FEELD of stack STAK to the unicodeText of fld ID FEELD of stack STAK & numToChar(MAGIC)
   -----
end mouseUp

on mouseEnter
   put the ID of the selectedField into fld "FEELD"
   put the topStack into fld "STAK"
end mouseEnter

-------------------------------------------

It seems a bit clunky with those fields, but that seems to be one way to stop losing those variables
between the mouseEnter bit and the mouseUp bit.

I'm sorry I have mouseEnter after mouseUp; something to do with the way I thought things through;
which, if you compare my first stab and my second one you should understand.

Richmond.

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

Reply via email to