Re: Getting Started with DataGrid and another datagrid form

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode

The more you understand a task, the more versatile and appropriate any given tool becomes.

I think the biggest struggle for me is finding examples which are "close" to my own goal.  I have no problem reverse engineering code... I've done it for a very long time.  But unless the outcome closely approximates my need, such an exercise can be frustrating.  In addition LC (which I very much like) has its own quirks regarding datagrids which are VERY confusing to the datagrid newbie... see my most recent issue with scrolling, for example.

To provide a more effective and cumulative wishlist of suggestions, expectations and content, I really need to go back and (re-)employ your tool with my (now) somewhat fuller understanding of how to define and manipulate datagrids.

I will do so in the near future and get back to you.  I suspect that one just has to have a certain amount of base-level understanding of the datagrid components and behaviours in order to use datagrids.  It's the old boot-strap problem.



> Subject: Re: Getting Started with DataGrid and another datagrid form
> question
>
> Dear Douglas,
>
> Thanks for your interesting feedback about your attempt to use DGH for the
> first time, with creating a datagrid form.
>
> All the properties for customizing the datagrid apart, I've created the
> form template area (the way to custom the content of a row with controls
> such as image, buttons, etc) with the following objectives:
> - in the standard way to customize a datagrid template, we have to open the
> row template group inside the template card. In DGH all this group is
> copied inside a "visual" area we can manipulate
> - when dropping some controls in the template area, with the datagrid, you
> are alone with the required script for managing all these controls. DGH, at
> the condition to respond to the right dialog, is building a minimal script
> depending of the kind of controls you added. Unfortunately this is
> difficult to cover all the needs, because they are all specific depending
> of the developer and what he want to do. But at least the goal of the
> installed script is to give you the keys and philosophy to understand what
> it is required for the controls.For a button, how to perform an action, for
> a checkbox, how to check or uncheck it, for an image how to display it, to
> click it, etc
> - one of the recurrent difficulties for users was to understand the
> datagrid rows remains empty until you have populate it. And because it is
> empty you will never see the beautiful button or image you have added if
> you have not at least a row data. This is why in DGH, upper the template
> area, we have a datagrid preview, to see immediately the control we have
> added.
>
> Your comment make me realize that it is not enough when you are beginning
> with form template. One of my unexploited idea was to add kind of presets
> template with for example a text on the left and four checkboxes on the
> right, etc so the developper could start with ready to use templates to add
> to his datagrid. The problem of the approach is covering needs, I can't
> anticipate.
>
> What might have you expected from DGH in this task? More tutorial
> explaining how the template area is working?, more lessons?, contextual
> help in DGH to help you to start? Something else? Feel free to expand, I'm
> always interested in approachs or ways I could try to implement in the goal
> to improve DGH.
>
>

Douglas Ruisaard
Trilogy Software
(250) 573-3935




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
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
<[hidden email]> 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
> [hidden email]
> 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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
In reply to this post by Knapp Martin via use-livecode
Ah ... I think I can answer this.  Basically, you don't *have* to code the "Layout Control" beyond the recommended:

  set the rect of graphic "Background" of me to pControlRect

and even that may be, technically, optional.

The handler is there (I believe) as a method by which you can "dynamically" change the layout of a row (using grid FORMS.. the Behavior script is NOT used for TABLE grids) and/or being able to programmatically alter the layout of a row without going through the whole "Edit Group" method.

Not sure what you mean or asking about the "WYSIG panel" (never seen "WYSIG" .. only know "WYSIWYG" ... same thing?) ... do you mean the Row Template?

Douglas Ruisaard
Trilogy Software
(250) 573-3935

> From: Sannyasin Brahmanathaswami <[hidden email]>
> To: How to use LiveCode <[hidden email]>
> Subject: Re: Getting Started with DataGrid and another datagrid form
> Message-ID:
> <[hidden email]>
>
> Content-Type: text/plain; charset="us-ascii"
>
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
In reply to this post by Knapp Martin via use-livecode
Aloha zryip

I finally figured out that a row has the behavior script that "requires attention"

I have yet to try in dghelper.

FillInData etc. obviously need controls named according to your grid

But I still have the question:

The WSIWYG template has the control "where we want them"

But is the LayOutControl handler doing? Is it needed?

Oh by the way. you need to have a button that

set the relayerGroupedControls to true

In the form builder, otherwise you can't push an object "back"




On 8/5/18 7:26 AM, zryip theSlug via use-livecode wrote:

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.








_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
Doug

   WSIWYG:  I was referring to the row temple "build" screen.

