Property Sheets (Tabs in a dialog)

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Thu, 24 Jun 1999 04:00:00



I want to create and application created with VC++ 6.0 that is a CPropertySheet. Just like what you see in a control panel like "Network" or "Console"

The problem I am having is how to do it. CPropertySheet seems to always want to be a sub-dialog.

Does anyone know where I might find an example of doing this?

Thanks in advance for any suggestions,

Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Alex Blekhma » Fri, 25 Jun 1999 04:00:00


WIZARD97 is the sample you need. It's intended to WinNT 5.0 or Win98, but with WinNT 4.0 SP3
and VC++ 6.0 Pro it works fine.

> I want to create and application created with VC++ 6.0 that is a CPropertySheet. Just like what you see in a control panel like "Network" or "Console"

> The problem I am having is how to do it. CPropertySheet seems to always want to be a sub-dialog.

> Does anyone know where I might find an example of doing this?

> Thanks in advance for any suggestions,

> Chris


 
 
 

Property Sheets (Tabs in a dialog)

Post by Greg Bolles - Microsof » Fri, 25 Jun 1999 04:00:00


Use the MFC App Wizard to create a dialog-based app.  Get rid of the
CDialog-based class that is auto-generated by the wizard and create a new
CPropertySheet-based class using Class Wizard.  Also create as many
CPropertyPage-based classes (and associated dialog resources) as needed for
your tab pages.  In the InitInstance member function for your app class,
replace the CDialog-based local object declaration and DoModal call with an
object declaration of your CPropertySheet-based class and a call to its
DoModal function.


Quote:

> I want to create and application created with VC++ 6.0 that is a

CPropertySheet. Just like what you see in a control panel like "Network" or
"Console"
Quote:

> The problem I am having is how to do it. CPropertySheet seems to always

want to be a sub-dialog.
Quote:

> Does anyone know where I might find an example of doing this?

> Thanks in advance for any suggestions,

> Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Dave » Fri, 25 Jun 1999 04:00:00


Using class wizard make a project that has a dialog for a main window.  In resource
editor, make your property sheet and pages as you normally would.  Then in the
xxxApp.cpp file find the InitInstance function.  There will be a section of code similar
to :

   CAppsDlg dlg;
   m_pMainWnd = &dlg;

