Drag to resize list fields

Russell Martin russell_martin at yahoo.com
Tue Nov 20 21:07:23 EST 2007


Hi. I'm attempting to create an interface where I have two list fields side by side. I would like the user to be able to click in the space between the two lists and then drag left or right to and have the lists widths to be resized.

What I've attempted to do, is to put a tall narrow rectangle in the space between the two fields and then have it respond to the mouseDown and dragMove messages.

They look like this:

on mouseDown
  -- I set the dragdata, because the documentation led me to believe
  -- it was necessary to get the rectangle to respond to dragMove messages
  set the dragdata["text"] to "text being dragged"
  -- the rectangle's width is 10 and so this immediately moves the rectangle
  -- to be centered to the pointer, if the pointer escapes the rectangle, the drag
  -- operation fails
  set the left of me to the mouseH - 5
end mouseDown


on dragMove
  -- again, this centers the rectangle to the pointer
  set the left of me to the mouseH - 5
  -- this resizes the left hand field to be one pixel away from the rectangle
  set the width of field LeftSideField to the mouseH - 6
  -- this gets the left hand field positioned properly again against the left
  -- edge of the window
  set the left of field LeftSideField to 0
  -- then, I set the width of the right hand field and fix it's position
  set the width of field RightSideField to width of this stack - the mouseH - 6
  set the left of field RightSideField to width the mouseH - 6
end dragMove


Now, this mostly works, but not as well as I'd like. If you move the pointer too quickly (which is not hard to do), it will escape from the rectangle and your drag operation will stop and the dragMove messages will start making their way up the message path. Also, even if you drag slowly enough to avoid this, when the window is resized and the fields resize based on their geometry settings, they are no longer within one pixel of the rectangle.

I'm thinking that there has two be a better way to accomplish what I'm trying to do in Revolution. I'm hoping that someone out there will be able to set me straight. Thanks in advance. :-)




      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



More information about the use-livecode mailing list