Tutorial explanation object lib for creating a multiplatform splitter?

J. Landman Gay jacque at hyperactivesw.com
Mon May 10 17:13:16 CDT 2004

On 5/10/04 12:58 PM, Kevin wrote:

> My definition follows a more "windows" slighted definition.  When one
> uses the file explorer the right border of the folder listed tree
> control is a splitter it splits and allows resizeing of the folder
> listing.

There's no pre-made control that does this but they are trivial to 
write. You can either place a narrow button where you want the splitter 
to go, or you can just track the mouse position without using a control. 
When the mouse goes down, get the rect of the field on the left and the 
field on the right. Set the right edge of the left-hand field to the 
mouseH and the left edge of the right-hand field to the same mouseH. 
That's it.

For example (this assumes a narrow, transparent button between the fields):

-- note: untested, but should basically work

on mouseDown -- script of the narrow button
end mouseDown

on mouseUp
end mouseUp

on mouseRelease
end mouseRelease

on doSplitter
  put item 1 of the loc of me into theH
  get the rect of fld theLeftFld
  put theH into item 3 of it
  set the rect of fld theLeftFld to it
  get the rect of fld theRightFld
  put theH into item 1 of it
  set the rect of fld theRightFld to it
  set the loc of me to it,item 2 of the loc of me
  send "doSplitter" to me in 100 milliseconds -- adjust as needed
end doSplitter

on stopSplitter
  repeat for each line L in the pendingMessages
   if L contains "doSplitter" then cancel (item 2 of L)
  end repeat
end stopSplitter

If you don't want to use the transparent button, then just check the x 
position of the mouse on mouseMove and calculate whether you should 
start the splitter or not. (That's usually how I do it, it avoids an 
extra control.)
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

More information about the use-livecode mailing list