Datagrid Question

zryip theSlug zryip.theslug at
Wed Sep 21 16:19:33 EDT 2011

On Wed, Sep 21, 2011 at 12:20 AM, Pete <pete at> wrote:

Hi Pete,

> Thanks for explanation.  So if I have set a column to be non-editable and I
> create a custom behavior for it, it will become editable?  How about if the
> datagrid itself has been set to be non-editable?  Just trying to get a
> handle on this since I couldn't find anything in the datagrid docs about it.

If you have a field in your column template, it will be non-editable
because of the code inside the mouseDoubleUp handler:

on mouseDoubleUp pMouseBtnNum
    if pMouseBtnNum is 1 then
        if word 1 of the target is "field" then
            if the dgProps["allow editing"] of the dgControl of me \
                    and the dgColumnIsEditable[the dgColumn of me] of
the dgControl of me then
                EditCellOfIndex the dgColumn of me, the dgIndex of me
                exit mouseDoubleUp
            end if
        end if
    end if

    pass mouseDoubleUp
end mouseDoubleUp

However, if you have a control such as a button or a menu button in
your column template, one could click on the button for getting an
action or selecting a menu. In this case the non-editable property is
not applied.

For a field you have nothing to do to keep it non-editable accordingly
of the dgColumnIsEditable property.
For a different control, you have to code how the control will be non-editable.

> Maybe it's the way I use datagrids but I can't think of a single situation I
> have come across where I did not want a column containing a field to be
> aligned according to its column alignment.  In fact, I have option menus and
> checkboxes that I really want to be aligned according to the column's
> alignment property and ended up writing code to make that happen.  In other
> words, at least for me, ignoring the column alignment property should be the
> exception, not the rule.

The developer has full freedom to manage how controls will be aligned
depending of the template content. A column template, could contain
one or more controls, and a developer would probably have them
centered differently than other developers. Have something following a
rule will satisfy some of them and give limits to others, as it
depends on how the developer want to place the controls in his
Have the content of the default field aligned, is the normal behavior.
As soon as, the column is customized, it loses the default heritage
and the developer has to manage what he wants for the column.

Best regards,
-Zryip TheSlug- wish you the best! 8)

More information about the Use-livecode mailing list