I think I was among the people who suggested the change you made in v5.0.86. For me, the reasoning was that having to create a new StdFont object every time I need to change a property of it, usuall adds two lines to a single one, making it three. As you put in your example, Igor, I need one to create the StdFont and another one to set the font name, again and again, to the same font used by the rest of the iGrid. I never use the default font of StdFont, because honestly, MS Sans Serif doesn't look too good.
Let's discuss this using a typical situation. For instance, you need to use the font Tahoma for your grid, and the columns 1-3 should be bold. In the current public version 5.0.105 you do something like this:
iGrid1.Font.Name = "Tahoma"
iGrid1.ColDefaultCell(1).oFont.Bold = True
iGrid1.ColDefaultCell(2).oFont.Bold = True
iGrid1.ColDefaultCell(3).oFont.Bold = True
Yes, it's easy and clear, though this approach has other problems like I described in my
post #6 above.
Ok, now we return to Nothing as the default value for ColDefaultCell.oFont. If I understand your words properly, you're going to re-code the sample above like the following one.
(sure, we can simplify it a little bit using the With statement, but it does not relate to our discussion now)
iGrid1.Font.Name = "Tahoma"
iGrid1.ColDefaultCell(1).oFont = New StdFont
iGrid1.ColDefaultCell(1).Name = "Tahoma"
iGrid1.ColDefaultCell(1).Bold = True
iGrid1.ColDefaultCell(2).oFont = New StdFont
iGrid1.ColDefaultCell(2).Name = "Tahoma"
iGrid1.ColDefaultCell(2).Bold = True
iGrid1.ColDefaultCell(3).oFont = New StdFont
iGrid1.ColDefaultCell(3).Name = "Tahoma"
iGrid1.ColDefaultCell(3).Bold = True
But buddy, I think that a much better style of programming is something like this, when all settings are gathered at one place:
iGrid1.Font.Name = "Tahoma"
Dim myFont as New StdFont
myFont.Name = iGrid1.Font.Name
myFont.Bold = True
iGrid1.ColDefaultCell(1).oFont = myFont
iGrid1.ColDefaultCell(2).oFont = myFont
iGrid1.ColDefaultCell(3).oFont = myFont
1. Just add a new property .oGroupRowFont as an alias for .ColDefaultCell(.RowTextCol).oFont and refer to it somewhere where the Grouping feature is explained. Dan suggested that earlier already. That would make it somewhat more obvious as to how to change the font of the group rows and hint to the fact that .oGroupRowFont doesnt change when you set .oFont in the code.
Why do we need to implement a new property that actually duplicates the existing one? Note also that .RowTextCol is a reference to the ROW TEXT column but not only to a non-existing group row column, and the row text column defines the properties of group rows and row text cells inside normal rows.
2. Lazy "Copy on read/write"
This is probably a bit more work to implement. Basically, it means that internally, you don't clone the font object for each column when they are created. You keep them empty and know that you have to use the .Font object for them instead. When the .ColDefaultCell().oFont property is read, you simply return the values of .Font, which is correct. ONLY when the .ColDefaultCell().oFont property is modified, you really create a copy of the StdFont and place it in the .ColDefaultCell.
Yes, it's a good idea, and in fact we are using it for our cells. When you access the CellFont property, you always get a non-empty Font object and you can change its properties directly. This virtual font object is cached inside iGrid, but this technique has some limitations. The first of them is that you cannot cache it in your code using the Set statement. Second, you have no way to know whether a cell has the default font (CellFont never returns Nothing), you can only reset the cell font to the default one using the CellDefaultFont method (argh).
We implemented this for cells to avoid storing font objects in every cell - as you understand, it would cause huge resource consuming in big grids. BTW, this is one more reason why I vote for my fix with the default column font set to Nothing. If we go this way, we also save many system resources as we do not create a new font object for every column in every grid (any system font object actually uses a lot of resources). The situation is even worse because we clone the same grid font over and over again. Frankly speaking, I'm very ashamed for this...
So guys, with all my respect to you and code you wrote, I still think that we need the fix I suggested. In the current implementation, we preferred code simplicity to proper work (as we see it now), but I believe that faultless code must be on the first place.