Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing CDialogBar trouble

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
Hello,<br><br>I have a little trouble with the refreshing of my windows.<br><br>In fact, I'm implementing a language change during the application running.<br>The application is a MDI application, with a property sheet where you can<br>choose the language. When the user press Apply or Ok, the property sheet<br>object send to the views of the application the message USERLANGCHANGED<br>(a custom designedmessage). This message works fine.<br><br>CMyView::OnUserLangChanged is the handle for this message. In this<br>handler, I have to reload a DialogBar, thing which I done as you can<br>see below. The problem is that the concerned DialogBar doesn't refresh<br>until the user (or the programmer) minize then restore the MDIChild<br>windows. If you pass another windows over it, it&nbsp;&nbsp;doesn't refresh like<br>when an application is crashed.<br><br>I have try to Invalidate the MDIChild, with no effect, I also try<br>to call OnPaint method, without result.<br><br>I have put below declarations and the message handler. I'm working<br>with Visual C++ 6.0a, professionnal edition, service pack 3, under<br>Windows NT 4.0 Service Pack 6 (French Release).<br><br>Does anyone have an idea how to do without minimizing the MDIChild ?<br><br>Thanks a lot,<br><br>David Burg.<br><br>(Sorry for the poor english, I'm French. If you don't understand what I<br>try to say, ask for it.)<br><br>//declarations<br><br>//in Resource.h<br><br>#define IDD_VIEWPLAYPANEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;78<br><br>//in the header for CMyFrame class<br><br>class CMyDialogBar: public CDialogBar<br>{<br>[...]<br>}<br><br>class CMyFrame:CFrameWnd <br>{<br>[...]<br> //Attributes<br> public:<br> CMyDialogBar *m_wndDialogBar;<br>[...]<br>}<br><br><br>//the message handler that causes problem<br><br>void CMyView::OnUserLangChanged()<br>{<br>CFrameWnd *pParentFrame=this-&gt;GetParentFrame();<br><br>ASSERT(pParentFrame-&gt;IsKindOf(RUNTIME_CLASS(CMyFrame)));<br>CMyFrame *pMyFrame=(CMyFrame*)pParentFrame;<br><br>delete pMyFrame-&gt;m_wndDialogBar;<br>pMyFrame-&gt;m_wndDialogBar=new CMyDialogBar();<br><br>pAudioFrame-&gt;m_wndDialogBar-&gt;Create(pAudioFrame, IDD_VIEWPLAYPANEL, CBRS_TOP, IDD_VIEWPLAYPANEL); <br><br>::ShowWindow(pParentFrame-&gt;m_hWnd,SW_MINIMIZE);<br>::ShowWindow(pParentFrame-&gt;m_hWnd,SW_RESTORE);<br>}
 
Dear David,<br><br>Instead of:<br>::ShowWindow(pParentFrame-&gt;m_hWnd,SW_MINIMIZE);<br>::ShowWindow(pParentFrame-&gt;m_hWnd,SW_RESTORE);<br><br>try<br><br>m_wndDialogBar-&gt;UpdateWindow();<br><br>UpdateWindow is defined in CWnd and updates based on a region. If for some reason the dialog windows regon is empty you can invalidate it using CWnd::InvalidateRgn() prior to calling UpdateWindow()<br><br>Hope this helps<br>-pete
 
Dear Pete,<br><br>unfortunately it doesn't help. Even whit InvalidateRgn(NULL) followed by UpdateWindow(), the CDialogBar doesn't resfresh. Maybe an image will be more explicit, but I don't know if it's possible to send one on this forum.<br><br>David.
 
David,<br><br>You probably already figured it out by now... but just in case.<br><br>pMyFrame-&gt;RecalcLayout();<br>pMyFrame-&gt;RedrawWindow();<br><br>-pete
 
Dear Pete,<br><br>No, I have forgot to call the RecalcLayout method, and this was the solution. Thanks !<br><br>David.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top