CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Property sheet problem

  1. #1
    Join Date
    Aug 2005
    Location
    NewDelhi
    Posts
    49

    Property sheet problem

    Hi,
    I am creating tab control( a window with 3 property page) using properrtysheet.
    In one of propertypage on menu click I want to open another tab control window( A new window having two property page).

    ON menu click I am able to open other Dialog but not able to open the property sheet.
    The problem I am facing is the control is going to new propertysheet proc but it is not activating the display of property sheet and focus comes back to the same page from where Menu was pressed.

    What is the problem . How can I do that. Any help.

    Thanks in advance.
    Ravi Ranjan

  2. #2
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Property sheet problem

    Are both of your property sheets modal? It sounds as if you have a modal on top of modal issue. Modal behaviour is implemented by running an internal message loop - thus, when you open a second modal window on top the first modal window's loop is still running and there are issues in trying to transfer control to the new window.

    It may be worth trying to change your approach. If those extra pages were part of your main property sheet, then your menu item could simply flag whether those pages can be visited or not; if they cannot be visited, then I think you can handle tab selection and ignore them (not let the user open those pages).

    The menu can easily select one of those pages automatically when selected.

  3. #3
    Join Date
    Aug 2005
    Location
    NewDelhi
    Posts
    49

    Re: Property sheet problem

    HI JTeagle,
    Thanks.
    Yes! You are right . Both the property sheet are modal. What I can do in such a case .It is the UI requirement that I canot merge them in one property sheet.
    I think you are trying to say "create all the pages in a single propert sheet and show and hide them according to requirement".

    I will try this approach.
    Do you have any idea how to overcome with internal message loop problem.

    Thanks once agian.
    Ravi Ranjan

  4. #4
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Property sheet problem

    It is possible to create a normal, modeless dialogue and embed the property sheets on them directly. With modeless dialogues instead of (modal) property sheets, you would probably have no problem.

    However, you lose a small bit of functionality when changing from property sheets to normal dialogues - but I think you will find the benefits are worth it.

    You can always simulate modal behaviour by disabling the window that created these property pages in the first place; re-enable it when the user closes the 'new' property sheet.

  5. #5
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Property sheet problem

    Quote Originally Posted by RaviRanjan1774
    Hi,
    I am creating tab control( a window with 3 property page) using properrtysheet.
    In one of propertypage on menu click I want to open another tab control window( A new window having two property page).

    ON menu click I am able to open other Dialog but not able to open the property sheet.
    Please post the code snippet you are using to show the propertysheet.
    Also, what exactly do you mean by you can open a dialog, but not a propertysheet ?

    The problem I am facing is the control is going to new propertysheet proc but it is not activating the display of property sheet and focus comes back to the same page from where Menu was pressed.

    What is the problem . How can I do that. Any help.
    Again. Please post the code snippet of how you are handling that menu command.

  6. #6
    Join Date
    Aug 2005
    Location
    NewDelhi
    Posts
    49

    Re: Property sheet problem

    HI Kirants,
    Thanks for reply.
    The code I am using is


    Code to create 1st property sheet with 3 property page
    [CODE]


    void CreateCommandToolsOptions(HWND hWnd)
    {
    PROPSHEETPAGE psp[3];
    psp[0].dwSize = sizeof(psp[0]);
    psp[0].dwFlags = PSP_DEFAULT;
    psp[0].hInstance = g_hInst;
    psp[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_CONTACT);
    psp[0].pfnDlgProc = (DLGPROC)&DlgProcContact;

    psp[1].dwSize = sizeof(psp[1]);
    psp[1].dwFlags = PSP_DEFAULT;
    psp[1].hInstance = g_hInst;
    psp[1].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_GROUP);
    psp[1].pfnDlgProc = (DLGPROC)&DlgProcGroup;

    psp[2].dwSize = sizeof(psp[2]);
    psp[2].dwFlags = PSP_DEFAULT;
    psp[2].hInstance = g_hInst;
    psp[2].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_CALLLOG);
    psp[2].pfnDlgProc = (DLGPROC)&DlgProcCallLog;


    PROPSHEETHEADER psh;
    psh.dwSize = sizeof(psh);
    psh.dwFlags = PSH_DEFAULT | PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_USECALLBACK | PSH_MAXIMIZE ;
    psh.hwndParent = g_hMainWnd ;//hWnd;
    psh.hInstance = g_hInst;
    psh.nPages = 3;
    psh.nStartPage = 0;
    psh.ppsp = &psp[0];
    psh.pfnCallback = PropSheetCallback;

    PropertySheet(&psh);
    }


    int PropSheetCallback(HWND hwndDlg, UINT message, LPARAM lParam)
    {
    SHDoneButton(hwndDlg, SHDB_HIDE);
    if (message == PSCB_GETVERSION)
    {
    return COMCTL32_VERSION;
    }
    /*if(message == PSPCB_RELEASE )
    {
    PostQuitMessage(0);
    }*/

    return 0;
    }

    [\CODE]


    In ContactDialog There is a menuItem Settings, on click of this menu item I am trying to invoke another property sheet, but the property sheet is not activating although the control flow goes to the Propertysheet proc but UI doesnot appears . If I invoke the dialog then it is appearing
    [CODE]
    case ID_MENU_SETTINGS:
    {
    // TODO not openiong property sheet
    //CreateSettingToolsOptions(g_hMainWnd);//hwnd);
    DialogBox(g_hInst,
    MAKEINTRESOURCE(IDD_DIALOG_SETTING),
    g_hMainWnd, (DLGPROC)DlgProcSetting);
    }
    break;

    [\CODE]



    The code which I am using for creating the settings propertysheet is with 2 properrty page

    [CODE]

    void CreateSettingToolsOptions(HWND hWnd)
    {
    PROPSHEETPAGE psp[2];
    psp[0].dwSize = sizeof(psp[0]);
    psp[0].dwFlags = PSP_DEFAULT;
    psp[0].hInstance = g_hInst;
    psp[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_SETTING);
    psp[0].pfnDlgProc = (DLGPROC)&DlgProcSetting;

    psp[1].dwSize = sizeof(psp[1]);
    psp[1].dwFlags = PSP_DEFAULT;
    psp[1].hInstance = g_hInst;
    psp[1].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_CON_SETTING);
    psp[1].pfnDlgProc = (DLGPROC)&DlgProcConnectionSetting;


    PROPSHEETHEADER psh;
    psh.dwSize = sizeof(psh);
    psh.dwFlags = PSH_DEFAULT | PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_USECALLBACK | PSH_MAXIMIZE ;
    psh.hwndParent = hWnd ;
    psh.hInstance = g_hInst;
    psh.nPages = 2;
    psh.nStartPage = 0;
    psh.ppsp = &psp[0];
    psh.pfnCallback = PropSheetSettingCallback;
    int x=PropertySheet(&psh);

    }


    int PropSheetSettingCallback(HWND hwndDlg, UINT message, LPARAM lParam)
    {
    // SHDoneButton(hwndDlg, SHDB_HIDE);
    if (message == PSCB_GETVERSION)
    {
    return COMCTL32_VERSION;
    }
    /*if(message == PSPCB_RELEASE )
    {
    PostQuitMessage(0);
    }*/

    return 0;
    }


    [\CODE]

    Is something wrong I am doing in my code .
    Thanks.
    Ravi Ranjan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)