... layout handler. I want to understand it...

maybe studying the on-line lessons *before* asking questions

Someone should do a graphic or schema diagram of the DG message hierarchy.

BR



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
Duh!

http://lessons.livecode.com/m/datagrid/l/7305-example-creating-a-list-of-people

on LayoutControl does seem to be required.

So the row template is not WSIWYG?

Sannyasin Brahmanathaswami via use-livecode wrote:

> Doug
>
>    WSIWYG:  I was referring to the row temple "build" screen.
>
> ... layout handler. I want to understand it...
>
> maybe studying the on-line lessons *before* asking questions
>
> Someone should do a graphic or schema diagram of the DG message hierarchy.
>
> BR


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
I am at the lesson.livecode.com/m/datagrid.

They are quite thorough. Much to my chagrin, everything you need to know
is there.

 I would NOT recommend just dragging a Datagrip and "digging in" are
even using DG Helper (to start)

Read the lessons first (or at same time as you follow along in a stack.)

BR










_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
In reply to this post by Knapp Martin via use-livecode
Yay! I made my first form.

Now for questions *not* covered by the lessons.

1) Is the graphic "Background" a special object? In Navigator I opened
stack

"Data Grid Temple 33333333333"
 
directly  editing the group "Row Template". I set background graphic to
roundedRectangle, corners set 20px, and applied a linear gradiant with
nice colors. I saved the stack.

But the graphic did not change?  I *can* adjust its rect, and the
rounded corners show (appears on hilite, the it is tranparent otherwise)
and that sticks, but not linear gradient?

2) How do I make the datagrid transparent (opacity to 0).  So that
between the rows there is a margin which shows the background of the
card coming through.

BR
 



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
In reply to this post by Knapp Martin via use-livecode
The template is like the group editor. In fact it may actually BE the group editor. The behavior script determines what to do when a row is drawn.

I think the thing to understand about datagrids, table or forms, is that for each array element in the data (itself an array) the template is "cloned". Each row is a "clone" of the template. But for forms, the behavior does not know what you want to do when the rows are created. For instance, you may want to color negative numbers in red, or surround them with parenthesis. You may have a button that needs to be hilited or not depending on the value for that control. Perhaps you have a field that can contain multiple lines of text, and you need to set the row height for each row based upon the formattedHeight of that field. Or maybe show and hide objects etc.

The beauty of a form datagrid is that how each individual row gets drawn is entirely under your own programmatical control. A table datagrid is simply like a spreadsheet with fixed row heights and no support for graphics or other controls.

BTW I kinda cheated and made a way to have checkboxes for a table style datagrid. I simply had a group with checkboxes overlaying a "dummy" column in the datagrid. When I queried for data I put something like:

SELECT '' AS checkmark, '' AS checkmarkvalue, * FROM customers

This put two empty strings in my array data (I use sqlYoga so I get arrays back instead of cursors, but the idea is the same). I only defined a column for "checkmark", but NOT for "checkmarkvalue". This allowed me to have a blank column to overlay the checkboxes on, and a hidden column to hold the checkmarkvalue for each row in the datagrid data.

Then when I populated the datagrid, I hid all the checkboxes then showed each checkbox control based upon how much data was being displayed. Of course, you have to account for scrolling, so that can be tricky, but it was a poor man's way of adding checkboxes to a table datagrid. Others could probably come up with a more elegant solution.

Bob S


> On Aug 5, 2018, at 10:03 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> 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?


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
Bob,

A column template exists for each column of a dg table, so you can use any
control you want inside a datagrid column, including widgets.

Here is a link to a DGH's screenshot . On the left, we have properties for
a column (row or header). This is a datagrid table with two visible
columns. The second column is displaying checkboxes, text, popup menus,
images, widgets, etc depending of the property type. This is not a trick,
this is perfectly supported by datagrid tables.

https://livecode.com/wp-content/uploads/2018/06/image14-26.png