Just change the CAppsDlg to your property sheet.  (Don't forget to include the header file)
That should be all you need to do.

Dave


> I want to create and application created with VC++ 6.0 that is a CPropertySheet. Just like what you see in a control panel like "Network" or "Console"

> The problem I am having is how to do it. CPropertySheet seems to always want to be a sub-dialog.

> Does anyone know where I might find an example of doing this?

> Thanks in advance for any suggestions,

> Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Tue, 29 Jun 1999 04:00:00


Hi Dave,

Did you really mean to create a property sheet resource?

If so, what is the resource type? When I choose "Insert..." there are IDD_PROPPAGE* selections, but nothing listed as a property sheet.

I can choose "Custom...", but then I need to specify the resource type.

Chris


> Using class wizard make a project that has a dialog for a main window.  In resource
> editor, make your property sheet and pages as you normally would.  Then in the
> xxxApp.cpp file find the InitInstance function.  There will be a section of code similar
> to :

>    CAppsDlg dlg;
>    m_pMainWnd = &dlg;

> Just change the CAppsDlg to your property sheet.  (Don't forget to include the header file)
> That should be all you need to do.

> Dave


> > I want to create and application created with VC++ 6.0 that is a CPropertySheet. Just like what you see in a control panel like "Network" or "Console"

> > The problem I am having is how to do it. CPropertySheet seems to always want to be a sub-dialog.

> > Does anyone know where I might find an example of doing this?

> > Thanks in advance for any suggestions,

> > Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Tue, 29 Jun 1999 04:00:00


I've looked at the resources I have online as well as msdn without luck. It is possible that I have not looked in the right place, or, this question is too simple to actually be written down.

I have a dialog application. To the dialog, I have added a CTabCtrl class variable named m_tab.

Then, in OnInitDialog() I added the following:

BOOL CULServerDlg::OnInitDialog()
{
...
    // TODO: Add extra initialization here
    TC_ITEM TabCtrlItem;
    TabCtrlItem.mask = TCIF_TEXT;
    TabCtrlItem.pszText = "TAB 1";
    m_tab.InsertItem( 0, &TabCtrlItem );
    TabCtrlItem.pszText = "TAB 2";
    m_tab.InsertItem( 1, &TabCtrlItem );
...

Quote:}

My difficulty is that I am not finding out how to show controls on the two tabs when they are in front.

I already looked at the FIRE demo, and it's just showing an image. And the image is kept in all of the tabs so I do not see really how to display/change different controls for different tabs.

Also, can someone tell be a definition for "owner-drawn" and non-owner-drawn? And, which applies to CTabCtrl?

Thanks for any advice,

Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Oleg Pilipenk » Tue, 29 Jun 1999 04:00:00


Here is a snippet from my code:

void CRepBrowseCtrl::DoSelectTab(int nTab)
{
 m_pPage[m_nCurTab]->ShowWindow(FALSE);
 m_nCurTab = nTab;
 m_pPage[m_nCurTab]->ShowWindow(TRUE);

 // Adjust current page size
 RECT rc;
 GetWindowRect(&rc);
 ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);

Quote:}

where m_pPage is an array of dialogs. This is a snippet from an ATL-based
project, though I believe it contains enough info to do it in MFC.

Good luck!

Oleg


Quote:

> I've looked at the resources I have online as well as msdn without luck.

It is possible that I have not looked in the right place, or, this question
is too simple to actually be written down.
Quote:

> I have a dialog application. To the dialog, I have added a CTabCtrl class

variable named m_tab.
Quote:

> Then, in OnInitDialog() I added the following:

> BOOL CULServerDlg::OnInitDialog()
> {
> ...
>     // TODO: Add extra initialization here
>     TC_ITEM TabCtrlItem;
>     TabCtrlItem.mask = TCIF_TEXT;
>     TabCtrlItem.pszText = "TAB 1";
>     m_tab.InsertItem( 0, &TabCtrlItem );
>     TabCtrlItem.pszText = "TAB 2";
>     m_tab.InsertItem( 1, &TabCtrlItem );
> ...
> }

> My difficulty is that I am not finding out how to show controls on the two

tabs when they are in front.
Quote:

> I already looked at the FIRE demo, and it's just showing an image. And the

image is kept in all of the tabs so I do not see really how to
display/change different controls for different tabs.
Quote:

> Also, can someone tell be a definition for "owner-drawn" and

non-owner-drawn? And, which applies to CTabCtrl?

- Show quoted text -

Quote:

> Thanks for any advice,

> Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Thu, 01 Jul 1999 04:00:00


Thanks for the response Oleg!

I still have a question about your response though:

What kind of dialogs are these (Overlapped, Popup, Child)?

Did you have to position the upper left hand corner of these dialogs, or were they tied to something in the main dialog?

Thanks,

Chris


> Here is a snippet from my code:

> void CRepBrowseCtrl::DoSelectTab(int nTab)
> {
>  m_pPage[m_nCurTab]->ShowWindow(FALSE);
>  m_nCurTab = nTab;
>  m_pPage[m_nCurTab]->ShowWindow(TRUE);

>  // Adjust current page size
>  RECT rc;
>  GetWindowRect(&rc);
>  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> }

> where m_pPage is an array of dialogs. This is a snippet from an ATL-based
> project, though I believe it contains enough info to do it in MFC.

> Good luck!

> Oleg



> > I've looked at the resources I have online as well as msdn without luck.
> It is possible that I have not looked in the right place, or, this question
> is too simple to actually be written down.

> > I have a dialog application. To the dialog, I have added a CTabCtrl class
> variable named m_tab.

> > Then, in OnInitDialog() I added the following:

> > BOOL CULServerDlg::OnInitDialog()
> > {
> > ...
> >     // TODO: Add extra initialization here
> >     TC_ITEM TabCtrlItem;
> >     TabCtrlItem.mask = TCIF_TEXT;
> >     TabCtrlItem.pszText = "TAB 1";
> >     m_tab.InsertItem( 0, &TabCtrlItem );
> >     TabCtrlItem.pszText = "TAB 2";
> >     m_tab.InsertItem( 1, &TabCtrlItem );
> > ...
> > }

> > My difficulty is that I am not finding out how to show controls on the two
> tabs when they are in front.

> > I already looked at the FIRE demo, and it's just showing an image. And the
> image is kept in all of the tabs so I do not see really how to
> display/change different controls for different tabs.

> > Also, can someone tell be a definition for "owner-drawn" and
> non-owner-drawn? And, which applies to CTabCtrl?

> > Thanks for any advice,

> > Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Oleg Pilipenk » Thu, 01 Jul 1999 04:00:00


They are child, without border. Positioning of a child dialog inside tab
control is done in the ResizeCurrentPage(). It is also called from the
OnCreate/OnInitDialog of the parent for the page that is selected by
default.

Oleg


Quote:

> Thanks for the response Oleg!

> I still have a question about your response though:

> What kind of dialogs are these (Overlapped, Popup, Child)?

> Did you have to position the upper left hand corner of these dialogs, or

were they tied to something in the main dialog?

> Thanks,

> Chris


> > Here is a snippet from my code:

> > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > {
> >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> >  m_nCurTab = nTab;
> >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> >  // Adjust current page size
> >  RECT rc;
> >  GetWindowRect(&rc);
> >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > }

> > where m_pPage is an array of dialogs. This is a snippet from an
ATL-based
> > project, though I believe it contains enough info to do it in MFC.

> > Good luck!

> > Oleg



> > > I've looked at the resources I have online as well as msdn without
luck.
> > It is possible that I have not looked in the right place, or, this
question
> > is too simple to actually be written down.

> > > I have a dialog application. To the dialog, I have added a CTabCtrl
class
> > variable named m_tab.

> > > Then, in OnInitDialog() I added the following:

> > > BOOL CULServerDlg::OnInitDialog()
> > > {
> > > ...
> > >     // TODO: Add extra initialization here
> > >     TC_ITEM TabCtrlItem;
> > >     TabCtrlItem.mask = TCIF_TEXT;
> > >     TabCtrlItem.pszText = "TAB 1";
> > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > >     TabCtrlItem.pszText = "TAB 2";
> > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > ...
> > > }

> > > My difficulty is that I am not finding out how to show controls on the
two
> > tabs when they are in front.

> > > I already looked at the FIRE demo, and it's just showing an image. And
the
> > image is kept in all of the tabs so I do not see really how to
> > display/change different controls for different tabs.

> > > Also, can someone tell be a definition for "owner-drawn" and
> > non-owner-drawn? And, which applies to CTabCtrl?

> > > Thanks for any advice,

> > > Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Fri, 02 Jul 1999 04:00:00


Hi again Oleg,

I have the child dialogs set up and displaying. My last problem has to do with sizing and positioning these child dialogs such that they fall within the tab control (I cannot find ResizeCurrentPage() in any of the documentation I have). When I show the child dialogs, the appears in the upper left hand corner of the dialog.

I think I only have two questions left to get this finished:

1) I get the rectangle of the tab control so that I know where to place the child dialogs, but this rectangle includes the tabs. Is there a constant or something that indicates how tall the tabs are so that I can take that into account?

