|
-
Feb 3rd, 2013, 11:05 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] colour coding or grouping records in Hierarchical Data Grid
I have a HFG as in Pic 1.
Attachment 96009
I would like to make it a little easier to see different groups by separating or colour coding them as in the next two pics.
Attachment 96011Attachment 96013
Can anyone tell me if it is possible, and if so, how. Thank you.
-
Feb 3rd, 2013, 11:27 AM
#2
Re: colour coding or grouping records in Hierarchical Data Grid
Due to doesn't exists a Hierarchical Data Grid control,
please specific correctly the control you use.
-
Feb 3rd, 2013, 11:53 AM
#3
Thread Starter
Fanatic Member
Re: colour coding or grouping records in Hierarchical Data Grid
Sorry, FlexGrid, not DataGrid
Specifically MSHFlexGrid.
-
Feb 3rd, 2013, 11:56 AM
#4
Re: colour coding or grouping records in Hierarchical Data Grid
So, you had moved from DataGrid to MSHFlexGrid ?
-
Feb 3rd, 2013, 12:44 PM
#5
Thread Starter
Fanatic Member
Re: colour coding or grouping records in Hierarchical Data Grid
-
Feb 3rd, 2013, 11:32 PM
#6
Re: colour coding or grouping records in Hierarchical Data Grid
This is ONE WAY how to color the background of individual cells (rows) in a flexgrid:
Code:
Dim x As Integer, Y as Integer
For x = 1 To grid1.Rows - 1
If grid1.TextMatrix(x, 5) = "YES" Then 'In MY example, I color-code columns 0 to 5 of each row where column 5 is a certain value ("YES")
grid1.Row = x
For Y = 0 To 5
grid1.Col = Y
grid1.Row = x
grid1.CellBackColor = vbYellow
Next Y
End If
Next x
You can change the bg color of those particular cells differently depending upon what Group the student is in
Suggest you use a CASE statement to set a variable for each color you want.
-
Feb 4th, 2013, 04:56 AM
#7
Re: colour coding or grouping records in Hierarchical Data Grid
Keep in mind that this sort of use of color is strongly discouraged by the Windows Development Guidelines for good reason.
System colors are user controlled, often through accessibility options for low-vision users.
If you do something whizzy like color a cell yellow (or even explicitly white) then what happens if the system Window Text color turns out to be yellow, white, or another pale color?
The user won't be able to read the text, that's what.
And in many countries this can open you to a lawsuit over impaired accessibility.
Just don't do this. Even if you carefully set both background and foreground colors you can be in violation of the laws by overriding the user's accessibility settings.
-
Feb 4th, 2013, 08:47 AM
#8
Re: colour coding or grouping records in Hierarchical Data Grid
 Originally Posted by dilettante
Keep in mind that this sort of use of color is strongly discouraged by the Windows Development Guidelines for good reason.
System colors are user controlled, often through accessibility options for low-vision users.
If you do something whizzy like color a cell yellow (or even explicitly white) then what happens if the system Window Text color turns out to be yellow, white, or another pale color?
The user won't be able to read the text, that's what.
And in many countries this can open you to a lawsuit over impaired accessibility.
Just don't do this. Even if you carefully set both background and foreground colors you can be in violation of the laws by overriding the user's accessibility settings.
I agree 100%.
I Add: use with caution, because if you use formula to calculate something (totals, averages, ...) on LeaveCell/EnterCell events, then each time you change Row/Col events will be fired.
Because on flexgrid doesn't exists a method like SetBackColor(x,y) or SetForeColor(x,y), therefore (as SamOscarBrows shows to you) you need each time change Row adn Col property.
If so, set Redraw to False before, and set to True after changing color.
Eventually, see also se FillStyle property for apply color to a range of cells.
-
Feb 4th, 2013, 09:28 AM
#9
Thread Starter
Fanatic Member
Re: colour coding or grouping records in Hierarchical Data Grid
 Originally Posted by dilettante
Just don't do this.
Very interesting information, thank you. However, for me, in this situation, it is not a problem because the app is for my own personal use in my school.
Saying that, it would be nice to conform to legal guidelines (if in the future some fool wanted to buy my app). Given that, do you know of any way to leave a space between the records with different groups as per pic3 above.
Or, alternatively, Put a thicker border on the cells when the group changes?
Basically, I want some way to make it easy to identify at a glance, the students belonging to different groups because group names would be something like:
1A
1B
2A
3A
4A
4B
-
Feb 4th, 2013, 09:40 AM
#10
Re: colour coding or grouping records in Hierarchical Data Grid
One easy way is to use a 'space' (blank row) between groups. As you are moving through your recordset, (needs to be sorted by groupname), each time groupname changes, make the cells in the next row = blank ("").
-
Feb 4th, 2013, 09:48 AM
#11
Re: colour coding or grouping records in Hierarchical Data Grid
@Dile...was not aware of this 'color/colour warning'. Interesting. Maybe I oughta read more. I guess bolding/unbolding could work for OP, or even font size changes. How would YOU attack something like what OP wants to do?---make it stand out somehow for each group.
-
Feb 7th, 2013, 06:45 AM
#12
Thread Starter
Fanatic Member
Re: colour coding or grouping records in Hierarchical Data Grid
Since no "better" solution is forthcoming, I will go with Sam's Colour coding. Thank you once again Sam.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|