To adjust the width of a field, you need to set its rect directly - fields
won't respond to "set the width"-type calls. You'll need to get the
difference between the mouseH and the locH of the field, and then set the
field's rect to rect(0,0,theNewWidth, member(theField).height). For example
(untested):

-----------
property pFieldSprite
property pFieldlocH

on mSetFieldInfo me, myfield, fieldLocH
  pField = myfield
  pFieldHeight = member(pField).height
  pFieldlocH = fieldLocH
end


on mouseDown me
  sprite(me.spriteNum).moveableSprite = TRUE
  box1 = 7  -- I only hardcoded this for experiment purposes
  repeat while the stillDown
    sprite(me.spriteNum).locH = the mouseH
      newLoc = the mouseH - fieldLocH
      if newLoc > 0 then
        sprite(pField).rect = rect(0,0,newLoc,pFieldHeight)
      end if
    updateStage
    end repeat
  sprite(me.spriteNum).moveableSprite = FALSE
end

---------

the "on mSetFieldInfo" handler could be replaced with a GPDL, but I tend to
attach behaviors on the fly.

HTH,
Kurt

> Hello list,
> I'm trying to make a group of vertically stacked fields change their
> widths according to how far the user clicks and drags the bar that covers
> their left side (like for width of cells in spreadsheet programs).  I don't
> want them to be able to resize them from the right.  I had no problem coming
> up with the lingo for moving the bar left and right, but when I tried to tie
> in the field, I got lost.  The best I could do was to have the entire field
> move with the bar... I couldn't get the right side of it to remain in it's
> inital location.  Here's the code I'm using right now (try not to laugh):
> 
> on mouseDown me
> sprite(me.spriteNum).moveableSprite = TRUE
> box1 = 7  -- I only hardcoded this for experiment purposes
> repeat while the stillDown
> sprite(me.spriteNum).locH = the mouseH
> sprite(box1).left = the mouseH
> updateStage
> end repeat
> sprite(me.spriteNum).moveableSprite = FALSE
> end
> 
> Any thoughts would be greatly appreciated.
> 
> Thanks,
> Eric Reynertson


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to