Or, are you placing a dialog item over the tab control defining the area of the tab control in which you wanted the child dialogs to appear?

2) Since I do not have a ResizeCurrentPage(), I was trying to do it with SetWindowPos() which, I discovered, sets that main dialog position (I was using the syntax "myChildDlg.FromHandle(myChildDlg.m_hWnd)" in SetWindowPos()).

I cannot find a method to adjust the size/position of the child dialogs, can you please point me in the right direction?

Thank you so much,

Chris


> They are child, without border. Positioning of a child dialog inside tab
> control is done in the ResizeCurrentPage(). It is also called from the
> OnCreate/OnInitDialog of the parent for the page that is selected by
> default.

> Oleg



> > Thanks for the response Oleg!

> > I still have a question about your response though:

> > What kind of dialogs are these (Overlapped, Popup, Child)?

> > Did you have to position the upper left hand corner of these dialogs, or
> were they tied to something in the main dialog?

> > Thanks,

> > Chris


> > > Here is a snippet from my code:

> > > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > > {
> > >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> > >  m_nCurTab = nTab;
> > >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> > >  // Adjust current page size
> > >  RECT rc;
> > >  GetWindowRect(&rc);
> > >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > > }

> > > where m_pPage is an array of dialogs. This is a snippet from an
> ATL-based
> > > project, though I believe it contains enough info to do it in MFC.

> > > Good luck!

> > > Oleg



> > > > I've looked at the resources I have online as well as msdn without
> luck.
> > > It is possible that I have not looked in the right place, or, this
> question
> > > is too simple to actually be written down.

> > > > I have a dialog application. To the dialog, I have added a CTabCtrl
> class
> > > variable named m_tab.

> > > > Then, in OnInitDialog() I added the following:

> > > > BOOL CULServerDlg::OnInitDialog()
> > > > {
> > > > ...
> > > >     // TODO: Add extra initialization here
> > > >     TC_ITEM TabCtrlItem;
> > > >     TabCtrlItem.mask = TCIF_TEXT;
> > > >     TabCtrlItem.pszText = "TAB 1";
> > > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > > >     TabCtrlItem.pszText = "TAB 2";
> > > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > > ...
> > > > }

> > > > My difficulty is that I am not finding out how to show controls on the
> two
> > > tabs when they are in front.

> > > > I already looked at the FIRE demo, and it's just showing an image. And
> the
> > > image is kept in all of the tabs so I do not see really how to
> > > display/change different controls for different tabs.

