Interface question

zryip theSlug zryip.theslug at gmail.com
Mon Jan 4 17:24:18 EST 2010


Nicely done Jacque! Thanks for the solution ;)

It inspired me another solution that I've experimented for fun.
It's something combining zoom the size of the text and the Mac/Windows
stack resizer available on the Object Library.
When the user resize the field by drag & drop, the size of the text is
resized too.

I confess that I cheated a little because I take care only here of the
proportion of the field width.
We could imagine add a zoom box to maximize the size of the field and
so the size of the text.

In case of it useful to someone, here is the code:

1) In a button placed on the bottom right of each field

local lMoving, lDistance
constant cFldName="Field" -- Put here the name of the field

on mouseDown
  put true into lMoving
  put the right of fld cFldName - item 1 of the Mouseloc,the bottom of
fld cFldName - item 2 of the MouseLoc into lDistance
end mouseDown

on mouseUp
  put false into lMoving
  unlock cursor
end mouseUp

on mouseRelease
  put false into lMoving
  unlock Cursor
end mouseRelease

on mouseMove
   if lMoving then
      moveAndResizeFld cFldName, lDistance
   end if
end mouseMove

2) In the card script

on moveAndResizeFld pFldName, pDistance
   put item 1 to 2 of the rect of fld pFldName,item 1 of the
Mouseloc+item 1 of pDistance,item 2 of the Mouseloc+item 2 of
pDistance into tRect
   if item 3 of tRect < (the uMinWidth of fld pFldName+the left of fld
pFldName) then put (the uMinWidth of fld pFldName+the left of fld
pFldName) into item 3 of tRect
   if item 4 of tRect < (the uMinHeight of fld pFldName+the top of fld
pFldName) then put (the uMinHeight of fld pFldName+the top of fld
pFldName) into item 4 of tRect
   if item 3 of tRect > (the uMaxWidth of fld pFldName+the left of fld
pFldName) then put (the uMaxWidth of fld pFldName+the left of fld
pFldName) into item 3 of tRect
   if item 4 of tRect > (the uMaxHeight of fld pFldName+the top of fld
pFldName) then put (the uMaxHeight of fld pFldName+the top of fld
pFldName) into item 4 of tRect
   lock screen
   set the rect of fld pFldName to tRect
   set the bottomRight of the target to bottomRight of fld pFldName

   get (width of fld pFldName / the uMinWidth of fld pFldName)

   set the textsize of fld pFldName to the round of (the uTextSize of
fld pFldName * it)
   set the textheight of fld pFldName to the round of (the uTextheight
of fld pFldName * it)

   unlock screen
end moveAndResizeFld

It's just a quick adaptation of the Mac/Windows stack resizer
available in the Revolution's Object Library but it doing the job;)
Note that I've used the custom properties for emulate min and max size
of the field. Plus I've transposed the screenMouseLoc which works well
for a stack by the mouseLoc property which works better for managing
objects in a card.


-Zryip TheSlug- wish you the best! 8)

2010/1/3 J. Landman Gay <jacque at hyperactivesw.com>:
> I got lots of good answers here but they all involved some kind of second
> field, which I wasn't keen on. Someone had suggested a magnifying glass
> effect, but that doesn't allow easy editing. It did give me an idea though.
> The upshoot is that we decided to implement a dynamically resizing field,
> which for our situation works pretty well.



More information about the use-livecode mailing list