Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tabs under tab(PropertySheet under PropertyPage)

Posted on 1997-12-15
1
Medium Priority
?
225 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 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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