> > > > Also, can someone tell be a definition for "owner-drawn" and
> > > non-owner-drawn? And, which applies to CTabCtrl?

> > > > Thanks for any advice,

> > > > Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Oleg Pilipenk » Fri, 02 Jul 1999 04:00:00


ResizeCurrentPage is a wrapper around SetWindowPos:

void CRepBrowseCtrl::ResizeCurrentPage(int cx, int cy)
{
 int cxPage = cx - 8;
 int cyPage = cy - 32;
 ::SetWindowPos(m_pPage[m_nCurTab]->m_hWnd,
     NULL,
     4,
     4,
     cxPage,
     cyPage,
     SWP_NOZORDER | SWP_NOACTIVATE);

Quote:}

It works OK for me, though to be absolutely precise, instead of using 8 and
32 you have to calculate those deltas using Windows metrics.

Oleg


Quote:

> Hi again Oleg,

> I have the child dialogs set up and displaying. My last problem has to do

with sizing and positioning these child dialogs such that they fall within
the tab control (I cannot find ResizeCurrentPage() in any of the
documentation I have). When I show the child dialogs, the appears in the
upper left hand corner of the dialog.
Quote:

> I think I only have two questions left to get this finished:

> 1) I get the rectangle of the tab control so that I know where to place

the child dialogs, but this rectangle includes the tabs. Is there a constant
or something that indicates how tall the tabs are so that I can take that
into account?
Quote:

> Or, are you placing a dialog item over the tab control defining the area

of the tab control in which you wanted the child dialogs to appear?
Quote:

> 2) Since I do not have a ResizeCurrentPage(), I was trying to do it with

SetWindowPos() which, I discovered, sets that main dialog position (I was
using the syntax "myChildDlg.FromHandle(myChildDlg.m_hWnd)" in
SetWindowPos()).
Quote:

> I cannot find a method to adjust the size/position of the child dialogs,

can you please point me in the right direction?

> Thank you so much,

> Chris


> > They are child, without border. Positioning of a child dialog inside tab
> > control is done in the ResizeCurrentPage(). It is also called from the
> > OnCreate/OnInitDialog of the parent for the page that is selected by
> > default.

> > Oleg



> > > Thanks for the response Oleg!

> > > I still have a question about your response though:

> > > What kind of dialogs are these (Overlapped, Popup, Child)?

> > > Did you have to position the upper left hand corner of these dialogs,
or
> > were they tied to something in the main dialog?

> > > Thanks,

> > > Chris


> > > > Here is a snippet from my code:

> > > > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > > > {
> > > >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> > > >  m_nCurTab = nTab;
> > > >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> > > >  // Adjust current page size
> > > >  RECT rc;
> > > >  GetWindowRect(&rc);
> > > >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > > > }

> > > > where m_pPage is an array of dialogs. This is a snippet from an
> > ATL-based
> > > > project, though I believe it contains enough info to do it in MFC.

> > > > Good luck!

> > > > Oleg



> > > > > I've looked at the resources I have online as well as msdn without
> > luck.
> > > > It is possible that I have not looked in the right place, or, this
> > question
> > > > is too simple to actually be written down.

> > > > > I have a dialog application. To the dialog, I have added a
CTabCtrl
> > class
> > > > variable named m_tab.

> > > > > Then, in OnInitDialog() I added the following:

> > > > > BOOL CULServerDlg::OnInitDialog()
> > > > > {
> > > > > ...
> > > > >     // TODO: Add extra initialization here
> > > > >     TC_ITEM TabCtrlItem;
> > > > >     TabCtrlItem.mask = TCIF_TEXT;
> > > > >     TabCtrlItem.pszText = "TAB 1";
> > > > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > > > >     TabCtrlItem.pszText = "TAB 2";
> > > > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > > > ...
> > > > > }

> > > > > My difficulty is that I am not finding out how to show controls on
the
> > two
> > > > tabs when they are in front.

> > > > > I already looked at the FIRE demo, and it's just showing an image.
And
> > the
> > > > image is kept in all of the tabs so I do not see really how to
> > > > display/change different controls for different tabs.

> > > > > Also, can someone tell be a definition for "owner-drawn" and
> > > > non-owner-drawn? And, which applies to CTabCtrl?

> > > > > Thanks for any advice,

> > > > > Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Fri, 02 Jul 1999 04:00:00


Thanks you very much for all your help :^)

I really apreciate it!

Chris


> ResizeCurrentPage is a wrapper around SetWindowPos:

