Proportional table column spacing upon resizeStack - how to

mfstuart mfstuart at cox.net
Tue Mar 18 11:35:46 EDT 2008


Merci Eric, that worked.
Now I'll play around with that script to resize the columns, but the first
column.
Then change it so that the right most columns' right border always is at the
right most position of the field.

Regards,
Mark Stuart



Eric Chatonet wrote:
> 
> 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/
> ----------------------------------------------------------------
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: http://www.nabble.com/Proportional-table-column-spacing-upon-resizeStack---how-to-tp16096272p16123321.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the Use-livecode mailing list