Print Page | Close Window

Resource abnormal paint

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=3251
Printed Date: 12 May 2024 at 5:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Resource abnormal paint
Posted By: zhou_wz
Subject: Resource abnormal paint
Date Posted: 21 November 2005 at 5:31am

When I run 9.6
GuiVisualStudio7
samples_suite_vc60

That is GUI_VisualStudio7.exe + XTP9601Lib.dll

It shows normally like expected.
But after several hours later, I find the font in outputbox changed:
Not the font in grogrammed
line 444 in MainFrm.cpp
It becomes into default font...

Why this happpened.

 




Replies:
Posted By: zhou_wz
Date Posted: 21 November 2005 at 5:38am


Posted By: zhou_wz
Date Posted: 21 November 2005 at 6:41pm

But later it becames like...



Posted By: Oleg
Date Posted: 21 November 2005 at 11:39pm

Yes, the line

m_wndOutput.SetFont(XTPPaintManager()->GetRegularFont());

good for sample, but not for real application, because CXTPPaintManager::m_fontRegular will be changed after Theme/System Colors changed.

In your application better add local variable CFont m_fntOutput and create it for Pane. (to be sure it never changed)



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


Posted By: zhou_wz
Date Posted: 23 November 2005 at 3:13am

But the system configuration never changed during the sample run.
And another status is :The folderbox in treectrl(that is the +/- button) will shrink after long time running.



Posted By: zhou_wz
Date Posted: 23 November 2005 at 3:16am
So I wonder who changed this...


Posted By: A42_
Date Posted: 23 May 2006 at 4:05pm
Originally posted by zhou_wz zhou_wz wrote:

But later it becames like...



I have a similar problem (Toolkit v9.8) where fonts in certain windows get changed to the System font. This happens whenever the application receives a WM_SETTINGCHANGE as well as under other (not yet identified) circumstances.

Additionally, I have a control derived from CXTTreeCtrl in the same app. When the WM_SETTINGCHANGE is processed its font is also messed up. I added a handler for WM_GETFONT like this:

    HFONT hFont = (HFONT)Default();

    LOGFONT lf;
    ::GetObject( hFont, sizeof LOGFONT, &lf );
   
    return (LRESULT)hFont;

Looking at the contents of the LOGFONT structure the HFONT returned is obviously bad: the lfHeight, lfWidth, lfEscapement, lfOrientation, and lfWeight members are all set to -858993460.

Also -- if I return NULL from this handler (to indicate that the control should be drawn using the system font) the program crashes when CXTTreeBase dereferences the NULL CFont pointer.

I also did another test here and verified that:

1) Before the WM_SETTINGCHANGE the font is the same as PaintManager's "Regular" font.

2) After the WM_SETTINGCHANGE the font is NOT the same as the "Regular" font -- it's the same as the OLD regular font.

In short, it looks like the "regular" font is getting destroyed and re-created but that the windows that use it are not updated.



Posted By: Oleg
Date Posted: 23 May 2006 at 4:52pm

Just don't use font from PaintManager. Creat variable for class, and create font.

it happened because font in PaintManager recreated if system settings are changed. So previously handle not valid anymore...

 



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


Posted By: A42_
Date Posted: 23 May 2006 at 5:12pm
Originally posted by oleg oleg wrote:

Just don't use font from PaintManager. Creat variable for class, and create font.

it happened because font in PaintManager recreated if system settings are changed. So previously handle not valid anymore...

 



What about classes that already use PaintManager's fonts? Like CXTTreeCtrl, CXTListView, etc? I'm deriving from those classes and not doing anything to change their fonts.



Posted By: Oleg
Date Posted: 24 May 2006 at 9:18am

Hello,

CXTTreeCtrl, CXTListView classes not use PaintManager's font. You must set it.



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


Posted By: A42_
Date Posted: 24 May 2006 at 5:56pm
Originally posted by oleg oleg wrote:

Hello,

CXTTreeCtrl, CXTListView classes not use PaintManager's font. You must set it.



As it turns out, it's the CDockPaneWnd<> template that's responsible. From DockPaneWnd.h:


case WM_CREATE:
{
   if (BASE_CLASS::WindowProc(message, wParam, lParam) == -1)
       return -1;

   SetFont(XTPPaintManager()->GetRegularFont());

   return 0;
}




Posted By: Oleg
Date Posted: 25 May 2006 at 12:32pm

Hi,

just remove this line... it is part of application, not toolkitpro...



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


Posted By: A42_
Date Posted: 25 May 2006 at 1:34pm
Originally posted by oleg oleg wrote:

Hi,

just remove this line... it is part of application, not toolkitpro...



It is part of the sample code you provide showing how to use the toolkit. I can't imagine that I'm the only one to encounter this problem. A better solution would be to add something like the following to the CDockPaneWnd<> template:


case WM_SETTINGCHANGE :
    SetFont( XTPPaintManager()->GetRegularFont() );
    return 0L;




Posted By: Oleg
Date Posted: 25 May 2006 at 1:43pm

Hi,

in 10.0/10.1 this line was removed already....



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



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