Solved

Tabs under tab(PropertySheet under PropertyPage)

Posted on 1997-12-15
1
223 Views
Last Modified: 2013-11-19
I am facing a strange problem regarding tabs under a tab. I have createda dialog containing a PropertySheet say MainSheet . In this sheet , I am adding 4 pages . One of the pages , further contains a PropertySheet,Say ChildSheet , in which I am adding 7 pages.
I am using MSVC 5 - windows 95 and using the Application wizard and Class wizard for most of the code generation .
Now on executing the application , I am facing this strange problem . If initially , I click any tab twice in the ChildSheet (why twice ? One for making that tab , an active page and second for setting the focus on that tab), then I get no trouble and clicking any tab in the MainSheet works smoothly.Note that I have to do this only once.Afterwords , this restriction is relaxed :-)

Now if I don't do that , i.e setting focus to any tab in the ChildSheet , before trying to click any tab in the Mainsheet (accept the one , who is the parent of ChildSheet ) the application is HANGED .

So this application needs a bit smarter user for handling :-) To run smoothly  or to be hanged.

ONE SOLUTION

I have got with me one solution for that , But I am afraid that it is concerned with the performance issue as in future these tabs will be having high interaction with data base server .

The above mentioned problem won't occur , If I create the ChildSheet every time , in OnSetActive() message and delete it in OnKillActive() message in that tab of MainSheet which is responsible for creating the childSheet.However , in the above Strange Case , I was creating the ChildSheet once in the OnInitDialog().

Any suggestion for the appropriate solution is highly appreciated.One more thing, I also tried to programmatically put the focus on any tab in the childSheet in the start of application execution but it won't work .

0
Comment
Question by:usmani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
WBerthin earned 100 total points
ID: 1312299
Hi usmani,

The trick to putting a CPropertySheet in a CPropertyPage
 (nesting Property Sheets) is to create a CFrameWnd to
contain the nested Property Sheet.

Here is how you put it all together. Lets assume that
you have the outer property sheet and property page,
and start from there.

Step 1 Create the Inner Property Sheet and its pages:
Open the Insert menu,chose component, and double
click Property Sheet to get the "Insert Property Sheet"
Wizard. Then create a property sheet using the Wizard, BUT
change the default type to Modless not Modal. Also change
the name of the class that will have access to your new
CPropertySheet to your owner owner CPropertyPage.
Allow the WIzard to finish its creation.

Step 2 Change the modless inner property sheet contained
in a CMiniFrameWnd to a CFrameWnd contained item. Do
this by opening the CPropertyFrame class that the Wizard
just created for the inner property sheet, and use the editor
to search CMiniFrameWnd and replace it with CFrameWnd.
Do this in both the .cpp and .h files for the class. The CFrameWnd
class you create contains all the code you need thanks to
the Wizard (so I won't reproduce it here).

Step 3 Attach the inner property frame to the outer property
page. The wizard will create a function called OnProperties()
in your owner CPropertyPage. Cut its contents entirely and
paste then into your OnInitDialog for your owner Property
Page. Change the two lines as below. I have commented out
the old lines created by the Wizard so the changes are easily
seen.

BOOL CMyPropertyPage1::OnInitDialog()
{
     CPropertyPage::OnInitDialog();
      
     if (m_pPropFrame == NULL)
     {
         m_pPropFrame = new CPropertyFrame;
         CRect rect(0, 0, 0, 0);
         CString strTitle;
          VERIFY(strTitle.LoadString(IDS_PROPSHT_CAPTION1));

          if (!m_pPropFrame->Create(NULL, strTitle,
//             WS_POPUP | WS_CAPTION | WS_SYSMENU, rect, this))
                     WS_CHILD | WS_VISIBLE, rect, this))
               {
                    delete m_pPropFrame;
                    m_pPropFrame = NULL;
//                  return;
                    return TRUE;
               }
                     m_pPropFrame->CenterWindow();
          }
      
          if (m_pPropFrame != NULL && !m_pPropFrame->IsWindowVisible())
               m_pPropFrame->ShowWindow(SW_SHOW);

          return TRUE;  // return TRUE unless you set the focus to a control
                    // EXCEPTION: OCX Property Pages should return FALSE
}

Step 4 Delete the OnProperties function created by the Wizard
form the owner CPropertyPage class.

Step 5 Be sure the size of the outer proeprty page is bigger
than the inner property sheet. Both are resized using the
resource editor. You can play with the line
m_pPropFrame->CenterWindow()
above, if you want the inside property sheet positioned differently.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question