In many cases, is usefull to have in one page of propery sheet more controls. But if the area of page is not enough, you have to insert some scroll bars into page. To make this simple you can do the followings:
Creating one CFormView
Generate a new dialog with Child style, which contains all controls from one scrollable page on resource
From class wizard add a new CFormView, with ID be the id of created dialog. (CMyFormView)
Make the constuctor and destructor to be public (by default, these are protected for dynmicaly creation) (CMyFormView)
From classwizard, add in this class (CFormView) a new member PostNcDestroy.
From the generated body function remove CFormView::PostNcDestroy() ( In CFormView::PostNcDestroy is called delete this)
Add handler for WM_CREATE message into CMyFormView, and in the body of the generated function call SetScrollSizes(MM_TEXT, CSize(100,200));
Add a new function public: virtual BOOL CMyFormView::Create(CWnd* pParent), with body
BOOL CMyFormView::Create(CWnd *pParent)
{
CRect rect; pParent->GetClientRect(rect);
return CFormView::Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rect, pParent, 0, NULL);
}
Adding the new member of CMyFormView type to one of CPropertyPage
From classwizard and in one of pages's sheet, a new member of CMyFormView type.
For this page add handler for WM_INITDIALOG message.
In the body call, Create(this) of member of CMyFormView type
If something is missing or wrong, feel free to ask me at: mihai_f@hotmail.com
Comments
I have a problem adding a string to a CComboBox in the FormView
Posted by Legacy on 02/04/2003 12:00amOriginally posted by: Andrew
Your article is very useful for me.It was successfull.
But,when I try to add a string to a CComboBox in the FormView,the application terminated with error message.
The message is like this
-------------------------
ReplyDebug Assertion Failed
File:afxwin2.inl
Line:735
-------------------------
I have a problem about TabCtrl and View
Posted by Legacy on 04/17/2001 12:00amOriginally posted by: kim
Your article is very useful for me.
Actually, I inserted ScrollView into TabCtrl.
It was successfull.
But,when I clicked on the ScrollView,the application terminated with error message.
The message is like this
-------------------------
Debug Assertion Failed
File:viewcore.cpp
Line:252
-------------------------
I wrote VC++ code just as you did.
I used ScrollView instead of FormView.
What is the problem?
Please advise me!
ReplySmall Correction
Posted by Legacy on 02/11/2001 12:00amOriginally posted by: Vivek Rajan
Good article -
In the PostNcDestroy method :-
Instead of commenting out CFormView::PostNcDestroy,
you should call CWnd::PostNcDestroy directly.
( For more info on PostNcDestroy, see MSDN TN17 )
Later-
ReplyVivek
Simple, yet Great... Idea
Posted by Legacy on 01/21/2000 12:00amOriginally posted by: Achalla Srinivasu
Hi,
the idea is very good and helpful.
Thank You....
Regards,
Srinivasu. A
ReplyHow to make docking pages
Posted by Legacy on 09/15/1999 12:00amOriginally posted by: Nemo
I think your idea is a clue to my problem, but I cannot find the way. I need to implement docking pages like it is done in Delphi environment. I.e. I want to allow pages to be dragged away as floating window and stick back to sheet if they are dragged over it. Can you give me advise?
Sincerely,
ReplySerge.
Thanks, exactly what I needed
Posted by Legacy on 02/15/1999 12:00amOriginally posted by: chris Rau
I am new to MFC and was trying to figure out this exact issue when I found your post. Thank you very much. It works like a charm.
ReplyIt's work Ok, but not correctly...
Posted by Legacy on 02/02/1999 12:00amOriginally posted by: Aleks
It's work Ok, but not correctly:
In ideal, if I navigate to controls using TAB key, focused control
must begin visiable in property page (i.e. Veiw automatically scrolled
to focused control position). Next, if I already in this page, I can't
navigate to other pages and Prop Sheet's buttons, using navigation keys.
Best way to solve this problem - take original CFormView and CScrollView
source code, remove all non-needed (on CDocument links and so on), replace
CView to CWnd, GetParentFrame() to GetParent(),correct some errors and
add navigation key press and othe messages handling. I hope it's will
be fine!
Aleks
Reply