mouseDoubleUp

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm

mouseDoubleUp

Post by Preston Shea » Mon Nov 29, 2010 6:21 pm

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?
In nova fert animus mutatas dicere formas corpora.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: mouseDoubleUp

Post by Klaus » Mon Nov 29, 2010 6:55 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: mouseDoubleUp

Post by dunbarx » Wed Dec 01, 2010 8:25 pm

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

Post Reply