> void CRepBrowseCtrl::ResizeCurrentPage(int cx, int cy)
> {
>  int cxPage = cx - 8;
>  int cyPage = cy - 32;
>  ::SetWindowPos(m_pPage[m_nCurTab]->m_hWnd,
>      NULL,
>      4,
>      4,
>      cxPage,
>      cyPage,
>      SWP_NOZORDER | SWP_NOACTIVATE);
> }

> It works OK for me, though to be absolutely precise, instead of using 8 and
> 32 you have to calculate those deltas using Windows metrics.

> Oleg



> > Hi again Oleg,

> > I have the child dialogs set up and displaying. My last problem has to do
> with sizing and positioning these child dialogs such that they fall within
> the tab control (I cannot find ResizeCurrentPage() in any of the
> documentation I have). When I show the child dialogs, the appears in the
> upper left hand corner of the dialog.

> > I think I only have two questions left to get this finished:

> > 1) I get the rectangle of the tab control so that I know where to place
> the child dialogs, but this rectangle includes the tabs. Is there a constant
> or something that indicates how tall the tabs are so that I can take that
> into account?

> > Or, are you placing a dialog item over the tab control defining the area
> of the tab control in which you wanted the child dialogs to appear?

> > 2) Since I do not have a ResizeCurrentPage(), I was trying to do it with
> SetWindowPos() which, I discovered, sets that main dialog position (I was
> using the syntax "myChildDlg.FromHandle(myChildDlg.m_hWnd)" in
> SetWindowPos()).

> > I cannot find a method to adjust the size/position of the child dialogs,
> can you please point me in the right direction?

> > Thank you so much,

> > Chris


> > > They are child, without border. Positioning of a child dialog inside tab
> > > control is done in the ResizeCurrentPage(). It is also called from the
> > > OnCreate/OnInitDialog of the parent for the page that is selected by
> > > default.

> > > Oleg



> > > > Thanks for the response Oleg!

> > > > I still have a question about your response though:

> > > > What kind of dialogs are these (Overlapped, Popup, Child)?

> > > > Did you have to position the upper left hand corner of these dialogs,
> or
> > > were they tied to something in the main dialog?

> > > > Thanks,

> > > > Chris


> > > > > Here is a snippet from my code:

> > > > > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > > > > {
> > > > >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> > > > >  m_nCurTab = nTab;
> > > > >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> > > > >  // Adjust current page size
> > > > >  RECT rc;
> > > > >  GetWindowRect(&rc);
> > > > >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > > > > }

> > > > > where m_pPage is an array of dialogs. This is a snippet from an
> > > ATL-based
> > > > > project, though I believe it contains enough info to do it in MFC.

> > > > > Good luck!

> > > > > Oleg



> > > > > > I've looked at the resources I have online as well as msdn without
> > > luck.
> > > > > It is possible that I have not looked in the right place, or, this
> > > question
> > > > > is too simple to actually be written down.

> > > > > > I have a dialog application. To the dialog, I have added a
> CTabCtrl
> > > class
> > > > > variable named m_tab.

> > > > > > Then, in OnInitDialog() I added the following:

> > > > > > BOOL CULServerDlg::OnInitDialog()
> > > > > > {
> > > > > > ...
> > > > > >     // TODO: Add extra initialization here
> > > > > >     TC_ITEM TabCtrlItem;
> > > > > >     TabCtrlItem.mask = TCIF_TEXT;
> > > > > >     TabCtrlItem.pszText = "TAB 1";
> > > > > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > > > > >     TabCtrlItem.pszText = "TAB 2";
> > > > > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > > > > ...
> > > > > > }

> > > > > > My difficulty is that I am not finding out how to show controls on
> the
> > > two
> > > > > tabs when they are in front.

> > > > > > I already looked at the FIRE demo, and it's just showing an image.
> And
> > > the
> > > > > image is kept in all of the tabs so I do not see really how to
> > > > > display/change different controls for different tabs.

> > > > > > Also, can someone tell be a definition for "owner-drawn" and
> > > > > non-owner-drawn? And, which applies to CTabCtrl?

> > > > > > Thanks for any advice,

> > > > > > Chris

  chris.vcf
< 1K Download
 
 
 

Property Sheets (Tabs in a dialog)

Post by Oleg Pilipenk » Fri, 02 Jul 1999 04:00:00


If you have success playing around with Windows metrics, please let me know.
I'm too busy this week, though I might need it by the end of the month.

Take care!

Oleg.


> Thanks you very much for all your help :^)

> I really apreciate it!

> Chris


> > ResizeCurrentPage is a wrapper around SetWindowPos:

> > void CRepBrowseCtrl::ResizeCurrentPage(int cx, int cy)
> > {
> >  int cxPage = cx - 8;
> >  int cyPage = cy - 32;
> >  ::SetWindowPos(m_pPage[m_nCurTab]->m_hWnd,
> >      NULL,
> >      4,
> >      4,
> >      cxPage,
> >      cyPage,
> >      SWP_NOZORDER | SWP_NOACTIVATE);
> > }

