Best practice for creating a resizable HUD-style widget stack background?

Jim Lambert jiml at netrin.com
Wed Mar 16 19:40:22 EDT 2011


List, Sorry if this comes thru twice.
JimL

ScottR wrote:

> For round-rect windows, you need create the mask as nine separate objects,
> scaling top/sides appropriately, and generating the mask from that.  I've
> done it, and as I mentioned, it works best when you have fixed sizes you
> expand or collapse to, not with a drag-to-resize behavior

You can also generate a rounded appearance with just one object.

1 - create a rounded rectangle graphic with the corner radii you want, say 30.
2 - name it "myMask"
3 - make it opaque & invisible
4 - set its rect to the card's rect
5 - set its geometry to scale with the window
6 - put this script in the card:

command maskMe
   import snapshot from grc "myMask"
   set the windowshape of this stack to the id of last image
   delete last image
end maskMe


> a window that a user can
> drag-to-resize is out of the question because you'd have to generate a mask
> image each step of the way during the drag and redraw the window repeatedly.

True.

If you are willing to subject your users to some non-standard funkiness you can set the windowshape to 0 while they liveresize then use the above to make a rounded windowshape at whatever rect they end up with.

Jim Lambert



More information about the use-livecode mailing list