Print Page | Close Window

[solved] Inplace edit bug!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=9742
Printed Date: 21 November 2024 at 6:57am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] Inplace edit bug!
Posted By: znakeeye
Subject: [solved] Inplace edit bug!
Date 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));
}



Replies:
Posted By: mgampi
Date 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


Posted By: olebed
Date 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


Posted By: olebed
Date 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


Posted By: mgampi
Date 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


Posted By: mgampi
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net