Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Manage Timer on MFC Pin
CDRAIN19-Apr-07 23:34
CDRAIN19-Apr-07 23:34 
GeneralRe: Manage Timer on MFC Pin
Roger Stoltz23-Apr-07 23:53
Roger Stoltz23-Apr-07 23:53 
QuestionHow you size your views? Pin
baerten17-Apr-07 23:11
baerten17-Apr-07 23:11 
AnswerRe: How you size your views? Pin
Mark Salsbery18-Apr-07 6:28
Mark Salsbery18-Apr-07 6:28 
GeneralRe: How you size your views? Pin
baerten18-Apr-07 21:26
baerten18-Apr-07 21:26 
GeneralRe: How you size your views? Pin
Mark Salsbery19-Apr-07 8:07
Mark Salsbery19-Apr-07 8:07 
GeneralRe: How you size your views? Pin
baerten19-Apr-07 23:10
baerten19-Apr-07 23:10 
GeneralRe: How you size your views? Pin
Mark Salsbery20-Apr-07 7:26
Mark Salsbery20-Apr-07 7:26 
I do all the MoveWindow() calls in response to WM_SIZE in the parent windows.

Your outer frame window's OnSize() handler should call MoveWindow() for the Tab window.

The tab window's OnSize() handler should resize the control and reposition the active view.
I personally use ::BeginDeferWindowPos()/::DeferWindowPos()/::EndDeferWindowPos() to do the two
movewindows simultaneously. It performs well.

The tab view window's OnSize() handler should call MoveWindow() for all the controls that need to
be repositioned.

And so on...

I would take a look at how you are resizing your tab window. I bet the problem is there Smile | :)

In my code, the tab controls are attached to the frame window in an OnCreateClient() override
so MFC handles repositioning the tab control to fit the window.
In the tab control's OnSize() handler (I had to derive from the CTabCtrl class to do this) I
do the two window resizes I mentioned above. The code is like this:
void CMainFrameTabCtrl::OnSize(UINT nType, int cx, int cy) 
{
   CTabCtrl::OnSize(nType, cx, cy);
 	
   if (pMainFrame && ::IsWindow(*pMainFrame))
      pMainFrame->TabWindowResize();
}
...
...
void CMainFrame::TabWindowResize()
{
   if (pTabs && (pTabs->m_hWnd != 0))
   {
      CRect CliRect;
      pTabs->GetWindowRect(&CliRect);
      ::MapWindowPoints(0, *pTabs, (LPPOINT)&CliRect, 2);
 
      // Get the tab control's "client rect", the drawable area of the control.
      TabClientRect = CliRect;
      pTabs->AdjustRect(false, &TabClientRect);
 
      ::MapWindowPoints(*pTabs, *this, (LPPOINT)&TabClientRect, 2);
 
      // Move/resize the tab window AND the current tab "client" window.  Make
      //    sure "client" window is always drawn on TOP of the tab control.
      int i = pTabs->GetCurSel();
      if (i >= 0 && TabClients[i] && TabClients[i]->m_hWnd)
      {
         HDWP hDwp;
         if ((hDwp = ::BeginDeferWindowPos(2)) != 0)
         {
            hDwp = ::DeferWindowPos(hDwp,*pTabs,0,0,0,
                                       CliRect.Width(),CliRect.Height(),
                                                   SWP_NOMOVE | SWP_NOZORDER);
            hDwp = ::DeferWindowPos(hDwp,*TabClients[i], HWND_TOP,
                                    TabClientRect.left,TabClientRect.top,
                              TabClientRect.Width(),TabClientRect.Height(), 0);
            ::EndDeferWindowPos(hDwp);
         }
      }
   }
}

I hope that helps a bit!

Mark






"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

Question_splitpath Issue Pin
Programm3r17-Apr-07 22:54
Programm3r17-Apr-07 22:54 
AnswerRe: _splitpath Issue Pin
Cedric Moonen17-Apr-07 23:21
Cedric Moonen17-Apr-07 23:21 
GeneralRe: _splitpath Issue Pin
Programm3r18-Apr-07 0:49
Programm3r18-Apr-07 0:49 
QuestionWhere to create font and set it to owner drawn menu Pin
Atul2317-Apr-07 22:48
Atul2317-Apr-07 22:48 
AnswerRe: Where to create font and set it to owner drawn menu Pin
Hamid_RT18-Apr-07 1:41
Hamid_RT18-Apr-07 1:41 
Questioncolor of a button Pin
p_17-Apr-07 22:20
p_17-Apr-07 22:20 
AnswerRe: color of a button Pin
Hamid_RT17-Apr-07 22:22
Hamid_RT17-Apr-07 22:22 
GeneralRe: color of a button Pin
p_17-Apr-07 22:34
p_17-Apr-07 22:34 
GeneralRe: color of a button Pin
Hamid_RT18-Apr-07 1:28
Hamid_RT18-Apr-07 1:28 
GeneralRe: color of a button Pin
Hamid_RT18-Apr-07 1:32
Hamid_RT18-Apr-07 1:32 
GeneralRe: color of a button Pin
Mark Salsbery18-Apr-07 6:29
Mark Salsbery18-Apr-07 6:29 
QuestionDeclare Friend with a template class in Visual C++ 2005 Pin
Nacho Chip17-Apr-07 21:39
Nacho Chip17-Apr-07 21:39 
QuestionThe file contains a character that cannot be represented in the current code page Pin
Nacho Chip17-Apr-07 21:34
Nacho Chip17-Apr-07 21:34 
AnswerRe: The file contains a character that cannot be represented in the current code page Pin
Rajesh R Subramanian17-Apr-07 21:39
professionalRajesh R Subramanian17-Apr-07 21:39 
GeneralRe: The file contains a character that cannot be represented in the current code page Pin
Nacho Chip17-Apr-07 21:41
Nacho Chip17-Apr-07 21:41 
GeneralRe: The file contains a character that cannot be represented in the current code page Pin
Rajesh R Subramanian17-Apr-07 21:46
professionalRajesh R Subramanian17-Apr-07 21:46 
AnswerRe: The file contains a character that cannot be represented in the current code page Pin
Hamid_RT17-Apr-07 21:51
Hamid_RT17-Apr-07 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.