Need to make Grids with colors??
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
Need to make Grids with colors??
I need to made grids that fill in with colors. and data, not from a database. Each square needs to be able to be a different color. I have been using table a table field but it wont fill in a whole square. I was thinking outside the box and put the spaces in and set the background color but looks bad.
ALSO.... as the table field fills down to the bottom....is there a way to have it automatically scroll up cause its a pain to keep scrolling up to see the new data populating on the bottom rows?
Thanks in advance.
ALSO.... as the table field fills down to the bottom....is there a way to have it automatically scroll up cause its a pain to keep scrolling up to see the new data populating on the bottom rows?
Thanks in advance.
-
- VIP Livecode Opensource Backer
- Posts: 9567
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need to make Grids with colors??
Hi.
It is possible to kludge almost anything in LiveCode, but a table field is really just an ordinary field with certain properties. The point is that each "cell" in a table field is not its own control. It is just a "space" defined and delimited by tabs and returns. That means it is not easy or straightforward to set the backColor of any particular "area".
A dataGrid is built from separate fields, and you can set the backColor of any one of them directly. But dataGrdis are complex, and require their own learning curve. But if you do not need a lot of functionality, using it mainly as something simply to display and hold information similar to a spreadsheet, it might be the best way forward.
How big is your "table"? If it is not too large, and does not change, you might assemble several fields together in a group.
Lots of possibilities. So tell me more about your project. There will be a way to do what you want.
Know that you can set the scroll of a tableField to zero any time you want, certainly after any action is taken or data changed. Do you know how to do this?
Craig
It is possible to kludge almost anything in LiveCode, but a table field is really just an ordinary field with certain properties. The point is that each "cell" in a table field is not its own control. It is just a "space" defined and delimited by tabs and returns. That means it is not easy or straightforward to set the backColor of any particular "area".
A dataGrid is built from separate fields, and you can set the backColor of any one of them directly. But dataGrdis are complex, and require their own learning curve. But if you do not need a lot of functionality, using it mainly as something simply to display and hold information similar to a spreadsheet, it might be the best way forward.
How big is your "table"? If it is not too large, and does not change, you might assemble several fields together in a group.
Lots of possibilities. So tell me more about your project. There will be a way to do what you want.
Know that you can set the scroll of a tableField to zero any time you want, certainly after any action is taken or data changed. Do you know how to do this?
Craig
-
- Livecode Opensource Backer
- Posts: 9251
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Need to make Grids with colors??
Blast: naive Richmond tried this:
Uncode:
and this:
Having looked up cell in the Dictionary . . .
Uncode:
Code: Select all
on mouseUp
set the backGroundColor of cell 2,2 to red of fld "MENSA"
end mouseUp
Code: Select all
on mouseUp
set the backGroundColor of cell 2,2 of fld "MENSA" to red
end mouseUp
Re: Need to make Grids with colors??
I see a couple of problems, and so a few questions.no1g8tor96 wrote: ↑Thu Mar 11, 2021 12:27 amI need to made grids that fill in with colors. and data, not from a database. (1.) Each square needs to be able to be a different color. I have been using table a table field but it wont fill in a whole square. (2.) I was thinking outside the box and put the spaces in and set the background color but looks bad.
1. Does every cell need to be a completely different color over the whole table? I think even with a small dataset, your likely to run out of colors fairly quickly or start running into colors that are so close they might as well be the same color.
2. You probably weren't thinking outside the box enough. For instance, you *could* have one field in the background and color that, and lay the actual field your working on in the same space and put the data in that but have the background of the field transparent. Something like how this little gadget worked.
In other words, you put the color in the background, and the data in the foreground field. Keep in mind, you'll still have to work out what color to make the text in the foreground, if you wind up with a dark background and dark text that isn't likely to be helpful
-
- Livecode Opensource Backer
- Posts: 9251
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Need to make Grids with colors??
Sorry to put the kibosh on your suggestion, bogs.Each square needs to be able to be a different color.
Silly mockup:
-
Re: Need to make Grids with colors??
Not sure how that puts the kibosh on anything I said heh. Nicely mocked up.
-
- VIP Livecode Opensource Backer
- Posts: 9567
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need to make Grids with colors??
Richmond.
"Cell" is not a native word in LC, I believe, except as an idea.
What is your colorful table made of? It looks lovely.
Craig
"Cell" is not a native word in LC, I believe, except as an idea.
What is your colorful table made of? It looks lovely.
Craig
Re: Need to make Grids with colors??
Hi Craig,
"cell" IS in fact a native LC word, take a look at the dictionary, where Richmond copied this script from:
Tried exactly it, but got an compilation error:
button "Button": compilation error at line 2 (set: missing 'to'), char 31
Another documentation error?
"cell" IS in fact a native LC word, take a look at the dictionary, where Richmond copied this script from:
Code: Select all
on mouseUp
set the backGroundColor of cell 2,2 of fld "MENSA" to red
end mouseUp
button "Button": compilation error at line 2 (set: missing 'to'), char 31
Another documentation error?
-
- Livecode Opensource Backer
- Posts: 9251
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Need to make Grids with colors??
I did not copy that script, I wrote it myself.
But in the light of this:
- -
it felt legit.
But in the light of this:
- -
it felt legit.
Re: Need to make Grids with colors??
Hm, I could have sworn, I saw it there!?I did not copy that script, I wrote it myself.
Anyway, at least the dictionary entry lets one think that one could use something like this script.
-
- VIP Livecode Opensource Backer
- Posts: 9567
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need to make Grids with colors??
I saw the word "cell" in the dictionary, but it is not a "native" word in the sense that it is part of the language. It is a glossary entry, not a keyword.
A semantic issue.
And since it is not, I do not think it can be used as Richmond implied. I got the same error Klaus did.
So, Richmond, again, what is your very colorful table comprised of, and how would you set, say, "cell 2,2" to red?
Craig
A semantic issue.
And since it is not, I do not think it can be used as Richmond implied. I got the same error Klaus did.
So, Richmond, again, what is your very colorful table comprised of, and how would you set, say, "cell 2,2" to red?
Craig
Re: Need to make Grids with colors??
You know, I seem to remember this topic coming up previously from Richmond, but I can't seem to find it heh. Maybe someone with a bit more time this morning will find it.
-
- Livecode Opensource Backer
- Posts: 9251
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Need to make Grids with colors??
Well, you know the old saw: "A dog always returns to his v***t."this topic coming up previously from Richmond
There is also a theory that if you bang on about something long enough someone might take notice of it.
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
Re: Need to make Grids with colors??
ALL...
Thanks for the replies. I dont need colors all over. I am attaching a sample of what i have now...sorry should have done it when I started. You will see my table field and scroll.
When it starts filling up past the bottom rows i need to keep scrolling after each input and its a pain. Need to figure that one out.... want to be able to see at least 3 spaces at bottom at all times....if possible.
what I did to create the filled in colors is this..put " B. " and set the backroundcolor to the one needed. Works but not pretty.
I was looking at datagrids but complicated....but if I need to learn i need to learn. Is there an easy way to learn them?
I just want to color in a box...seems like it should not be hard but might be.....The cell feature would have been nice.
I could go "outside the box" more and just make square buttons and set colors and labels but scrolling will be another issue. I need up to 80 lines of data.
This is just a simple app to track Betting on Banker or Player for baccarat and will be making one for Roulette. Its for a group of guys that do this for a living that tasked me to do this. I dont gamble but i dont judge the ones that do.. They make good money though...who knew...lol
Thanks again for any suggestions.
Thanks for the replies. I dont need colors all over. I am attaching a sample of what i have now...sorry should have done it when I started. You will see my table field and scroll.
When it starts filling up past the bottom rows i need to keep scrolling after each input and its a pain. Need to figure that one out.... want to be able to see at least 3 spaces at bottom at all times....if possible.
what I did to create the filled in colors is this..put " B. " and set the backroundcolor to the one needed. Works but not pretty.
I was looking at datagrids but complicated....but if I need to learn i need to learn. Is there an easy way to learn them?
I just want to color in a box...seems like it should not be hard but might be.....The cell feature would have been nice.
I could go "outside the box" more and just make square buttons and set colors and labels but scrolling will be another issue. I need up to 80 lines of data.
This is just a simple app to track Betting on Banker or Player for baccarat and will be making one for Roulette. Its for a group of guys that do this for a living that tasked me to do this. I dont gamble but i dont judge the ones that do.. They make good money though...who knew...lol
Thanks again for any suggestions.
-
- VIP Livecode Opensource Backer
- Posts: 9567
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need to make Grids with colors??
I would just love to know how either the OP or Richmond was able to color individual "cells" in a standard table field.
Cummon, you can tell me.
Craig
Cummon, you can tell me.
Craig