Passing selectedField Location between Stacks

Bernard Devlin revolution at
Sat Dec 7 23:01:01 EST 2002

Thanks for jumping in Jeanne.  You're right that the objects referenced on
Stack B are buttons.

I've "set the traversalOn of the templateButton to false" prior to the creation
of the buttons, but still when I have the insertion point in Stack T and click
on a button, the "onMouseup" of the button does not put the label of the button
into the field where the selection point was.  However, I noticed that when I
actually _selected_ a character it DID work... the label of the button is
placed after the selected character.

Here is the Transcript from the background group enclosing the buttons:
on mouseUp
put the label of the target after the selectedField
end mouseUp

If no character is actually selected, this is the error message:
Error description:  Chunk: no target found
Object: group id 1004 of card id 1002 of stack "Map" of stack
put the label of the target after the selectedField
Value: mouseUp

And this is what the error details says:
Error description:  Chunk: no target found
put the label of the target after the selectedField
Line: 6 Character: 29

As my usage scenario envisages the user wanting to insert (rather than replace)
a character, I would like to be able to find out what I am doing wrong here.  I
had begun to think I had misunderstood the interactions between stacks, and that
this was why Signe was recommending against using a Palette stack.  I'll be very
chuffed if this turns out to work (as I envisage using it in another application

> >My understanding is that it is the use of two stacks that is preventing me
> >from
> >using the selectedField or selectedChunk to determine where the label of the
> >button should be placed.  Is this correct?
> It shouldn't. I'm going to guess that the objects in stack B are buttons;
> clicking buttons can lose the text selection under some circumstances. If
> you turn the traversalOn property of the buttons off, the text selection
> should be retained when you click them - even if they're in another stack.

More information about the Use-livecode mailing list