> > It works OK for me, though to be absolutely precise, instead of using 8
and
> > 32 you have to calculate those deltas using Windows metrics.

> > Oleg



> > > Hi again Oleg,

> > > I have the child dialogs set up and displaying. My last problem has to
do
> > with sizing and positioning these child dialogs such that they fall
within
> > the tab control (I cannot find ResizeCurrentPage() in any of the
> > documentation I have). When I show the child dialogs, the appears in the
> > upper left hand corner of the dialog.

> > > I think I only have two questions left to get this finished:

> > > 1) I get the rectangle of the tab control so that I know where to
place
> > the child dialogs, but this rectangle includes the tabs. Is there a
constant
> > or something that indicates how tall the tabs are so that I can take
that
> > into account?

> > > Or, are you placing a dialog item over the tab control defining the
area
> > of the tab control in which you wanted the child dialogs to appear?

> > > 2) Since I do not have a ResizeCurrentPage(), I was trying to do it
with
> > SetWindowPos() which, I discovered, sets that main dialog position (I
was
> > using the syntax "myChildDlg.FromHandle(myChildDlg.m_hWnd)" in
> > SetWindowPos()).

> > > I cannot find a method to adjust the size/position of the child
dialogs,
> > can you please point me in the right direction?

> > > Thank you so much,

> > > Chris


> > > > They are child, without border. Positioning of a child dialog inside
tab
> > > > control is done in the ResizeCurrentPage(). It is also called from
the
> > > > OnCreate/OnInitDialog of the parent for the page that is selected by
> > > > default.

> > > > Oleg



> > > > > Thanks for the response Oleg!

> > > > > I still have a question about your response though:

> > > > > What kind of dialogs are these (Overlapped, Popup, Child)?

> > > > > Did you have to position the upper left hand corner of these
dialogs,
> > or
> > > > were they tied to something in the main dialog?

> > > > > Thanks,

> > > > > Chris


> > > > > > Here is a snippet from my code:

> > > > > > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > > > > > {
> > > > > >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> > > > > >  m_nCurTab = nTab;
> > > > > >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> > > > > >  // Adjust current page size
> > > > > >  RECT rc;
> > > > > >  GetWindowRect(&rc);
> > > > > >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > > > > > }

> > > > > > where m_pPage is an array of dialogs. This is a snippet from an
> > > > ATL-based
> > > > > > project, though I believe it contains enough info to do it in
MFC.

> > > > > > Good luck!

> > > > > > Oleg



> > > > > > > I've looked at the resources I have online as well as msdn
without
> > > > luck.
> > > > > > It is possible that I have not looked in the right place, or,
this
> > > > question
> > > > > > is too simple to actually be written down.

> > > > > > > I have a dialog application. To the dialog, I have added a
> > CTabCtrl
> > > > class
> > > > > > variable named m_tab.

> > > > > > > Then, in OnInitDialog() I added the following:

> > > > > > > BOOL CULServerDlg::OnInitDialog()
> > > > > > > {
> > > > > > > ...
> > > > > > >     // TODO: Add extra initialization here
> > > > > > >     TC_ITEM TabCtrlItem;
> > > > > > >     TabCtrlItem.mask = TCIF_TEXT;
> > > > > > >     TabCtrlItem.pszText = "TAB 1";
> > > > > > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > > > > > >     TabCtrlItem.pszText = "TAB 2";
> > > > > > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > > > > > ...
> > > > > > > }

> > > > > > > My difficulty is that I am not finding out how to show
controls on
> > the
> > > > two
> > > > > > tabs when they are in front.

> > > > > > > I already looked at the FIRE demo, and it's just showing an
image.
> > And
> > > > the
> > > > > > image is kept in all of the tabs so I do not see really how to
> > > > > > display/change different controls for different tabs.

> > > > > > > Also, can someone tell be a definition for "owner-drawn" and
> > > > > > non-owner-drawn? And, which applies to CTabCtrl?

> > > > > > > Thanks for any advice,

> > > > > > > Chris

 
 
 

Property Sheets (Tabs in a dialog)

Post by Chris Severtso » Sat, 03 Jul 1999 04:00:00


Hi Oleg,

I'm not exactly sure what you mean by "metrics", but the following code seems to work fine. And if you change the size of the tab control, this code adapts to the change the next time you run it.

I made this method part of the main dialog and call it from OnInitDialog():

