Ticket T434996
Visible to All Users

Modifying Group Header via CustomDrawGroupCell

created 8 years ago

I'm using the CustomDrawGroupCell and appending on additional information.  I also have a Summary Group of another column where I get the sum and link it to the column being grouped.  If my Format in the summary group is Profit=$,0;-Profit=-$,0, then this text is being overlaid on my text being added in the CustomDrawGroupCell.

I've attached a picture of what I'm seeing.  It appears as the Summary text is being placed where it should be going if I hadn't modified the Text in the CustomDrawGroupCell.

I'm converting from the old dxGrid to the cxGrid.  It was working on the dxGrid, but I must be missing something in the conversion to the new grid.

Any ideas?

Thanks,
Tom

Answers approved by DevExpress Support

created 8 years ago

Hello Tom,

You are right, text drawn in the OnCustomDrawGroupCell event is just a picture and it does not affect the group summary cell's position. I suggest that you handle your grouped column's OnGetDisplayText event and change the AText parameter there. In this case, text boundaries will be recalculated and summary texts should be correctly placed. For example:

Delphi
procedure TForm1.cxGrid1DBTableView1GroupGetDisplayText( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: string); begin if ARecord is TcxGridGroupRow then AText := AText + 'Some additional text for testing'; end;
    Comments (2)

      I’m trying to modify the group text and bold all of the text on the row.   I’m running a sum on a column and will need to modify the text from this summary.  I’m doing this in the CustomDrawGroupSummaryCell
      In addition, I’m modifying the group row text in the GetDisplayText as you suggested.  This is working well since I have the ARecord.
      The Sum is appended to the end which is ok, however, I need to bold the full line.  When I change the font in the CustomDrawGroupSummaryCell it only changes that portion and not the full line.
      As you can see in the attachment (new), I’ve added additional text and the summary item is partially showing and is bold.  I need to show the full line with no ellipse and in bold text.
      The ending goals is to look like my old method (old.jpg).
      Thanks,
      Tom

      DevExpress Support Team 8 years ago

        Hello Tom,

        It is not necessary to use custom drawing to provide custom font settings for group rows. It should be sufficient to set a corresponding style to the Styles.Group property. Attached is a small sample project demonstrating how to accomplish this task. Note that you can use the Styles.OnGetGroupStyle and Styles.OnGetGroupSummaryStyle events to individually set font styles for certain rows. I hope this approach will help you implement the required appearance.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.