Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Resource abnormal paint
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Resource abnormal paint

 Post Reply Post Reply
Author
Message
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post Topic: Resource abnormal paint
    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.

 

Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post Posted: 21 November 2005 at 5:38am
Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post Posted: 21 November 2005 at 6:41pm

But later it becames like...

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post Posted: 23 November 2005 at 3:16am
So I wonder who changed this...
Back to Top
A42_ View Drop Down
Newbie
Newbie


Joined: 18 January 2006
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote A42_ Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
A42_ View Drop Down
Newbie
Newbie


Joined: 18 January 2006
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote A42_ Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
A42_ View Drop Down
Newbie
Newbie


Joined: 18 January 2006
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote A42_ Quote  Post ReplyReply Direct Link To This Post 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;
}


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
A42_ View Drop Down
Newbie
Newbie


Joined: 18 January 2006
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote A42_ Quote  Post ReplyReply Direct Link To This Post 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;


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2006 at 1:43pm

Hi,

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

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.281 seconds.