void CMyDlg::InitTabControl()
{
 TC_ITEM         TabCtrlItem;
 WINDOWPLACEMENT lpwndpl;
 RECT            r;
 DWORD           tHeight;

 // Create the tab control
 TabCtrlItem.mask = TCIF_TEXT;
 TabCtrlItem.pszText = "Tab 1";
 m_tab.InsertItem( 0, & TabCtrlItem );
 TabCtrlItem.pszText = "Tab 2";
 m_tab.InsertItem( 1, & TabCtrlItem );

 // Create the two child dialogs that will appears to be
 // the contents of the two "tabs"
 m_tab_1.Create(IDD_DIALOG_TAB_1, NULL);
 m_tab_2.Create(IDD_DIALOG_TAB_2, NULL);

 // Adjust position of child dialogs so that they fit
 // within the tab area

 // Get the height of the "tab" in the tab control
 m_tab.GetItemRect(0, & r );
 tHeight= r.bottom - r.top;

 // Get the full display rectangle of the tab control
 // which includes the tab height
 ::GetWindowPlacement(m_tab.m_hWnd, & lpwndpl);
 r= lpwndpl.rcNormalPosition;

 // Adjust the vertical origin by the height of the "tab"
 r.top += tHeight;

 // Adjust the rectangle so that they fit just inside the
 // actual tab control
 r.left += 4;
 r.top += 4;
 r.right -= 4;
 r.bottom -= 4;

 // Convert right and bottom to width and height
 r.right -= r.left;
 r.bottom -= r.top;

 // Set the new size and position of our child dialogs
 ::SetWindowPos(m_tab_1.m_hWnd, NULL
  , r.left, r.top, r.right, r.bottom, SWP_NOZORDER);
 ::SetWindowPos(m_tab_2.m_hWnd, NULL
  , r.left, r.top, r.right, r.bottom, SWP_NOZORDER);

 return;

}

Thanks again,

Chris

Oleg Pilipenko wrote:
> If you have success playing around with Windows metrics, please let me know.
> I'm too busy this week, though I might need it by the end of the month.

> Take care!

> Oleg.

> Chris Severtson <ch...@microware.com> wrote in message
> news:377BCE4E.A7E92344@microware.com...

> > Thanks you very much for all your help :^)

> > I really apreciate it!

> > Chris

> > Oleg Pilipenko wrote:

> > > ResizeCurrentPage is a wrapper around SetWindowPos:

> > > void CRepBrowseCtrl::ResizeCurrentPage(int cx, int cy)
> > > {
> > >  int cxPage = cx - 8;
> > >  int cyPage = cy - 32;
> > >  ::SetWindowPos(m_pPage[m_nCurTab]->m_hWnd,
> > >      NULL,
> > >      4,
> > >      4,
> > >      cxPage,
> > >      cyPage,
> > >      SWP_NOZORDER | SWP_NOACTIVATE);
> > > }

> > > It works OK for me, though to be absolutely precise, instead of using 8
> and
> > > 32 you have to calculate those deltas using Windows metrics.

> > > Oleg

> > > Chris Severtson <ch...@microware.com> wrote in message
> > > news:377B986B.A80B6156@microware.com...

> > > > Hi again Oleg,

> > > > I have the child dialogs set up and displaying. My last problem has to
> do
> > > with sizing and positioning these child dialogs such that they fall
> within
> > > the tab control (I cannot find ResizeCurrentPage() in any of the
> > > documentation I have). When I show the child dialogs, the appears in the
> > > upper left hand corner of the dialog.

> > > > I think I only have two questions left to get this finished:

> > > > 1) I get the rectangle of the tab control so that I know where to
> place
> > > the child dialogs, but this rectangle includes the tabs. Is there a
> constant
> > > or something that indicates how tall the tabs are so that I can take
> that
> > > into account?

> > > > Or, are you placing a dialog item over the tab control defining the
> area
> > > of the tab control in which you wanted the child dialogs to appear?

> > > > 2) Since I do not have a ResizeCurrentPage(), I was trying to do it
> with
> > > SetWindowPos() which, I discovered, sets that main dialog position (I
> was
> > > using the syntax "myChildDlg.FromHandle(myChildDlg.m_hWnd)" in
> > > SetWindowPos()).

> > > > I cannot find a method to adjust the size/position of the child
> dialogs,
> > > can you please point me in the right direction?

> > > > Thank you so much,

> > > > Chris

> > > > Oleg Pilipenko wrote:

> > > > > They are child, without border. Positioning of a child dialog inside
> tab
> > > > > control is done in the ResizeCurrentPage(). It is also called from
> the
> > > > > OnCreate/OnInitDialog of the parent for the page that is selected by
> > > > > default.

> > > > > Oleg

