Passing selectedField Location between Stacks
revolution at knowledgeworks.plus.com
Mon Dec 9 20:29:10 EST 2002
I'm still trying to solve the problem of passing the field reference of the
insertion point to my palette so that I can insert the label of a palette button
into the field. (All the buttons and groups of the palette have "traversal on is
false"). I still don't understand why the selectedChunk below is empty when the
Transcript documentation suggests that it should contain the location of the
> If there is actually some selected text in the field with the insertion point,
> then the label of the button can be inserted after the text (using "after the
> selectedChunk"). However, if I intercept the processing of the handler in the
> button palette, unless there _is_ selected text, the following all return empty:
> the selectedChunk
> the selectedField
> the selectedLine
> the selection.
> If there is selected text, then they all display some value.
> Because they are empty, the button's label cannot be inserted after anything
> (there is no target), and I get the "chunk: no target found" error.
> My understanding is that the selectedChunk should return something even if
> nothing is selected. Am I wrong? According to the Transcript Dictionary:
> If no text is selected but the text insertion point is in a field, the
> startChar is the character after the insertion point, and the endChar is the
> character before the insertion point. In this case, the endChar is one less than
> the startChar.
> Am i misunderstanding something about the way in which the target works? Or is
> this a bug?
In the absence of a clear understanding of why this is not working, I am trying
to work around it. (I'm sure it has something to do with operations between
I'm using a mouseLeave handler to save the selectedChunk and stack details into
the palette's custom properties. However, when i try to address the stack from
these properties e.g. using "open stack" it doesn't work.
Here is the kind of script I am using:
put word 2 of the cpInsLocStack of stack "Map" into aStack
open stack aStack
"answer aStack" presents the stack's name (which is "Target"). If I type 'open
stack "Target" ' in the message box the stack opens; if I paste the above script
into the message box, I get the answer dialog, but the stack doesn't open.
What am I doing wrong here?
More information about the Use-livecode