On Mon, Aug 6, 2018 at 6:22 PM, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> The template is like the group editor. In fact it may actually BE the
> group editor. The behavior script determines what to do when a row is
> drawn.
>
> I think the thing to understand about datagrids, table or forms, is that
> for each array element in the data (itself an array) the template is
> "cloned". Each row is a "clone" of the template. But for forms, the
> behavior does not know what you want to do when the rows are created. For
> instance, you may want to color negative numbers in red, or surround them
> with parenthesis. You may have a button that needs to be hilited or not
> depending on the value for that control. Perhaps you have a field that can
> contain multiple lines of text, and you need to set the row height for each
> row based upon the formattedHeight of that field. Or maybe show and hide
> objects etc.
>
> The beauty of a form datagrid is that how each individual row gets drawn
> is entirely under your own programmatical control. A table datagrid is
> simply like a spreadsheet with fixed row heights and no support for
> graphics or other controls.
>
> BTW I kinda cheated and made a way to have checkboxes for a table style
> datagrid. I simply had a group with checkboxes overlaying a "dummy" column
> in the datagrid. When I queried for data I put something like:
>
> SELECT '' AS checkmark, '' AS checkmarkvalue, * FROM customers
>
> This put two empty strings in my array data (I use sqlYoga so I get arrays
> back instead of cursors, but the idea is the same). I only defined a column
> for "checkmark", but NOT for "checkmarkvalue". This allowed me to have a
> blank column to overlay the checkboxes on, and a hidden column to hold the
> checkmarkvalue for each row in the datagrid data.
>
> Then when I populated the datagrid, I hid all the checkboxes then showed
> each checkbox control based upon how much data was being displayed. Of
> course, you have to account for scrolling, so that can be tricky, but it
> was a poor man's way of adding checkboxes to a table datagrid. Others could
> probably come up with a more elegant solution.
>
> Bob S
>
>
> > On Aug 5, 2018, at 10:03 , Sannyasin Brahmanathaswami via use-livecode <
> [hidden email]> 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?
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
On 8/6/18 7:29 AM, zryip theSlug via use-livecode wrote:

> Bob,
>
> A column template exists for each column of a dg table, so you can use any
> control you want inside a datagrid column, including widgets.
>
> Here is a link to a DGH's screenshot . On the left, we have properties for
> a column (row or header). This is a datagrid table with two visible
> columns. The second column is displaying checkboxes, text, popup menus,
> images, widgets, etc depending of the property type. This is not a trick,
> this is perfectly supported by datagrid tables.
>
> https://livecode.com/wp-content/uploads/2018/06/image14-26.png
>
> On Mon, Aug 6, 2018 at 6:22 PM, Bob Sneidar via use-livecode <
> [hidden email]> wrote:
>
>> The template is like the group editor. In fact it may actually BE the
>> group editor. The behavior script determines what to do when a row is
>> drawn.
>>
>> I think the thing to understand about datagrids, table or forms, is that
>> for each array element in the data (itself an array) the template is
>> "cloned". Each row is a "clone" of the template. But for forms, the
>> behavior does not know what you want to do when the rows are created. For
>> instance, you may want to color negative numbers in red, or surround them
>> with parenthesis. You may have a button that needs to be hilited or not
>> depending on the value for that control. Perhaps you have a field that can
>> contain multiple lines of text, and you need to set the row height for each
>> row based upon the formattedHeight of that field. Or maybe show and hide
>> objects etc.
>>
>> The beauty of a form datagrid is that how each individual row gets drawn
>> is entirely under your own programmatical control. A table datagrid is
>> simply like a spreadsheet with fixed row heights and no support for
>> graphics or other controls.
>>
>> BTW I kinda cheated and made a way to have checkboxes for a table style
>> datagrid. I simply had a group with checkboxes overlaying a "dummy" column
>> in the datagrid. When I queried for data I put something like:
>>
>> SELECT '' AS checkmark, '' AS checkmarkvalue, * FROM customers
>>
>> This put two empty strings in my array data (I use sqlYoga so I get arrays
>> back instead of cursors, but the idea is the same). I only defined a column
>> for "checkmark", but NOT for "checkmarkvalue". This allowed me to have a
>> blank column to overlay the checkboxes on, and a hidden column to hold the
>> checkmarkvalue for each row in the datagrid data.
>>
>> Then when I populated the datagrid, I hid all the checkboxes then showed
>> each checkbox control based upon how much data was being displayed. Of
>> course, you have to account for scrolling, so that can be tricky, but it
>> was a poor man's way of adding checkboxes to a table datagrid. Others could
>> probably come up with a more elegant solution.
>>
>> Bob S
>>
>>
>>> On Aug 5, 2018, at 10:03 , Sannyasin Brahmanathaswami via use-livecode <
>> [hidden email]> 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?
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
Dear Swami,

I have created this kind of form before: roundrect background and margins
between 2 rows.
For the background I used my own graphic. The background graphic if present
is used by the datagrid library for hiliting the row. I removed it.
And for magins, I used a row height upper than the height of my custom
background. The margins between 2 rows are transparent, so I was able to
see the card's background without doing something specific with the
datagrid.

