Print Page | Close Window

Bug in CXTPReportFilterEditControl

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=10299
Printed Date: 16 November 2024 at 7:31pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Bug in CXTPReportFilterEditControl
Posted By: Sergio
Subject: Bug in CXTPReportFilterEditControl
Date Posted: 18 April 2008 at 10:41am
Hi,
 
The Filter Edit control of the Report Control behaves strangely: it erases its border and it positions the text badly.
 
There's a bug here :
 
void CXTPReportFilterEditControl::OnPaint()
{
      CPaintDC dc(this); // device context for painting
      ...
It must be : CClientDC dc(this);
 
Please fix it in the next release of Codejock.
 
Regards,


-------------
Sergio



Replies:
Posted By: Oleg
Date Posted: 18 April 2008 at 1:22pm
Think it was already changed.
 
Here is last version:
 
void CXTPReportFilterEditControl::OnPaint()
{
 if (GetWindowTextLength() == 0 && ::GetFocus() != m_hWnd)
 {
  CPaintDC dc(this); // device context for painting
  CXTPFontDC autoFont(&dc, GetFont(), GetXtremeColor(COLOR_GRAYTEXT));
  // show hint text
  CString  strText = GetHint();
  CRect rc;
  GetClientRect(&rc);
  dc.FillSolidRect(rc, GetXtremeColor(COLOR_WINDOW));
  CRect rcText;
  GetRect(&rcText);
  dc.DrawText(strText, rcText, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL);
 }
 else
 {
  Default();
 }
}
 
ps. Never use CClientDC in WM_PAINT handler.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Sergio
Date Posted: 21 April 2008 at 4:14am
Ok, thank you, here is the code of my version :
 
void CXTPReportFilterEditControl::OnPaint()
{
     CPaintDC dc(this); // device context for painting
     CString strText;
     GetWindowText(strText);
     CXTPFontDC autoFont(&dc, GetFont());
     if(GetFocus() == this || !strText.IsEmpty())
     {
          // edit is focused or not empty, show edit text
          autoFont.SetColor(GetXtremeColor(COLOR_WINDOWTEXT));
     }
     else
     {
          // show hint text
          strText = GetHint();
          autoFont.SetColor(GetXtremeColor(COLOR_GRAYTEXT));
     }
     CRect rc;
     GetClientRect(&rc);
     dc.FillSolidRect(rc, GetXtremeColor(COLOR_WINDOW));
     dc.DrawText(strText, rc, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
     // Do not call CEdit::OnPaint() for painting messages
}
The "Default();" call is missing here ---> it paints text on the whole control (no margins and borders/client area)...
 
We will upgrade.
 
Regards,


-------------
Sergio


Posted By: Sergio
Date Posted: 30 June 2008 at 4:58am
Hi,
 
Thank you, we just upgraded to the version 12.0.0 and it works fine now !
 
 


-------------
Sergio


Posted By: vijay kumar
Date Posted: 30 June 2008 at 5:04pm
Can someone provide me the documentation on using the CXTPReportFilterEditControl. The help document doesn't help me enough...
 
 
Vijay


-------------
Vijay Kumar,
India



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