Using a group's handles to resize controls within group

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 148
Joined: Thu Jun 29, 2006 4:16 pm

Re: Using a group's handles to resize controls within group

Post by Randy Hengst » Mon Apr 28, 2014 2:33 am

Hello Tom and Bernd,

I've been playing around with this idea by using a 2009 stack of Bernd's from the LiveCode site.

I can't figure out how to add a handle to the bottom left of the group. I've attached my effort. The bottom right handle works, because it's essentially Bernd's… with only chaning the width. The bottom left image does change the size of the group, but it goes the opposite way the mouse moves… any thoughts as to what I've missed would be appreicated. I assume it's something obvious to the trained eye, but I can't see it.

Thanks for any hlep you can provide.

be well,
randy
Attachments
ResizeHandles.rev.zip
(3.83 KiB) Downloaded 90 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3478
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Using a group's handles to resize controls within group

Post by bn » Mon Apr 28, 2014 11:08 am

Hi Randy,

manipulating the left side is a bit tricky since moving left with the mouse decreases the x value but increases the width. Now I refer to the right side of the graphic and do the math.

Additionally I added code to avoid that the user can drag the border of the control off the left or right border of the card.

Funny to see old code. Today I would use a slightly different naming convention for script local variables (prepending them with "s" and would probably terminate the send in time in a mouseUp / mouseRelease handler but the current code works and I did not change that.
And I would refer to the graphic by name (graphic "SumSelectCoverRect" of the owner of me) to avoid confusion in case you add another graphic and change the layer.

Kind regards
Bernd
Attachments
DragHandles_0_1BN.livecode.zip
(4.01 KiB) Downloaded 112 times

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 148
Joined: Thu Jun 29, 2006 4:16 pm

Re: Using a group's handles to resize controls within group

Post by Randy Hengst » Mon Apr 28, 2014 1:55 pm

Well Bernd, that's impressive. Thank you very much for sharing your code and talent.

be well,
randy

Post Reply

Return to “Talking LiveCode”