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
-
CoffeeCone
- Posts: 64
- Joined: Fri Apr 26, 2013 8:38 am
Post
by CoffeeCone » Sat May 25, 2013 6:43 pm
I have a data grid on the top part of my application and a regular field at the bottom. Between them is a horizontal space of around 10 pixels height. In-between that space, I have placed a graphic that should serve as the "handle" for resizing. However, I can't figure out how to execute it. Does anyone have sample stacks I can copy from?
Here is a screenshot:
The red part is what I want to be draggable up and down in order to resize the data grid and the field accordingly.
Learning LiveCode, one step at a time.
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Sat May 25, 2013 7:48 pm
Hi.
Put this into your graphic script:
on mouseMove
set the loc of me to item 1 of the loc of me & "," & item 2 of the mouseloc
set the rect of fld 1 to the botleft of me & "," & the botRight of fld 1
set the rect of grp 1 to the topleft of grp 1 & "," & the topright of me
end mouseMove
This assumes that references for grp 1 and fld 1 are correct.
But there is a problem with this. You will find it out quickly, and that is a pun. Write back with a either solution or pleas for help.
Craig Newman
-
CoffeeCone
- Posts: 64
- Joined: Fri Apr 26, 2013 8:38 am
Post
by CoffeeCone » Sun May 26, 2013 12:07 am
Here's my rather ugly code that seems to work just the way I wanted it to.
Code: Select all
on mouseDown
set the dragging of me to true
pass mouseDown
end mouseDown
on mouseMove
if the dragging of me then
if (item 2 of the mouseLoc > 150) and (item 2 of the mouseLoc < (the height of this stack - 50)) then
set the loc of me to item 1 of the loc of me & "," & item 2 of the mouseloc
else
if (item 2 of the mouseLoc <= 150) then
set the loc of me to item 1 of the loc of me & ",151"
end if
if (item 2 of the mouseLoc >= (the height of this stack - 50)) then
set the loc of me to item 1 of the loc of me & "," & (the height of this stack - 51)
end if
end if
set the rect of fld "preview" to the botleft of me & "," & the botRight of fld "preview"
set the rect of grp "message list" to the topleft of grp "message list" & "," & the topright of me
end if
end mouseMove
on mouseUp
mouseRelease
end mouseUp
on mouseRelease
set the dragging of me to false
end mouseRelease
Learning LiveCode, one step at a time.