Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtEdit Font changes Collapse All
Subject Author Date
Torsten Schucht Jul 3, 2009 - 8:10 AM

Dear Support,


I have dynamically created a CExtSpinWnd which is buddied to a dynamically created CExtEdit (see code snippet). The text in the CExtEdit control is always bold and larger than the standard font in other controls.


 


...

DWORD uSpinStyle = WS_CHILD | WS_VISIBLE | UDS_ARROWKEYS | UDS_ALIGNRIGHT | UDS_WRAP;

m_wndSpin.Create(uSpinStyle, SpinRect, this, eID_SPIN); DWORD uEditStyle = WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP | WS_BORDER; m_wndEdit.Create( uEditStyle, EditRect, this, eID_EDIT);     m_wndSpin.SetBuddy(&m_wndEdit); m_wndSpin.SetBase(p_bHex ? 16 : 10); SetRange(p_nMinimum, p_nMaximum);

..



Do I have to set a certain style? Any suggestions?


Thanks,


Torsten


 


 

Technical Support Oct 15, 2009 - 1:02 PM

Did you assign any font to your dynamically created controls? Did you invoke something like this:

CWnd * pWndDynamicallyCreated = . . .
pWndDynamicallyCreated->SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) );



Torsten Schucht Oct 16, 2009 - 6:30 AM

This is what you already wrote in the last reply back in July too. I applied this change to my code and set the font for each dynamically created control as you suggested. This works fine. But when the Theme is changed by the user or (which is worse) when the screensafer was on most of the controls are painted with a wrong font (a bold and large font, looks like win 3.1).


Is there anything additional I need to do, e.g. handle a special message to update the font in the described cases?


 

Technical Support Oct 16, 2009 - 1:25 PM

We guess the Windows 3.1 like font you meant is the System font. Windows using it automatically if some process have the GDI handle leaks and the number of GDI handles reaches 10000. Please check your application using the Windows Task Manager that is invoked on the Ctrl+Shift+Esc key combination. The processes tab in it displays the running processes and statistic information related to each process. You can display the GDI Objects column and check the real number of GDI handles occupied by your application before theme changing and/or screen saver activation and after.

Torsten Schucht Oct 19, 2009 - 8:29 AM

I have checked the GDI handles. They are in the range of 300. So this could not be the problem.


I am also trying to isolate and reproduce the behaviour in a simple dialog based application but I am noct able to create this error there.


I am supposing that at some point my application might suppress a message or handle it at the wrong point.


 

Technical Support Oct 19, 2009 - 8:35 AM

Please try to comment different parts of your project and find some configuration of it which have no problems with fonts. Then uncomment the previously commented parts one by one until the problem return. This will let you to localize part of your project which generates the problem (or Prof-UIS components used in it).

Torsten Schucht Oct 21, 2009 - 5:04 AM

OK. I got it!  I called the SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) ) for all my dynamically created controls, but I did not call it for the dynamically created parent windows.


Thanks for your support.


Torsten

Technical Support Jul 3, 2009 - 1:00 PM

You forgot to assign the desired font to your dynamically created edit window:

pEdit->SetFont( CFont::FromHandle( (HFONT) ::GetStockObject( DEFAULT_GUI_FONT ) ) );
The edit windows created inside the dialog window have the correct font because the dialog loading code assigns the fonts to all the dialog items.


Torsten Schucht Oct 14, 2009 - 2:20 AM

I have now another issue with the font of several controls in my application (all the controls are created dynamically): After changing the theme or after locking my computer and logging back in, the font is somehow set to bold and large.


This effect applies to both ProfUIS based controls and standard mfc controls. This effect was not there before I integrated ProfUIS into the application. 


Any idea’s ?