Alternating Row Colors of a Data Grid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Alternating Row Colors of a Data Grid
When you select “alternating row colours” of a Data Grid and you scroll the Data Grid the colours of the rows alternate as it scrolls.
Does anyone know how to have the alternate row colours but for these colours to remain fixed as the Data Grid Scrolls?
All the best
Does anyone know how to have the alternate row colours but for these colours to remain fixed as the Data Grid Scrolls?
All the best
Re: Alternating Row Colors of a Data Grid
Hi tellboy,
not sure what you mean?!
You want something like a (not moving) BACKGROUND IMAGE for the datagrid group?
Best
Klaus
not sure what you mean?!
You want something like a (not moving) BACKGROUND IMAGE for the datagrid group?
Best
Klaus
Re: Alternating Row Colors of a Data Grid
Yes, it probably is the background colour but when I tried to fathom the scripting of the Data Grid it seems an image is created for the background colours but I may be wrong.
I currently have the default white/blue for each of the rows and when I use the scroll bar the text scrolls.
The colours of each row is also maintained as you scroll.
So,
If you have the background colours with black text as follows:
row 1 white with black text testRow1
row 2 blue with black text testRow2
row 3 white with black text testRow3 etc.
When I scroll I want
row 1 to remain white but with black text testRow2
row 2 to remain blue but with black text testRow3
and similarly when I scroll in the other direction.
I currently have the default white/blue for each of the rows and when I use the scroll bar the text scrolls.
The colours of each row is also maintained as you scroll.
So,
If you have the background colours with black text as follows:
row 1 white with black text testRow1
row 2 blue with black text testRow2
row 3 white with black text testRow3 etc.
When I scroll I want
row 1 to remain white but with black text testRow2
row 2 to remain blue but with black text testRow3
and similarly when I scroll in the other direction.
Re: Alternating Row Colors of a Data Grid
Hi tellboy,
hm, still no idea what exactly you want to achieve, but whatever this is:
1. it is not possible out of the box with the build-in means of the datagrid
2. this will require HEAVY scripting to make it work your way.
Best
Klaus
hm, still no idea what exactly you want to achieve, but whatever this is:
1. it is not possible out of the box with the build-in means of the datagrid
2. this will require HEAVY scripting to make it work your way.
Best
Klaus
Re: Alternating Row Colors of a Data Grid
I will try to describe it again.
I want each row of the Data Grid to always be the same colour.
The Data Grid has 20 rows
Odd rows always white
Even rows always blue
Text always black
The row colour should stay the same Irrespective of the scroll position.
So rows 1,3,5,7,9,11,13,15,17,19 will always have a colour of white
and rows 2,4,6,8,10,12,14,16,18,20 will always have a colour of blue
I want each row of the Data Grid to always be the same colour.
The Data Grid has 20 rows
Odd rows always white
Even rows always blue
Text always black
The row colour should stay the same Irrespective of the scroll position.
So rows 1,3,5,7,9,11,13,15,17,19 will always have a colour of white
and rows 2,4,6,8,10,12,14,16,18,20 will always have a colour of blue
Re: Alternating Row Colors of a Data Grid
Hm, that's exactly what “alternating row colours” does!tellboy wrote:...
So rows 1,3,5,7,9,11,13,15,17,19 will always have a colour of white
and rows 2,4,6,8,10,12,14,16,18,20 will always have a colour of blue
The color of each row does not change during scrolling!
But maybe I still don't get it
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Alternating Row Colors of a Data Grid
Hi.
Saw this on the use list. I replied that I did not think there was a native way to do it, but that you can:
set the dgProp["alternate row colors"] of grp "yourDG" to "false"
and then overlay a group of properly sized, colored, blended buttons onto the DG that will stay put while you scroll. A kluge, but should work fine.
Craig Newman
Saw this on the use list. I replied that I did not think there was a native way to do it, but that you can:
set the dgProp["alternate row colors"] of grp "yourDG" to "false"
and then overlay a group of properly sized, colored, blended buttons onto the DG that will stay put while you scroll. A kluge, but should work fine.
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 7235
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Alternating Row Colors of a Data Grid
Does it have to be a datagrid? Because you can do this with a regular field that overlays a carefully sized image. It would be similar to. Craig's approach only a little easier.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Alternating Row Colors of a Data Grid
I have experimented with this solution for a short while but with a blend it mixes with the underlying colour which in this case is firstly blue and then white as you scroll. You therefore see a flickering blended colour as you scroll, unless I have misunderstood your suggestion. Also this would make life difficult when selecting or editing the text of a table cell.dunbarx wrote:and then overlay a group of properly sized, colored, blended buttons onto the DG that will stay put while you scroll. A kluge, but should work fine.
I would have thought it possible to adjust the scripts behind the scenes of the data grid to achieve what I am after.
Hopefully someone will chime in with an answer.
Thanks
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Alternating Row Colors of a Data Grid
Hi.
Underlying color? I suggested that the DG first be cleared of such things, so it should be white overall.
As to the selection of the "cells" or rows in the underlying DG, you have a point. This can be scripted as well, I think, by knowing the clickLoc and fooling around a bit, but all of a sudden, though I am sure doable, it is more work.
How important, I guess, is this static alternating color thingie?
Craig
Underlying color? I suggested that the DG first be cleared of such things, so it should be white overall.
As to the selection of the "cells" or rows in the underlying DG, you have a point. This can be scripted as well, I think, by knowing the clickLoc and fooling around a bit, but all of a sudden, though I am sure doable, it is more work.
How important, I guess, is this static alternating color thingie?
Craig
Re: Alternating Row Colors of a Data Grid
Well not essential but my concern with Data Grid is the smoothness or lack of when scrolling when compared to OSX native tables.tellboy wrote:How important, I guess, is this static alternating color thingie?
The scrolling of the alternating colours does affect your concentration when scrolling through data to find some text when you have a flickering effect as you scroll.
I could have a plain or white colour but then lose the alternating colour benefit of focusing your eye across a row of data.
Hopefully someone will advise how to adjust the Data Grid scripts.
I will be experimenting myself and hopefully can find out how to adjust the scripts.
All the best
Re: Alternating Row Colors of a Data Grid
Well,
I seem to have found it in the Data Grid script. It seems to be located in this part of the script.
The code commented out seems to do the trick and does not on the face of it affect anything else.
All the best
I seem to have found it in the Data Grid script. It seems to be located in this part of the script.
Code: Select all
private command _table.DrawWithProperties pSetVScrollTo, pForceRefresh
## We only scroll by entire records so if any scrolling is supposed to occur then
## start 1 higher
if pSetVScrollTo > 0 then add 1 to sTableObjectsA["base sequence for visible controls"]
_table.DrawControlsInRealTime pForceRefresh
if sTableObjectsA["base sequence for visible controls"] mod 2 is kAlternatingRowModValue then
--set the top of graphic "dgAlternatingRows" of me to the top of group "dgAlternatingRowsMask" of me - sControlHeights
else
set the top of graphic "dgAlternatingRows" of me to the top of group "dgAlternatingRowsMask" of me
end if
end _table.DrawWithProperties
Code: Select all
--set the top of graphic "dgAlternatingRows" of me to the top of group "dgAlternatingRowsMask" of me - sControlHeights
All the best
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Alternating Row Colors of a Data Grid
Oooh.
Bravo.
The very complexity of the DG, that is, there is a built-in alternate row color object, can be located so that it "untracks" the integral scroll value.
Craig
Bravo.
The very complexity of the DG, that is, there is a built-in alternate row color object, can be located so that it "untracks" the integral scroll value.
Craig
Re: Alternating Row Colors of a Data Grid
WOW! Cool finding!
But I still have no idea how that might look
But I still have no idea how that might look