Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Row selction vs. column background color
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Row selction vs. column background color

 Post Reply Post Reply
Author
Message
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Topic: Row selction vs. column background color
    Posted: 24 March 2006 at 5:07am
I have a special column on a table where each record has a different background color for the column.  (Just like the colored flag status column in Outlook.)  When I select a row, the row turns gray to indicate the row is selected but it overwrites the background color on the special column.  Is there any way to specify the column to not turn gray when a row is selected.  I still need the other columns of the row to turn gray though.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 8:02am
Try to use GetItemMetrics() callback method. See ReportSample for Automatic Formatting option and CMessageRecord::GetItemMetrics() sample method.

--
WBR,
Serge
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 27 March 2006 at 9:17am
I tried playing with the metrics but it only effected the non-selected items.  When I select a row, it still turns the entire row gray.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2006 at 6:56am
Hi,

Agree with you, selection colors will override any other colors set inside GetItemMetrics(). So far, the solution would be to change control's  PaintManager highlight colors on the moment of drawing this item.

Inside GetItemMetrics(), insert a piece of code like following:

if (pDrawArgs->pRow->IsSelected())
{
    pDrawArgs->pControl->GetPaintManager()->m_clrHighli ght = RGB(245, 245, 245);
    pDrawArgs->pControl->GetPaintManager()->m_clrHighli ghtText = RGB(80, 100, 225);
}
else
{
    pDrawArgs->pControl->GetPaintManager()->m_clrHighli ght = pDrawArgs->pControl->GetPaintManager()->m_clrHighli ght.GetStandardColor();
    pDrawArgs->pControl->GetPaintManager()->m_clrHighli ghtText = pDrawArgs->pControl->GetPaintManager()->m_clrHighli ghtText.GetStandardColor();
}


--
WBR,
Serge
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2006 at 7:07am
How about in VB?
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2006 at 9:08am
Almost the same. Inside _BeforeDrawRow() event handler:


If Row.Selected Then
    wndReportControl.PaintManager.HighlightBackColor = vbRed
Else
    wndReportControl.PaintManager.HighlightBackColor = -1
End If


--
WBR,
Serge
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2006 at 11:42am
That is very close to what I was looking for but it still changed the highlighted color for the entire row.  I did get it to work with the following modified code:


    If ((Row.Selected = True) And (Item.ToolTip = "Alias Color")) Then
        grdItems.PaintManager.HighlightBackColor = Item.BackColor
        grdItems.PaintManager.HighlightForeColor = Item.ForeColor
    Else
        grdItems.PaintManager.HighlightBackColor = -1
        grdItems.PaintManager.HighlightForeColor = -1
    End If


I was luckily able to use the Item.ToolTip field to identify the specific column that I did not want to be highlighted. 

I would like to suggest adding a property for a ReportColumn object such as "ShowHighlighted" so I could simply do something like:


Column.ShowHighlighted = False


in order to prevent item in that column from changing background and foreground colors when the row is selected.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.