Prevent drag of text

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Prevent drag of text

Post by lohill » Fri Oct 12, 2012 6:50 pm

What property of a text field is it that allows you to select a chunk of text and drag it to a new position. I want to stop it from happening but can't seem to find the property. All of a sudden I am experiencing this but I don't remember it from the past. I'm using Live Code 5.2.2

Larry

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Prevent drag of text

Post by mwieder » Fri Oct 12, 2012 7:23 pm

It's the default action of field objects. To disable it, add this to the script of the field:

Code: Select all

on dragStart
end dragStart

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Prevent drag of text

Post by lohill » Thu Oct 18, 2012 5:11 pm

Thanks mwieder,

That stopped the drag just fine. It turns out that the dragging was only a symptom of a bigger problem that I was having. I'll start by asking the question I should have asked in the first place. What can cause a field, which has a section of its text selected, to turn into a state where you can no longer click it to cancel out the selection and put an insertion point in a new place. In this state you can double click a word in a new place which selects it but you still can't single click and get anything to happen.

I have a large chunk of text in a field in my application and I select a contiguous portion of it and process it line by line for the information I want. Then I select another portion of it and process that. Occasionally after having processed a section, the field gets into a state where I cannot select a new part. Any clues as to what might be done to get the field back to normal?

Larry

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Prevent drag of text

Post by lohill » Thu Oct 18, 2012 5:13 pm

Thanks mwieder,

That stopped the drag just fine. It turns out that the dragging was only a symptom of a bigger problem that I was having. I'll start by asking the question I should have asked in the first place. What can cause a field, which has a section of its text selected, to turn into a state where you can no longer click it to cancel out the selection and put an insertion point in a new place. In this state you can double click a word in a new place which selects it but you still can't single click and get anything to happen.

I have a large chunk of text in a field in my application and I select a contiguous portion of it and process it line by line for the information I want. Then I select another portion of it and process that. Occasionally after having processed a section, the field gets into a state where I cannot select a new part. Any clues as to what might be done to get the field back to normal?

Larry

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Prevent drag of text

Post by mwieder » Thu Oct 18, 2012 5:31 pm

Do you have any mouseX (moueDown, mouseUp) handlers in the field script that might be interfering? Sounds like the mouseUp events are being consumed and not passed on.
Make sure you're passing the event when you quit the handler, i.e.,

Code: Select all

on mouseUp
  -- code here
  pass mouseUp
end mouseUp

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Prevent drag of text

Post by lohill » Thu Oct 18, 2012 5:50 pm

My formatting for the data in the field is not done with a mouseUp but rather with a menu item that executes a script on the card. Would a 'pass mouseup' be effective there?

Larry

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Prevent drag of text

Post by mwieder » Thu Oct 18, 2012 6:28 pm

No, that won't work. You can only pass the same handler you're executing.

So (let's see if I've got this right)... you select a section of text, then select a menuItem to format it, and then you can't select in the field any more?

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Prevent drag of text

Post by lohill » Thu Oct 18, 2012 6:39 pm

mwieder,
So (let's see if I've got this right)... you select a section of text, then select a menuItem to format it, and then you can't select in the field any more?
Yes. But it had never happened before last week and with repeated tries in seems to be happening only with a particular section of text I format. Once it happens I have a hard time getting it to 'release' so I can work on the next section. That is where I discovered the 'dragging' problem.

Larry

Post Reply