15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Doc/View for property sheet app

Joe Vannucci -- vannuccj@ix.netcom.com
Monday, March 10, 1997

Environment: VC 4.2 flat  Win95

How do I get a CSingleDocTemplate frame to be created without a menu?

I've got an app that I want to use Doc/View with for the management of the
data, but the interface is only a wizard property sheet.  The model is SDI
because only one document is being used at a time, but in reality multiple
documents will be in existence, just without views.  So I'm trying to use
Doc/View, but using the view as little as possible.  

One approach I thought of is to embed a property sheet in a CFormView.  I
know how to do that, but I can't get away from needing a menu.  The code
fails in CFrameWnd::Create().  I'd like to set the menu resource name
parameter to NULL, but I can't figure out how to get in there.  I override
CMainFrame::Create(), but the code never goes there, even though
CFrameWnd::Create() is virtual.  Why?

Is there a better way to do what I want, like using a hidden view and
calling propertysheet.DoModal()?

Thanks in advance.

-joe vannucci



CADD Design Solutions -- cds59@idt.net
Friday, March 14, 1997

At 05:30 PM 3/10/97 -0500, you wrote:
>Environment: VC 4.2 flat  Win95
>
>How do I get a CSingleDocTemplate frame to be created without a menu?
>
>I've got an app that I want to use Doc/View with for the management of the
>data, but the interface is only a wizard property sheet.  The model is SDI
>because only one document is being used at a time, but in reality multiple
>documents will be in existence, just without views.  So I'm trying to use
>Doc/View, but using the view as little as possible.  
>
>One approach I thought of is to embed a property sheet in a CFormView.  I
>know how to do that, but I can't get away from needing a menu.  The code
>fails in CFrameWnd::Create().  I'd like to set the menu resource name
>parameter to NULL, but I can't figure out how to get in there.  I override
>CMainFrame::Create(), but the code never goes there, even though
>CFrameWnd::Create() is virtual.  Why?
>
>Is there a better way to do what I want, like using a hidden view and
>calling propertysheet.DoModal()?
>
>Thanks in advance.
>
>-joe vannucci
>

I had a very similar problem, but I am using MSVC++ 1.52 (16-bit), but it
should be basically the same for your situation.  I took the following steps:

- Create app with AppWizard using SDI option and CView as view base class
- Derive an object from CPropertySheet and store a pointer to new object as
a member of your view.
- Create new property sheet object using 'new' operator from within your
override of view's OnCreate() (don't forget to delete it from within OnDestroy!)
- I also created an object derived from CPropertyPage for each page of my
property sheet, storing pointers to each object as described above for
property sheet object.
- Add pages to property sheet as you normally would and then create the
property sheet, like so:
        m_pPropertySheet->Create(this,WS_CHILD|WS_VISIBLE|WS_SYSMENU,0);
this makes the property sheet a child of your view, and you can communicate
with is by sending messages to it, like so:
        m_pPropertySheet->GetCurrentPage()->SendMessage(WM_message);
Note that GetCurrentPage was created in the overridden instance of the
CPropertySheet class.
- Resize your main window to contain only the property sheet.  I would also
recommend centering the main window and disabling the maximize/resize
capability from within the OnGetMinMaxInfo() override of your main frame class.

If you need any more help, e-mail me direct and I can send you some code.


-----------------------------------------------
Shawn L. Bradley
CADD Design Solutions

e-mail: cds59@mail.idt.net

Visit our web site for latest news, neat tips,
and FREE AutoLISP utilities!
	http://metropolis.idt.net/~cds59
-----------------------------------------------
All that must happen for evil to prevail, is
for good men to do nothing. -Edmund Burke





Become an MFC-L member | Вернуться в корень Архива |