Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - [solved] Inplace edit bug!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] Inplace edit bug!

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

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: [solved] Inplace edit bug!
    Posted: 29 February 2008 at 7:55am
I'm on fire today! :)
 
pItem->SetBackgroundColor(blue); // Nice...
...until you edit the item!
 
 
Default background color should be the same as the one provided in the call to SetBackgroundColor!
 
The problem lies in here!
HBRUSH CXTPReportInplaceEdit::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
{
    pDC->SetTextColor(m_clrText); // Only text color :(
    return GetSysColorBrush(COLOR_WINDOW);
}
Possible solution:
HBRUSH CXTPReportInplaceEdit::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
{
    pDC->SetTextColor(m_clrText);
    pDC->SetBkMode(TRANSPARENT);
    return m_bUseItemBackground ? (m_brBackground : GetSysColorBrush(COLOR_WINDOW));
}
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2014 at 8:29am
Hi;

has this ever been implemented into the core?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2014 at 10:20am
Hi,

Thank you for bringing this to our attention. I’ve added this to our bug database. The problem will be addressed according to its priority.

Regards,
 Lebed Oleksandr
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2018 at 7:20am
Hello,

I'm glad inform you that this have been already implemented in v18.4.

Added CXTPReportInplaceEdit::m_clrBack and appropriate m_xtpBrushBack method for CXTPReportInplaceEdit::CtlColor()

on creation CXTPReportInplaceEdit added initialization

m_clrBack = pControl->GetPaintManager()->m_clrControlBack; 

Regards,
 Oleksandr Lebed
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2024 at 6:33am
I have to reopen this issue, because it still does not work as expected in v.22.1.
Suppose you have an alternate coloring in your control and an item of a row with alternate color is edited, then the (false) background color of the control is used.

In CXTPGridInplaceEdit::Create() we can find this code:
    m_clrText = pMetrics->clrForeground;
    m_clrBack = pControl->GetPaintManager()->m_clrControlBack;

    if (m_xtpBrushBack.GetSafeHandle())
        m_xtpBrushBack.DeleteObject();

    m_xtpBrushBack.CreateSolidBrush(m_clrBack);

I believe it should be replaced by:
    m_clrText = pMetrics->clrForeground;
    m_clrBack = pMetrics->clrBackground;

    if (m_xtpBrushBack.GetSafeHandle())
        m_xtpBrushBack.DeleteObject();

    m_xtpBrushBack.CreateSolidBrush(m_clrBack);
to reflect background color changes done with alternate coloring and/or GetItemMetrics(...) callbacks. Another more flexible solution would be a Function CXTPGridInplaceEdit::SetBackgroundColor() and take this, if no color changes are applied with GetItemMetrics() callbacks.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2024 at 4:25am
Improvement to the code of my previous message:
    m_clrText = pMetrics->clrForeground;
    if (pMetrics->clrBackground!=static_cast<COLORREF>(-1)) {
      m_clrBack = pMetrics->clrBackground;
    } else {
      m_clrBack=pControl->GetPaintManager()->m_clrControlBack;

    }

    if (m_xtpBrushBack.GetSafeHandle())
        m_xtpBrushBack.DeleteObject();


Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
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.141 seconds.