Datagrid Question

Marty Knapp martyknapp at comcast.net
Tue Sep 20 14:22:31 EDT 2011


That seems to work great Pete. I've now lost the right alignment of the 
column - it's reverted back to left. I see that there's a 
dgColumnAlignment but I'm not figuring out how to make that work. The 
setting in the property inspector is ignored . . .

Marty
> Hi Marty,
> Just posted a more specific way to do this using the LayoutControl handler
> of the datagrid's custom behavior.  If you're not familiar with setting up
> custom behaviors:
>
> - go to the Columns tab of the inspector for the datagrid
> - highlight your column 4
> - click the plus sign at the bottom of the inspector tab
> - close the resulting stack window without making any changes
> - back in the inspector, make sure your column 4 is still highlighted then
> click the "Custom Behavior" button to open the script
>
> I'm not entirely convinced LayoutControl is the best place for the code but
> I can't find any reference to a message that is sent when a datagrid column
> is resized.
>
> Hope that makes it more clear
>
> Pete
> Molly's Revenge<http://www.mollysrevenge.com>
>
>
>
>
> On Tue, Sep 20, 2011 at 9:50 AM, Marty Knapp<martyknapp at comcast.net>  wrote:
>
>> Thanks Pete,
>> I have very limited experience with datagrids. What message is sent when
>> the user resizes a column? Where in the datagrid would I place my script -
>> in the group script?
>>
>> Thanks,
>> Mart K
>>
>>> Hi Marty,
>>> Best I can think of is to get the dgProps["column widths"] property of the
>>> datagrid.  It contains a comma-delimited list of the widths of the columns
>>> so by adding up the first 3 items of the list, you'll get the left edge of
>>> the 4th column, and adding the first 4 items of that list, you'll get the
>>> right edge of the 4th column, both relative to the left edge of the
>>> datagrid.  From that you can figure out thew width and placement of your
>>> field. I don't know if the width includes the separator line between the
>>> columns.
>>> Pete
>>> Molly's Revenge<http://www.**mollysrevenge.com<http://www.mollysrevenge.com>
>>>
>>>
>>>
>>>
>>> On Mon, Sep 19, 2011 at 8:22 PM, Marty Knapp<martyknapp at comcast.net>
>>>   wrote:
>>>
>>>   I have a datagrid with several columns, column 4 of which contains a
>>>> number. Under the datagrid I have placed a field that keeps a total of
>>>> the
>>>> values in this column. I would like this field to match the width of
>>>> column
>>>> 4 and align itself directly under it so that if a user changes the column
>>>> width, my total field will realign itself with the width and placement of
>>>> the column. How would I go about doing this?
>>>>
>>>> Thanks,
>>>> Marty Knapp
>>>>
>>>>




More information about the use-livecode mailing list