Using a property page as a stand alone dialog
Alicia Tupacyupanqui -- alicia@orthodyne.com
Thursday, March 20, 1997
Helloooooo. (Try this again)
Environment: VC++ 4.2-flat, NT 4.0
I've created a property sheet wizard that will take the user through a
series of "setup" steps. However, there are times when the user
may only want to perform "setup" on a particular feature. Therefore, I'm
using the property pages as stand-alone dialogs. Everything seems to
work fine, but the dialog won't take any transition input from the
keyboard. i.e. I can't use tab to move among the controls and I can't
use Enter to select the default button, but I can type in the edit
boxes, etc.
Does anyone know if this is an easy fix, or is it based on my premise of
using a property page without its parent property sheet.
Thanks for your help.
Alicia.
Marc St-Cyr -- StCyrM@msn.com
Tuesday, March 25, 1997
The following code snippet (I can't remember where I downloaded it from) may
answer your question ...
---------- snip ... ------------------
PSView
Written by yktam
of Microsoft Product Support Services, Languages Developer Support.
Copyright (c) 1996 Microsoft Corporation. All rights reserved.
(Applies to the MFC 4.1 which ships with Visual C++ 4.1)
========================================================================
---------- snip ... ------------------
// Create page three and add it to dialog array.
dlg = new CDialog3;
ASSERT(dlg);
m_DlgArray.Add(dlg);
VERIFY(dlg->Create(IDD_DIALOG3, m_TabCtrl));
// Determine the tab text. The tab text can be found from the
// dialog template.
char str[50];
TC_ITEM tci;
tci.mask = TCIF_TEXT;
tci.iImage = -1;
for (int i = 0; i < NUM_PAGES; i++)
{
// Get the caption from dialog template and insert this caption
// to the tab control.
dlg = m_DlgArray[i];
dlg->GetWindowText(str, sizeof(str));
tci.pszText = str;
m_TabCtrl->InsertItem(i, &tci);
// Remove caption from the dialog box because no caption is allowed
// for pages in the tab control.
dlg->ModifyStyle(WS_CAPTION, 0);
// IMPORTANT: Why sending a WM_NCACTIVATE message to the dialog box?
// When writing this sample, we found a problem which is related to
// the edit control refuses to give up the input focus when mouse is
// being clicked on some other edit control. This problem only
// happens when title bar is found from a dialog resource. And we
// need the title bar because it is the text in the tab control.
// Sending a WM_NCACTIVATE message seems to fix the problem.
dlg->SendMessage(WM_NCACTIVATE, TRUE);
}
------------ snip ... ----------------
Good luck,
Marc St-Cyr
-----Original Message-----
From: owner-mfc-l@majordomo.netcom.com On Behalf Of Alicia Tupacyupanqui
Sent: Thursday, March 20, 1997 12:10 PM
To: mfc-l@netcom.com
Subject: Using a property page as a stand alone dialog
Helloooooo. (Try this again)
Environment: VC++ 4.2-flat, NT 4.0
I've created a property sheet wizard that will take the user through a
series of "setup" steps. However, there are times when the user
may only want to perform "setup" on a particular feature. Therefore, I'm
using the property pages as stand-alone dialogs. Everything seems to
work fine, but the dialog won't take any transition input from the
keyboard. i.e. I can't use tab to move among the controls and I can't
use Enter to select the default button, but I can type in the edit
boxes, etc.
Does anyone know if this is an easy fix, or is it based on my premise of
using a property page without its parent property sheet.
Thanks for your help.
Alicia.
Become an MFC-L member
| Вернуться в корень Архива
|