Gregory Lypny wrote:
Hello Everyone,

I'd like to learn more about scripting interface objects and I was wondering whether anyone has a script for one of those sliding divider-resizing things like the one in Apple's Mail app that lets you increase the size of the message list on top while decreasing the size of the active message below. I started dabbling with it, and created a long, skinny button to be used as the divider. The first bit of my script was to change the cursor, but embarrassingly, I ran into a wall because the following does nothing except cause the default cursor to flicker rapidly.

on mouseEnter
    set the cursor to hand
end mouseEnter

The mouseWithin handler did nothing either.

Any hints would be most appreciated.

Gregory

Hi Gregory,

Here's something I used in a recent project. The adjustor object is a button, and it keeps the bottom of the "top" field a consistent distance from the "bottom" field while allowing you to move the boundary between them vertically.

Other facts:
- The button height = (top of "bottom" fld) - (bottom of "top" field)
- the button is in a group, referred to as "the owner of the target".
- the button has "uTopBounds" and "uBottomBounds" custom props telling how close (in pixels) it can get to the top of the top field & the bottom of the bottom field.


-- "adjustor" button script:
on mouseDown
 -- params are <shortNameOfUpperField>,<shortNameOfLowerField>
 _resizeFields "editItem","editItemDescription"
end mouseDown


-- handler in card script:
on _resizeFields pTopField,pBottomField
  -- prep
  get the loc of the target
  put item 1 of it into tMyH
put (item 2 of the loc of the owner of the target - item 2 of it) into tOffsetV
  put the rect of fld pTopField into tTopRect
  put item 2 of tTopRect + (the uTopBounds of the target) into tTopBounds
  put the rect of fld pBottomField into tBottomRect
put item 4 of tBottomRect - (the uBottomBounds of the target) into tBottomBounds repeat until the mouse is up
     put the mouseV into tMouseV
if (tMouseV < tTopBounds) or (tMouseV > tBottomBounds) then next repeat
     lock screen
     set the loc of the owner of the target to (tMyH,tMouseV+tOffsetV)
     put the top of the owner of the target into item 4 of tTopRect
     put the bottom of the owner of the target into item 2 of tBottomRect
     set the rect of fld pTopField to tTopRect
     set the rect of fld pBottomField to tBottomRect
-- reposition bottom field label if there is one
     get (pBottomField && "label")
     if there is a field it then
        set the top of fld it to the top of fld pBottomField
     end if
     unlock screen
     wait 0 secs
  end repeat
end _resizeFields


Hopefully this will get you started.
--
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to