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 & color Collapse All
Subject Author Date
Riccardo Parenzan May 15, 2008 - 2:10 AM

Hello,

I’ve developed a small application to learn Prof-UIS library.

 

In a CExtNCW < CExtResizableDialog > I put an CExtEdit (m_Edt1) and a CExtLabel (m_StcLabel), like this code...

 


CFont cf;


LOGFONT lf;


memset(&lf, 0, sizeof(LOGFONT));


lf.lfHeight = 40;


strcpy(lf.lfFaceName, "Arial");


cf.CreateFontIndirect(&lf);


m_StcLabel.SetTextColor(1,RGB(255, 0, 0));


m_StcLabel.SetFont(&cf);


m_Edt1.SetTextColor(RGB(255, 0, 0));


m_Edt1.SetFont(&cf);


 


m_StcLabel works fine, is red with correct font, but m_Edt1 is red, with a big cursor, but the font is not 40.


Have you some suggestion ?


Thanks in advance


Technical Support May 17, 2008 - 12:32 PM

It seems we already answered you by e-mail. Here is our answer:

You created a CFont object on stack. The cf variable is local in scope of the method where you set the font. That means it will be destroyed after the method completes. You should create the CFont object dynamically or declare it in the class declaration section.