Proportional table column spacing upon resizeStack - how to

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Mar 17 12:51:19 EDT 2008


Hi Mark,

As the engine sends four params (see below) with the resizestack  
message, it's quite easy to use them to achieve the goal:

on resizestack pNewWidth,pNewHeight,pOldWidth,pOldHeight
   local tRect,tTabStops,tTabStop,tNewTabStops
   -----
   put the rect of fld "Table" into tRect
   put pNewWidth - 4 into item 3 of tRect
   -- -4: you'll use an appropriate value depending on your context
   set the rect of fld "Table" to tRect -- resizes the field
   ------
   put the tabStops of fld "Table" into tTabStops
   repeat for each item tTabStop in tTabStops
     put round(tTabStop * (pNewWidth / pOldWidth)) & comma after  
tNewTabStops
     -- a value in pixels (integers) according to the ratio between  
pNewWidth and pOldWidth
   end repeat
   delete last char of tNewTabStops -- comma
   set the tabStops of fld "Table" to tNewTabStops
end resizestack

See tabStops in the docs :-)

Best regards from Paris,
Eric Chatonet.

Le 17 mars 08 à 17:35, mfstuart a écrit :

> Hi All,
>
> I'm trying to apply this to my project, where I'm using a table  
> field object
> to display data with several columns.
>
> What I'd like to do:
> Upon the user resizing the stack (the width in this case), I would  
> like to
> resize the table columns proportionally. The table object is currently
> resized in the stacks "on resizeStack" script.
> So this would involve adjusting each item in the tabStops of the table
> field, during the resizeStack script.
>
> How do I do this?
>
> TIA,
> Mark Stuart

----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list