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