Page 1 of 1

How do I make a horizontal line that also acts as a resizer?

Posted: Sat May 25, 2013 6:43 pm
by CoffeeCone
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:
Image

The red part is what I want to be draggable up and down in order to resize the data grid and the field accordingly.

Re: How do I make a horizontal line that also acts as a resi

Posted: Sat May 25, 2013 7:48 pm
by dunbarx
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

Re: How do I make a horizontal line that also acts as a resi

Posted: Sun May 26, 2013 12:07 am
by CoffeeCone
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