Page 1 of 1

mouseDoubleUp

Posted: Mon Nov 29, 2010 6:21 pm
by Preston Shea
I am trying to get a double click in a text field to
1. copy the hilited text to the clipboard so it can be pasted into a different text field
2. set the textStyle of the hilited text to Link

I have tried

on mouseDoubleUp
get the selectedChunk of me
set textStyle of the selectedChunk to "Link"
end mouseDoubleUp

but no luck. Any suggestions?

Also ...
What script would I put in the receiving field so that when the mouse is clicked in it the text copied from the first field is inserted at that point?

Re: mouseDoubleUp

Posted: Mon Nov 29, 2010 6:55 pm
by Klaus
Hi Preston,

unfortunately editable fields do not receive mouseevents (mousedown/-up/-doubledown/-doubleup), except when the ALT key is pressed.
"the selectedchunk" also returns a description of the field, so "the selectedchunk OF ME" does nothing,
although I would have exspected an error.

Maybe you could trap the "selectionchanged" message?

## What script would I put in the receiving field so that when the mouse is clicked in it
## the text copied from the first field is inserted at that point?
Hm, I would store the text of the other field in a (global) variable or custom property first and then use "on openfield"
since "opening" that field would remove the selection from the first field!


Best

Klaus

Re: mouseDoubleUp

Posted: Wed Dec 01, 2010 8:25 pm
by dunbarx
The mouseDoubleDown message is sent to the card when you click into unlocked fields. You can trap this.

In the card script:

on mouseDoubleDown
put the selectedText && the selectedField
end mouseDoubleDown