> > > > > Chris Severtson <ch...@microware.com> wrote in message
> > > > > news:377A1C48.96F5F41A@microware.com...

> > > > > > Thanks for the response Oleg!

> > > > > > I still have a question about your response though:

> > > > > > What kind of dialogs are these (Overlapped, Popup, Child)?

> > > > > > Did you have to position the upper left hand corner of these
> dialogs,
> > > or
> > > > > were they tied to something in the main dialog?

> > > > > > Thanks,

> > > > > > Chris

> > > > > > Oleg Pilipenko wrote:

> > > > > > > Here is a snippet from my code:

> > > > > > > void CRepBrowseCtrl::DoSelectTab(int nTab)
> > > > > > > {
> > > > > > >  m_pPage[m_nCurTab]->ShowWindow(FALSE);
> > > > > > >  m_nCurTab = nTab;
> > > > > > >  m_pPage[m_nCurTab]->ShowWindow(TRUE);

> > > > > > >  // Adjust current page size
> > > > > > >  RECT rc;
> > > > > > >  GetWindowRect(&rc);
> > > > > > >  ResizeCurrentPage(rc.right - rc.left, rc.bottom - rc.top);
> > > > > > > }

> > > > > > > where m_pPage is an array of dialogs. This is a snippet from an
> > > > > ATL-based
> > > > > > > project, though I believe it contains enough info to do it in
> MFC.

> > > > > > > Good luck!

> > > > > > > Oleg

> > > > > > > Chris Severtson <ch...@microware.com> wrote in message
> > > > > > > news:3777D1CA.406E6306@microware.com...

> > > > > > > > I've looked at the resources I have online as well as msdn
> without
> > > > > luck.
> > > > > > > It is possible that I have not looked in the right place, or,
> this
> > > > > question
> > > > > > > is too simple to actually be written down.

> > > > > > > > I have a dialog application. To the dialog, I have added a
> > > CTabCtrl
> > > > > class
> > > > > > > variable named m_tab.

> > > > > > > > Then, in OnInitDialog() I added the following:

> > > > > > > > BOOL CULServerDlg::OnInitDialog()
> > > > > > > > {
> > > > > > > > ...
> > > > > > > >     // TODO: Add extra initialization here
> > > > > > > >     TC_ITEM TabCtrlItem;
> > > > > > > >     TabCtrlItem.mask = TCIF_TEXT;
> > > > > > > >     TabCtrlItem.pszText = "TAB 1";
> > > > > > > >     m_tab.InsertItem( 0, &TabCtrlItem );
> > > > > > > >     TabCtrlItem.pszText = "TAB 2";
> > > > > > > >     m_tab.InsertItem( 1, &TabCtrlItem );
> > > > > > > > ...
> > > > > > > > }

> > > > > > > > My difficulty is that I am not finding out how to show
> controls on
> > > the
> > > > > two
> > > > > > > tabs when they are in front.

> > > > > > > > I already looked at the FIRE demo, and it's just showing an
> image.
> > > And
> > > > > the
> > > > > > > image is kept in all of the tabs so I do not see really how to
> > > > > > > display/change different controls for different tabs.

> > > > > > > > Also, can someone tell be a definition for "owner-drawn" and
> > > > > > > non-owner-drawn? And, which applies to CTabCtrl?

> > > > > > > > Thanks for any advice,

> > > > > > > > Chris

  chris.vcf
< 1K Download
 
 
 

1. Tab Order backward once a dialog is placed in a Property Sheet

I've got an odd problem.  I've inherited an application that contains a TabCtrl
with 3 tabs.  This app does not use MFC, so this is all done via Property Sheet
macro's.  I've got a dialog that, when being tested in MSDev, has the correct
tab order, but when I am running the app, and the dialog is inserted in the
Property Sheet, the tab order is backwards

The app has two keyboard hooks, but even when they are disabled, I cannot get
the tab order to go the correct direction.  Shift+Tab works how Tab does, and
Tab works how Shift+Tab should.

Is there something stupid I am missing?
--
=====================
Michael Scott

  michael.scott.vcf
< 1K Download

2. About CD-R media size read this !!!!!

3. How could i get the property sheet tab control with single row tabs?

4. Taksbar Problems

5. Tabbed Dialogs - Property sheet or hand-coded?

6. HP100 to Psion?

7. How to disable property page tab on property sheet?

8. SPW v1.2a and NES/Win Emulator

9. Create a property sheet within a property sheet.

10. Adding a custome properties tab to the file properties dialog

11. Device Manager property sheet tab.

12. How to make the Tab control of a property sheet ownerdraw?

13. Property Sheet : Too Many Tabs... Ahhhh!