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

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


Toolbar on an MDI child

Paul E. Rosen -- prosen@fte.com
Thursday, November 14, 1996

Environment: Win 95, VC 4.2flat

Hi,

I have a Doc/View MDI application with multiple views. Some toolbar functions
are only applicable to one view. I'd like to put these functions directly on
the child window instead of the frame window. I saw the example DLGCBR32 that
adds a toolbar to a dialog box. Is this applicable to child windows, also? Is
this the best way to put a toolbar on a child?

(BTW, the children that need toolbars are based on CView or CFormView)


Paul Rosen, Frontline Test Equipment, Inc.
Internet: prosen@fte.com, http://www.fte.com, ftp.fte.com
Voice: 804-984-4500, Fax: 804-984-4505, BBS: 804-984-4503
Real Mail: PO Box 7507, Charlottesville, VA  22906-7507, USA
Location: 2114 Angus Road, Suite 228, Charlottesville, VA 22901





Luke Stephens -- luker@tfs.net
Saturday, November 16, 1996

[Mini-digest: 2 responses]

Are you using the same CMDIChildWnd derived class for all views?

If so, you could derive a CMDIChildWnd for each type of view and create
specific toolbars for that frame.  I have done this for my app and it seems
to work fine.

Luke Stephens
luker@tfs.net

----------
> From: Paul E. Rosen 
> To: 'MFClist' 
> Subject: Toolbar on an MDI child
> Date: Thursday, November 14, 1996 9:29 AM
> 
> Environment: Win 95, VC 4.2flat
> 
> Hi,
> 
> I have a Doc/View MDI application with multiple views. Some toolbar
functions
> are only applicable to one view. I'd like to put these functions directly
on
> the child window instead of the frame window. I saw the example DLGCBR32
that
> adds a toolbar to a dialog box. Is this applicable to child windows,
also? Is
> this the best way to put a toolbar on a child?
> 
> (BTW, the children that need toolbars are based on CView or CFormView)
> 
> 
> Paul Rosen, Frontline Test Equipment, Inc.
> Internet: prosen@fte.com, http://www.fte.com, ftp.fte.com
> Voice: 804-984-4500, Fax: 804-984-4505, BBS: 804-984-4503
> Real Mail: PO Box 7507, Charlottesville, VA  22906-7507, USA
> Location: 2114 Angus Road, Suite 228, Charlottesville, VA 22901
> 
-----From: "Ioan Berbece" 

First, I didn't understand very well your question (I think child window
and frame window are too general terms in that context). But I assume that
you have multiple views in a MDI child frame and you want each view have
specific toolbar(s).
As I understand from DLGCBR32 sample, that technique will work for every
(window) class derived from CCmdTarget that satisfy your requirements. The
only trick is to cast the pointer to the window that holds the toolbar
(statusbar) to a pointer to CFrameWnd object, just "to make
CStatusBar::OnUpdateCmdUI happy," in the handler of WM_IDLEUPDATECMDUI
message.
But it may be worth to consider the idea of having the toolbars in the
child frame (which can handle them easily beeing a CFrameWnd derived class)
and hiding/showing them accordingly to the active view.

Ioan Berbece,
Software Engineer,
InterTrans Logistics Solutions,
Toronto, Canada
e-mail: berbece@itls.com




Bibhas Bhattacharya -- bibhas@isgtec.com
Tuesday, November 19, 1996

 Environment: Win 95, VC 4.2flat
> 
> I have a Doc/View MDI application with multiple views. Some toolbar functions
> are only applicable to one view. I'd like to put these functions directly on
> the child window instead of the frame window. 

You can create the tool bars from CView::OnCreate and show them using the
main frame window from CView::OnActivateView. This will cause the toolbar
to be switched just like menu bar, when a view becomes active.

Bibhas.
bibhas@isgtec.com



Bibhas Bhattacharya -- bibhas@isgtec.com
Tuesday, November 19, 1996

 Environment: Win 95, VC 4.2flat
> 
> I have a Doc/View MDI application with multiple views. Some toolbar functions
> are only applicable to one view. I'd like to put these functions directly on
> the child window instead of the frame window. 

You can create the tool bars from CView::OnCreate and show them using the
main frame window from CView::OnActivateView. This will cause the toolbar
to be switched just like menu bar, when a view becomes active.

Bibhas.
bibhas@isgtec.com




| Вернуться в корень Архива |