Adding a Control to the Property Sheet
Posted
by Zafir Anjum
on August 6th, 1998
Step 1: Derive your own class from CPropertySheet
We cannot use the CPropertySheet class directly, since we need to add a member variable. If you aren't already using a sub-class of CPropertySheet then derive one.Step 2: Add member variable
Add member variable to the CPropertySheet derived class. The edit control will be created and accessed using this member.public: CEdit m_edit;
Step 3: Create the edit control in OnInitDialog
Override the OnInitDialog() function and add the code to create the edit control to this function. It is a good idea to call the base class version of the function before doing anything specific for the derived class.The property sheet is first resized to accommodate the new edit control. The edit control is then created at the desired location. The WS_EX_CLIENTEDGE gives it a 3-D look. The edit control is created with a different font than used by other control. We fix this by a call to SetFont() and set the font to be the same as the property sheet.
The text value in the edit control can be set or retrieved using the m_edit object.
BOOL CMyPropSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width() + 100,
rectWnd.Height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
m_edit.CreateEx( WS_EX_CLIENTEDGE, _T("EDIT"), NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
rectWnd.Width(), 20, 80, 24, m_hWnd, 0, 0 );
m_edit.SetFont( GetFont() );
CenterWindow();
return bResult;
}

Comments
how to enforce focus on dlg item of another page
Posted by Legacy on 02/24/2004 12:00amOriginally posted by: Stephan Geue
I wrote a property sheet with some edit fields and combo boxes on one page. I don't want the user to leave this page by choosing another page or apply or OK if the data of these items are not plausible. I can catch the application killing the focus on these items but I cannot prevent it from leaving the page or the sheet at all. Moreover, if I issue a message "data not correct" on KILLFOCUS, this happens even then, if the user wants to cancel the whole sheet. Do you know a solution?
ReplyThanks in advance.
Stephan
Adding Connect to Server dialog box on MMC Snapin using Visual Basic Designer
Posted by Legacy on 08/09/2002 12:00amOriginally posted by: Amish Shah
Hello,
I was wondering if anyone knew how to add the "Connect to Server" property page that comes up when, for example, one clicks on the Computer Management node or other nodes. I am trying to create a customized MMC snapin and I am looking for some help as to how to add on the "Connect to Server" dialog box when the user adds the MMC snapin. I am also using the Visual Basic designer. Any help is much appreciated. Thank you.
Amish Shah
ReplyInitializing Pages with value in Registry(like Properties)
Posted by Legacy on 07/26/2002 12:00amOriginally posted by: Rider
Hi:
I am trying to create a property sheet with 3-4 pages for setting options. (just like the ones you get right click desktop, then properties).
My problem is: HOW and where do I initialize the pages with the previous stored values (they are in registry and i can retrieve them).
For example, say the value in memory is 20. i have 4 radio buttons with titles 5, 10, 20, 40. I want the "20" button checked when the pages first shows. There after, that page will show whatever the user clicked just before switching pages.
Thanx
Reply
add control to the top or to the bottom?
Posted by Legacy on 06/20/2002 12:00amOriginally posted by: ofirc
i am trying to add control to the top of the propertysheet in the same method but i get a strange propertysheet,
Replyany idea?
Controls in Property Page doesnt work
Posted by Legacy on 03/15/2002 12:00amOriginally posted by: Jemin n shingala
Re sir i have embedde property sheet int the dialog, using CPropertySheet in OninintDialog, Now the Probs, is i have a button in Property page, on whose click, event i want many actions on the dialog, say display of Message Box, but when i have BN_CLICKED event for that button and put my code, the application hangs, plz suggest me some solutions, fast waiting eagerly for reply
ReplyHow to add Scroll bar to PropertySheet as well as in PropertyPages?
Posted by Legacy on 03/14/2002 12:00amOriginally posted by: G.Paramaguru
I have enabled Scroll bar using EnableScrollBarCtrl function of PropertyPage but it is difficult to activate it, I cant move the pages up and down.I have even tried out by calling OnVScroll function of respective page and sheet, but iam unable to achieve it. Kindly help me out my problem.
Thanks,
Replyregards
G.Paramaguru,
How to use the "Help button" in propertysheet ??
Posted by Legacy on 02/19/2002 12:00amOriginally posted by: ted
Replyproperty sheet problem
Posted by Legacy on 09/03/2001 12:00amOriginally posted by: Vilas kulkarni
ReplyHow to add control when propert sheet si dynamically created
Posted by Legacy on 08/31/2001 12:00amOriginally posted by: Fawaz
ReplyStatus Bar
Posted by Legacy on 08/22/2001 12:00amOriginally posted by: karin
How can I add a status bar in a property sheet ???
ReplyLoading, Please Wait ...