Text field with classic cursor

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Text field with classic cursor

Post by croivo » Tue Feb 16, 2016 12:08 am

Hello,
Is there any way to get rid of this cursor when part of the text is selected inside text field?
WP_20160215_23_54_51_Pro.png
Cursor
WP_20160215_23_54_51_Pro.png (130.64 KiB) Viewed 4144 times
If you accidentaly drag, the whole text will mess up. I couldn't find any option how to disable this feature.

Thank you...

PS. I took photo with camera because cursor isn't visible on screenshot :)

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

Re: Text field with classic cursor

Post by dunbarx » Tue Feb 16, 2016 3:01 am

Hi.

I am on a Mac. You are talking about the cursor that appears when the, er, cursor is over the selectedText? Mine looks different, and, since I am on a Mac, not so much like demons have taken over that object.

But this is simple, because anything can be done with LC. Put this in the field script:

Code: Select all

on mouseMove
   if the mouseLoc is within the rect of me then
      lock cursor
      set the cursor to arrow
   else
      unlock cursor
   end if
end mouseMove
Now the cursor will not change when it enters the selected area. But it also will not show as a standard text selection cursor when in the UNSELECTED area of the field. Now for the fun part. The "selectedLoc" is a native function. Check the dictionary. This can be exploited to derive the dimensions of the "selectiedRect" (a function that I just made up). The point being that you might want to write a handler that changes the cursor only when it is within that selected (colored) region.

Get going. Write back if you get stuck..

Craig Newman

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

Re: Text field with classic cursor

Post by dunbarx » Tue Feb 16, 2016 6:51 pm

Hi again.

That the strange cursor you are trying to squash is indeed an indicator that a drag and drop operation is available. The gadget I made will not change that behavior.

But it got me to thinking. When you say "accidentally drag...", it is not easy to do that. The drag has to enter a valid "drop" object, like another field, in order to execute. Do you often accidentally drag that far? In other words, are you trying to get rid of the cursor, or prevent dragging at all?

Craig

croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Re: Text field with classic cursor

Post by croivo » Thu Feb 18, 2016 1:46 am

Prevent dragging at all.
I'm working with a lot of text fields next to each other... I mean, I don't drag text always, but it would be much nicer if there isn't dragging feature.

Thank you for your reply.

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

Re: Text field with classic cursor

Post by dunbarx » Thu Feb 18, 2016 2:22 am

Oh.

Just trap the 'dragStart" message. Two lines.

Craig

croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Re: Text field with classic cursor

Post by croivo » Fri Feb 19, 2016 11:28 pm

Thanks a lot :)

Post Reply