On Mon, Aug 6, 2018 at 9:03 PM, Sannyasin Brahmanathaswami via use-livecode
<[hidden email]> wrote:

> On 8/6/18 7:29 AM, zryip theSlug via use-livecode wrote:
> > Bob,
> >
> > A column template exists for each column of a dg table, so you can use
> any
> > control you want inside a datagrid column, including widgets.
> >
> > Here is a link to a DGH's screenshot . On the left, we have properties
> for
> > a column (row or header). This is a datagrid table with two visible
> > columns. The second column is displaying checkboxes, text, popup menus,
> > images, widgets, etc depending of the property type. This is not a trick,
> > this is perfectly supported by datagrid tables.
> >
> > https://livecode.com/wp-content/uploads/2018/06/image14-26.png
> >
> > On Mon, Aug 6, 2018 at 6:22 PM, Bob Sneidar via use-livecode <
> > [hidden email]> wrote:
> >
> >> The template is like the group editor. In fact it may actually BE the
> >> group editor. The behavior script determines what to do when a row is
> >> drawn.
> >>
> >> I think the thing to understand about datagrids, table or forms, is that
> >> for each array element in the data (itself an array) the template is
> >> "cloned". Each row is a "clone" of the template. But for forms, the
> >> behavior does not know what you want to do when the rows are created.
> For
> >> instance, you may want to color negative numbers in red, or surround
> them
> >> with parenthesis. You may have a button that needs to be hilited or not
> >> depending on the value for that control. Perhaps you have a field that
> can
> >> contain multiple lines of text, and you need to set the row height for
> each
> >> row based upon the formattedHeight of that field. Or maybe show and hide
> >> objects etc.
> >>
> >> The beauty of a form datagrid is that how each individual row gets drawn
> >> is entirely under your own programmatical control. A table datagrid is
> >> simply like a spreadsheet with fixed row heights and no support for
> >> graphics or other controls.
> >>
> >> BTW I kinda cheated and made a way to have checkboxes for a table style
> >> datagrid. I simply had a group with checkboxes overlaying a "dummy"
> column
> >> in the datagrid. When I queried for data I put something like:
> >>
> >> SELECT '' AS checkmark, '' AS checkmarkvalue, * FROM customers
> >>
> >> This put two empty strings in my array data (I use sqlYoga so I get
> arrays
> >> back instead of cursors, but the idea is the same). I only defined a
> column
> >> for "checkmark", but NOT for "checkmarkvalue". This allowed me to have a
> >> blank column to overlay the checkboxes on, and a hidden column to hold
> the
> >> checkmarkvalue for each row in the datagrid data.
> >>
> >> Then when I populated the datagrid, I hid all the checkboxes then showed
> >> each checkbox control based upon how much data was being displayed. Of
> >> course, you have to account for scrolling, so that can be tricky, but it
> >> was a poor man's way of adding checkboxes to a table datagrid. Others
> could
> >> probably come up with a more elegant solution.
> >>
> >> Bob S
> >>
> >>
> >>> On Aug 5, 2018, at 10:03 , Sannyasin Brahmanathaswami via use-livecode
> <
> >> [hidden email]> 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?
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> [hidden email]
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >
> >
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
I found another way.

Set standard background a opacity=0

add an new container graphic.

then make the background bigger that the controls, But it won't hilite.

So I might use your method.

On 8/6/18 11:33 AM, zryip theSlug via use-livecode wrote:
> I have created this kind of form before: roundrect background and margins
> between 2 rows.
> For the background I used my own graphic. The background graphic if present
> is used by the datagrid library for hiliting the row. I removed it.
> And for magins, I used a row height upper than the height of my custom
> background. The margins between 2 rows are transparent, so I was able to
> see the card's background without doing something specific with the
> datagrid.



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Getting Started with DataGrid and another datagrid form

Knapp Martin via use-livecode
In reply to this post by Knapp Martin via use-livecode
Like I said, someone will have a more elegant way of doing it. :-)

Bob S


> On Aug 6, 2018, at 10:29 , zryip theSlug via use-livecode <[hidden email]> wrote:
>
> Bob,
>
> A column template exists for each column of a dg table, so you can use any
> control you want inside a datagrid column, including widgets.
>
> Here is a link to a DGH's screenshot . On the left, we have properties for
> a column (row or header). This is a datagrid table with two visible
> columns. The second column is displaying checkboxes, text, popup menus,
> images, widgets, etc depending of the property type. This is not a trick,
> this is perfectly supported by datagrid tables.
>
> https://livecode.com/wp-content/uploads/2018/06/image14-26.png


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode