Datagrid: changing cell style
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Datagrid: changing cell style
Hello,
If a Datagrid cell is a checkbox, is there a way to modify the colors - foreground or background - of *another* cell of the same line, when the checkbox is clicked?
Thank you.
If a Datagrid cell is a checkbox, is there a way to modify the colors - foreground or background - of *another* cell of the same line, when the checkbox is clicked?
Thank you.
-
- Posts: 222
- Joined: Thu Jul 01, 2010 11:50 am
Re: Datagrid: changing cell style
I could probably figure out how to do this, *if* I could first figure out how to either get a checkbox into a DG table, or multiple columns into a DG form. I just spent half an hour trying to figure out how to do that before giving up. The DG documentation is simply atrocious. Can you give me a step-by-step to get a simple DG set up so I can work on your issue?
Re: Datagrid: changing cell style
Sorry, I can't... For several reasons:
1 - I only used some DG tables, and not forms.
2 - I spent much more than half an hour to understand how to put a button in a column, so I'm very far to be a DG master.
3 - Each time I modify a DG, I first save a copy of the stack, because very often I made something wrong with the DG, something that doesn't seem to be undoable.
4 - DG are atrocious. It's not the documentation.
5 - My english is not good enough to write accurate help.
6 - At least, a video tutorial would be better.
1 - I only used some DG tables, and not forms.
2 - I spent much more than half an hour to understand how to put a button in a column, so I'm very far to be a DG master.
3 - Each time I modify a DG, I first save a copy of the stack, because very often I made something wrong with the DG, something that doesn't seem to be undoable.
4 - DG are atrocious. It's not the documentation.
5 - My english is not good enough to write accurate help.
6 - At least, a video tutorial would be better.
Re: Datagrid: changing cell style
*Disclaimer* I don't work with DGs much.MichaelBluejay wrote: ↑Fri Nov 22, 2019 3:02 amI could probably figure out how to do this, *if* I could first figure out how to either get a checkbox into a DG table, or multiple columns into a DG form. I just spent half an hour trying to figure out how to do that before giving up. The DG documentation is simply atrocious. Can you give me a step-by-step to get a simple DG set up so I can work on your issue?
I *think* you would place a check box just as you would a button in the DG , however, there is a lesson specifically about placing a checkbox into one.
http://lessons.livecode.com/m/datagrid/ ... -data-grid
-
- Posts: 222
- Joined: Thu Jul 01, 2010 11:50 am
Re: Datagrid: changing cell style
bogs, that lesson is for DG forms, not tables, or at least that's what it says. I tried to make it work for tables but couldn't. Maybe it does, but again, the lesson isn't written well.
Zax, try helping me get a checkbox into a DG table. DGs are indeed a pain, but the documentation is far worse than the DG itself. If we could easily understand how to use them, we wouldn't complain as much.
Zax, try helping me get a checkbox into a DG table. DGs are indeed a pain, but the documentation is far worse than the DG itself. If we could easily understand how to use them, we wouldn't complain as much.
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Datagrid: changing cell style
A checkbox can respond to mouse events to set properties of other objects. Both the object being clicked and the object being affected are members of the same row group, e.g., they have the same owner. So putting that together, off the top of my head it might be something like:
Code: Select all
on mouseUp
set the backgroundColor of fld "Cell2" of the owner of me to "blue"
end mouseUp
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Datagrid: changing cell style
Interesting. I just tried the owner but, as DG are made with lots a imbricated groups, I was unable to get a pointer to the current line.FourthWorld wrote: ↑Fri Nov 22, 2019 8:46 pmA checkbox can respond to mouse events to set properties of other objects. Both the object being clicked and the object being affected are members of the same row group, e.g., they have the same owner. So putting that together, off the top of my head it might be something like:Code: Select all
on mouseUp set the backgroundColor of fld "Cell2" of the owner of me to "blue" end mouseUp
I also tried with:
Code: Select all
the owner of (the owner of (the owner of me)) [...]
@MichaelBluejay: bogs' link is a good lesson and seems to work for tables too.
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Datagrid: changing cell style
DG tables are for text display only. If you need to embed LC controls like buttons or images you have to use a form.that lesson is for DG forms, not tables
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Datagrid: changing cell style
The row template for list style DGs is not editable?
Then yes, to edit the row template would require using the type that's editable.
I never use the list DG type anymore, since list fields are more efficient and now support independent column alignment.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Datagrid: changing cell style
It's been a long time since I used it, but unless things have changed there is no template for the basic table display. Like you, I find regular LC fields sufficient for what I do, but I think they'd be useful for situations where there may be more rows than a field can comfortably manage.The row template for list style DGs is not editable?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Datagrid: changing cell style
Hmmm...if the OP has added a checkbox to the row template, wouldn't that mean he's not using the list type?
Zax wrote:
In all my my own use with the DG over the years, simply referring to other controls by referencing the immediate parent has always worked, as in my example above. Indeed, I can't conceive of a way that could not work.
Yes, it's also possible to reference other parents further up, such as the DG itself, the card the DG is on, or the stack that card is in. But those should not be necessary for what you want to do.
If you have a moment to toss together an example in which referring to another control by referencing its common immediate parent isn't working I'd be happy to take a look at it to determine where it went wrong.
Zax wrote:
A DG row is a group containing the individual controls to be shown for each row. There are as many rows as there are visible on screen within the current bounds of the DG, which is itself a group.Interesting. I just tried the owner but, as DG are made with lots a imbricated groups, I was unable to get a pointer to the current line.
In all my my own use with the DG over the years, simply referring to other controls by referencing the immediate parent has always worked, as in my example above. Indeed, I can't conceive of a way that could not work.
Yes, it's also possible to reference other parents further up, such as the DG itself, the card the DG is on, or the stack that card is in. But those should not be necessary for what you want to do.
If you have a moment to toss together an example in which referring to another control by referencing its common immediate parent isn't working I'd be happy to take a look at it to determine where it went wrong.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Datagrid: changing cell style
His second post seems to indicate he couldn't figure out how to get a checkbox into a list table.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: Datagrid: changing cell style
The DataGrid Helper (DGH) provides the tools to add checkboxes, radio buttons, menu buttons, navigation buttons and more to columns in a table view. Indeed you can add any of the classic controls.
You are in effect modifying the column's template (basically replacing the field with the added control), and modifying the columns behaviour script.
You can of course do this the long way (i.e. do all the mods yourself) or use DGH.
DGH is open source for non-commercial use. commercial use requires a license.
Check out the docs (see how to add things to columns) at https://www.aslugontheroad.com/ourprodu ... hat-is-dgh
You are in effect modifying the column's template (basically replacing the field with the added control), and modifying the columns behaviour script.
You can of course do this the long way (i.e. do all the mods yourself) or use DGH.
DGH is open source for non-commercial use. commercial use requires a license.
Check out the docs (see how to add things to columns) at https://www.aslugontheroad.com/ourprodu ... hat-is-dgh
-
- Posts: 222
- Joined: Thu Jul 01, 2010 11:50 am
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: Datagrid: changing cell style
I have used DGH since it was first released and have not ever attempted to do what it does so effortlessly.
Why not download the trial of DGH and see what it can do.
Otherwise someone in the know may be able to provide the steps to do it without DGH.
Why not download the trial of DGH and see what it can do.
Otherwise someone in the know may be able to provide the steps to do it without DGH.