Re: SDI/CFormView/TabCtrl resize problem.
- From: "Leo V." <nineballerat@xxxxxxxxxxxxxx>
- Date: Thu, 1 Dec 2005 18:32:05 -0800
Okay, maybe I misunderstood. Here's what I'm doing and it seems to work:
CMyFormView::OnSize()
{
CFormView::OnSize(nType, cx, cy);
// Get the Tab Control and resize it accordingly.
if (TRUE == ::IsWindow(m_tabsDetails.GetSafeHwnd()))
{
CRect rectForm;
GetClientRect(&rectForm); // Get size of FormView
m_tabsDetails.MoveWindow(rectForm, TRUE); // Make CTabCtrl fill
it.
m_tabsDetails.AdjustRect(FALSE, &rectForm); // Get size needed
for PropertyPage
m_tabHexView.MoveWindow(rectForm, TRUE); // Resize PropertyPage
} // then
}
Only thing I don't like is that I'm resizing both the TabCtrl and the pages
inside of my FormView. Doesn't seem very object oriented. However, it
works, so beggers can't be choosers.
Thanks again!
"Leo V." <nineballerat@xxxxxxxxxxxxxx> wrote in message
news:eWw6Lcu9FHA.252@xxxxxxxxxxxxxxxxxxxxxxx
> Thanks for the advice. AdjustRec is successfully resizing the Tab
> Control.
>
> However, in my PropertyPage derived dialog classes, when I override OnSize
> to reflow/resize the controls, I call GetClientRect() in there and it
> always returns the same size, regardless of the size of the TabCtrl. I
> think it is because they a dialog resources and GetClientRect is just
> returning the size of the resource. What I need is to get the size of the
> TabCtrl from within my PropertyPage derived classes so that I can resize
> them to fit in the TabCtrl.
>
> Now, from my FormView, where I call MyTabCtrl->AdjustRec(), I also have my
> Property Pages as member variables, perhaps I should then call their
> OnSize from that function and pass in the size of the TabCtrl? I mean, I
> think that would work, but it feels like a hack.
>
> "M" <a@xxxxx> wrote in message
> news:u4tDBes9FHA.4004@xxxxxxxxxxxxxxxxxxxxxxx
>> Try CTabCtrl::AdjustRect, with the first parameter set to FALSE.Call
>> GetClientRect from your CFormView class, then pass that rect data to
>> AdjustRect.
>>
>>
>> "leov SpamMeNot" <lviolette.SpamMeNot@xxxxxxxxxx> wrote in message
>> news:uVF9SYs9FHA.472@xxxxxxxxxxxxxxxxxxxxxxx
>>>I have an SDI App. One of the views is a CFormView. In the CFormView, I
>>>have placed a CTabCtrl. Now, I want to resize the Tab Control as
>>>necessary if the app itself is resized. I believe I have successfully
>>>done that as I can see the TabCtrl resize as I resize the window.
>>>
>>> However, the dialog that lives in a particular tab (CPropertyPage), when
>>> he gets an OnSize event, I want to reflow the controls there (actually,
>>> one control and I want it to take up the whole tab). When in my
>>> property page OnSize though, I do a GetClientRect and it always returns
>>> the same size (I believe the size of the dialog resource). What I want
>>> is the size of the Client area of the Tab Control so that I can resize
>>> the property page to it. For some reason, I'm having difficulty
>>> obtaining that from within my Property Page. Is there a method that can
>>> retrieve the CTabCtrl CWnd object from within the property page? I
>>> couldn't find one. I'm about to go down the path of passing a pointer
>>> to CWnd from the FormView into each page.
>>>
>>
>>
>
>
.
- Follow-Ups:
- References:
- SDI/CFormView/TabCtrl resize problem.
- From: leov SpamMeNot
- Re: SDI/CFormView/TabCtrl resize problem.
- From: M
- Re: SDI/CFormView/TabCtrl resize problem.
- From: Leo V.
- SDI/CFormView/TabCtrl resize problem.
- Prev by Date: Re: CDialog::Create() returns 0
- Next by Date: Re: Assert during label edit in CtreeView
- Previous by thread: Re: SDI/CFormView/TabCtrl resize problem.
- Next by thread: Re: SDI/CFormView/TabCtrl resize problem.
- Index(es):
Relevant Pages
|