Getting Started with DataGrid and another datagrid form

zryip theSlug zryip.theslug at gmail.com
Sun Aug 5 13:26:45 EDT 2018


The code you have in the default behavior is the one installed by the
inspector located in one of the behavior button (stack only script now,
since the dg2)

It contains the minimal example code to help the developer starting;
FillinData, preFillinData, LayoutControl, etc

If you are modifying the template for the datagrid (adding a control,
deleting a control, etc) you have to change the code for your datagrid row
manually. By default the minimal script is considering you have a field
"Label" and a "background" graphic. If you are deleting one of them in the
template and you do not update the behavior script for the row accordingly,
the datagrid library will fire an error when it will try to apply the
template to a row. Note that if your are removing the "background" graphic
you will lose the possibility to "hilited" a row, at least on screen.

When you are updating the template in DGH now, it will install first the
default script (like the inspector). If you have done a modification in the
template (especially after having delete one object), DGH can help you by
building the script required for the controls it will find inside the
template. As we want not to erase something in the script which could has
been changed by the developer, the operation is manual.

Ideally to prevent the datagrid library to send an error with missing
controls in the template, you should update the script before to click onto
the "update" button.

On Sun, Aug 5, 2018 at 7:03 PM, Sannyasin Brahmanathaswami via use-livecode
<use-livecode at lists.runrev.com> wrote:

> I slowly studying as much as we can on the datagrid,and "digging" in it
> with an first attempt to build a form.
>
> One thing is not clear to me.
>
> 1) Have the  WYSIG panel to build the datagrid form.
>
> 2) why then do we  have, in the Behavior Script  this handler?
>
> Isn't the layout already pre-determined in the template?
>
> on LayoutControl pControlRect, pWorkingRect
>
> local theFieldRect
>
> -- This message is sent when you should layout your template's controls.
>
> -- This is where you resize the 'Background' graphic, resize fields and
>
> -- position objects.
>
> -- For fixed height data grid forms you can use items 1 through 4 of
> pControlRect as
>
> -- boundaries for laying out your controls.
>
> -- For variable height data grid forms you can use items 1 through 3 of
> pControlRect as
>
> -- boundaries, expanding the height of your control as needed.
>
> -- The working rect is defined area of the control you can safelt use.
>
> -- Use this rect to make sure your controls don't overlap with any edit
> mode controls.
>
> -- Example:
>
> put the rect of field "Label" of me into theFieldRect
>
> put item 1 of pWorkingRect into item 1 of theFieldRect
>
> put item 3 of pWorkingRect - 5 into item 3 of theFieldRect
>
> set the rect of field "Label" of me to theFieldRect
>
> set the rect of graphic "Background" of me to pControlRect
>
> end LayoutControl
>
>
> BR
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Zryip TheSlug
http://www.aslugontheroad.com



More information about the use-livecode mailing list