Mac OS X splittable window?

Mark Wieder mwieder at ahsoftware.net
Wed Sep 15 14:05:51 EDT 2004


Frank-

Wednesday, September 15, 2004, 8:59:20 AM, you wrote:

FL> Has anyone been able to make a splittable window in RunRev?  I'm

Splitter buttons are fairly easy to implement. Here's a snippet from
my upcoming Stack Analyzer:

This will split two fields horizontally. Place this script into a
splitter button between the two fields. Copy the grab cursor into your
stack and either give it id 1234 or change the constant declaration.

----

constant kNormalCursor=8
constant kGrabCursor=1234
constant kMargin=20
-- these are the names of the two fields to split
constant kRightLimit="globals" -- field to the right of the splitter
constant kLeftLimit="constants" -- field to the left

on mouseMove theX,theY
  local theLoc, lineGlobal, lineLocal, maxX
  local strMyLabel
  local theRect
  
  if the defaultCursor is not kGrabCursor then
    set the defaultCursor to kGrabCursor
  end if
   
  if the mouse is down then
     
    lock screen
     
    if theX < the left of field kLeftLimit + kMargin then
      put the left of field kLeftLimit + kMargin into theX
    end if
    if theX > the right of field kRightLimit - kMargin then
      put the right of field kRightLimit - kMargin into theX
    end if
    
    -- save the current highlighting
    put the hilitedLine of field kRightLimit into lineGlobal
    put the hilitedLine of field kLeftLimit into lineLocal
    
    put the loc of me into theLoc
    put theX into item 1 of theLoc
    set the loc of me to theLoc
    set the height of me to the height of field kLeftLimit
     
    put the rect of field kLeftLimit into theRect
    put the left of me into item 3 of theRect
    set the rect of field kLeftLimit to theRect
     
    put the rect of field kRightLimit into theRect
    put the right of me into item 1 of theRect
    set the rect of field kRightLimit to theRect
    
    -- move the label if desired:
    -- I have labels that move with the fields -
    -- you may not need this.
    put "field lbl" & kRightLimit into strMyLabel
    set the left of strMyLabel to the right of me
     
    -- restore the highlighting
    set the hilitedLine of field kRightLimit to lineGlobal
    set the hilitedLine of field kLeftLimit to lineLocal
    
    unlock screen
     
  end if
   
end mouseMove

on mouseLeave
  if the defaultCursor is not kNormalCursor then
    set the defaultCursor to kNormalCursor
  end if
end mouseLeave

on mouseEnter
  if the defaultCursor is not kGrabCursor then
    set the defaultCursor to kGrabCursor
  end if
end mouseEnter

-- Have fun.

-- 
-Mark Wieder
 mwieder at ahsoftware.net



More information about the use-livecode mailing list