dunbarx wrote: ↑Wed Jun 19, 2019 11:36 pm
Richard.
I assumed the text was in a field.
Yes, so do I. My question was about the button containing the script that acts on that field.
If the traversalOn property of the button is true (which for most button styles is the default), what's reported here makes sense, and is consistent with every version I've used since 1998.
When traversalOn is true, clicking on the button shifts focus away from any previously-selected object to the button. So if text is selected, we would see that selection cleared once the mouse goes down on the button. Once the selection is cleared, "the selection" no longer returns a valid chunk reference, which would give rise to the error shown.
Turning off the traversalOn property of the button should remedy this easily. Provided, that is, that the traversalOn is currently true. To know that we'll have to wait for the OP to reply.