Hiding Pointer Tool Drag Boxes

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Cyclonex
Posts: 14
Joined: Mon Oct 27, 2014 6:56 pm

Hiding Pointer Tool Drag Boxes

Post by Cyclonex » Sat Aug 29, 2015 3:54 am

Hi, I was wondering if there is a way to hide the 8 grey boxes that pop up when you select an object with the pointer tool? I still want to be able to move objects / change height/width of objects, just don't want the selection boxes visible. Thanks

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

Re: Hiding Pointer Tool Drag Boxes

Post by dunbarx » Sat Aug 29, 2015 5:46 am

Hi.

When you select an object the resize handles appear. This is native to LC.

But you asked a different question, and perhaps did not realize it. You do not need to select an object to move it. For example on a new card make a few buttons. Try this in the card script:

Code: Select all

on mouseMove
   if the mouseLoc is within the rect of btn 1 and the mouse is down then set the loc of btn 1 to the mouseLoc
end mouseMove
Now you can click and drag the first button.

Similarly, you could resize a control by fine tuning the mouseLoc where it resides in various portions of a control.And you can kluge any number of other methods to change the rect of a control, perhaps with sliders or whatever. But this is getting inelegant.

So why do you dislike those handles? And what exactly do you want to do that would make all this extra work worthwhile?

Craig Newman

Cyclonex
Posts: 14
Joined: Mon Oct 27, 2014 6:56 pm

Re: Hiding Pointer Tool Drag Boxes

Post by Cyclonex » Sat Aug 29, 2015 4:29 pm

Hi Craig, so the reason I would like to hide the boxes is I've tried an inelegant method, but I ran into a very evident delay -- I believe this delay comes from resizing the width / height of the object and then moving it... I'm not sure though. I attached a stack, it's a graphical music interface, similar to that of Garage Band. Each note can be moved by grabbing the middle of it, and it can be extended by grabbing the side and dragging out (code is contained in each note).

If the boxes of the pointer can't be hidden, my question is how can I simulate the livecode pointer? So far I've only been able to match the pointer tool's extending speed by actually using the pointer tool. (attached a second stack which automatically changes to the pointer tool when you float over a music note {glitches when you hit boundaries which isn't an issue, haven't fixed that yet})

Let me know if any of that isn't clear, thanks for the help!
Attachments
Pointer Tool.zip
(25.14 KiB) Downloaded 216 times

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

Re: Hiding Pointer Tool Drag Boxes

Post by dunbarx » Sat Aug 29, 2015 8:05 pm

I had much trouble using your stack. There are syntax errors.

Anyway, on a new card, make a button. In the card script:

Code: Select all

on mouseMove
   if abs(item 2 of the mouseLoc - the bottom of btn 1) < 10 then
      set  the rect of btn 1 to item 1 of the rect of btn 1 & "," & item 2 of the rect of btn 1 & "," & item 1 of the mouseLoc & "," & item 2 of the mouseLoc
   end if
end mouseMove
Now this is wordy to the extreme. And it needs to be made far more robust so that you can manage not only the other quadrants and sides, but other controls as well. That is a wonderful exercise. Exercise, that is, for you.

So does this seem useful to you? By the way, the only way to get out of having that button track the mouseLoc is to race away from it. That is another little task for you...

Craig
Last edited by dunbarx on Sat Aug 29, 2015 10:14 pm, edited 2 times in total.

Cyclonex
Posts: 14
Joined: Mon Oct 27, 2014 6:56 pm

Re: Hiding Pointer Tool Drag Boxes

Post by Cyclonex » Sat Aug 29, 2015 9:51 pm

Awesome!! I am confident this should work and will post a status update in a few days.

Thanks Craig.

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

Re: Hiding Pointer Tool Drag Boxes

Post by dunbarx » Sat Aug 29, 2015 10:19 pm

I meant to give you a better case, that detected the botRight of the control, and not just the bottom.

Code: Select all

on mouseMove
   if abs(item 2 of the mouseLoc - the bottom of btn 1) < 10  and  abs(item 1 of the mouseLoc - the right of btn 1) < 10 then
      set  the rect of btn 1 to item 1 of the rect of btn 1 & "," & item 2 of the rect of btn 1 & "," & item 1 of the mouseLoc & "," & item 2 of the mouseLoc
   end if
end mouseMove
This may already have been obvious to you. If not, use the above to get started. There is much adorable cleverness required to make this sort of thing more universal without using explicit code sections for each portion of the control. But write back with your progress.

Craig

Post Reply