0

I got an instance of MYListCtrl which is derived class from the CListCtrl within CTabCtrl instance. I have implemented onSize method for MYCListCtrl, and mapped it to the WM_SIZE message.

I want to change size of MYListCtrl when window which includes CTabCtrl is resized, resizing should be based on the dimensions of CTabCtrl. How can I notify MYListCtrl what resizing is needed?

spin_eight
  • 3,925
  • 10
  • 39
  • 61

1 Answers1

3

You need to implement onsize for the parent, i.e. the tab control. When the tab control.onresize is called it should in turn resize the list control. With setwindopos you can resize your list control. Something like this:

void MyTabControl::OnSize(UINT nType, int cx, int cy)
{
    m_ListControl.SetWindowPos(/*various parameters */);
}
Rich
  • 4,572
  • 3
  • 25
  • 31
  • I don`t have m_list.. as a member of MyTabControl. I get Tabcontrol from the property sheet – spin_eight Apr 26 '13 at 11:21
  • The parent that's actually being resized needs to call setwindowpos on it's children. And in turn each child control that wants to resize/position it's children needs to call setwindopos on it's children etc etc. You probably have to start handling onsize from the containing window down to the last child control you want resized or repositioned. – Rich Apr 26 '13 at 11:48