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

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


Hiding/Showing Toolbars for a Specific Document type

peter.hodgman@autodesk.com
Saturday, February 08, 1997

     Environment: MSVC 4.0 Win NT 4.0
     
     I am currently developing and MDI app. I would like to extend the 
     default behavior of the toolbars associated with the MDI app. 
     Basically, I have toolbars associated with specific document types and 
     I would like to hide/show a specific document type's toolbars as views 
     on a document activate/deactivate. It seems to me that a good approach 
     to this problem would be as follows:
     
     1) Provide a new subclass of CMultiDocTemplate that maintains the 
     toolbars associated with a specific doc/view pair. 
     
     2) Intercept the activation/de-activation of the child frame window 
     (or view) and use the document template to hide/show that 
     view/document's specific toolbars...
     
     Is this a reasonable approach to this? Are there better or alternative 
     approaches to this?
     
     Thanks in advance,
     
     Pete Hodgman




peter.hodgman@autodesk.com
Monday, February 10, 1997

     Environment: MSVC 4.0 Win NT 4.0
     
     I am currently developing and MDI app. I would like to extend the 
     default behavior of the toolbars associated with the MDI app. 
     Basically, I have toolbars associated with specific document types and 
     I would like to hide/show a specific document type's toolbars as views 
     on a document activate/deactivate. It seems to me that a good approach 
     to this problem would be as follows:
     
     1) Provide a new subclass of CMultiDocTemplate that maintains the 
     toolbars associated with a specific doc/view pair. 
     
     2) Intercept the activation/de-activation of the child frame window 
     (or view) and use the document template to hide/show that 
     view/document's specific toolbars...
     
     Is this a reasonable approach to this? Are there better or alternative 
     approaches to this?
     
     Thanks in advance,
     
     Pete Hodgman
     




Gary Krone -- gkrone@inconsys.com
Monday, February 10, 1997

We had the same thing only instead of having several document types, we had
several views that had different toolbars associated with them. In our case
we created the toolbars as members of the view and used the
activation/deactivation to handle the changing of the toolbars.  The parent
window of the view is the frame, so designating the docking site is the same
as creating the toolbar within the frame.  

We also let the view take care of the messages from the toolbars.  This
makes it all one nice class that you can drop into other applications if needed.

At 03:42 AM 2/8/97 PST, you wrote:


>     Environment: MSVC 4.0 Win NT 4.0
>     
>     I am currently developing and MDI app. I would like to extend the 
>     default behavior of the toolbars associated with the MDI app. 
>     Basically, I have toolbars associated with specific document types and 
>     I would like to hide/show a specific document type's toolbars as views 
>     on a document activate/deactivate. It seems to me that a good approach 
>     to this problem would be as follows:
>     
>     1) Provide a new subclass of CMultiDocTemplate that maintains the 
>     toolbars associated with a specific doc/view pair. 
>     
>     2) Intercept the activation/de-activation of the child frame window 
>     (or view) and use the document template to hide/show that 
>     view/document's specific toolbars...
>     
>     Is this a reasonable approach to this? Are there better or alternative 
>     approaches to this?
>     
>     Thanks in advance,
>     
>     Pete Hodgman
>
>
>
>
>





GioVAX a.k.a. Giovanni Pezzino -- pezzino@CRES.IT
Wednesday, February 12, 1997

We used another approach. We developed an editor where you can select 
graphical objects. Different classes of objects had different toolbar 
buttons. 

What we did is add a CToolBar member variable to CMainFrame, and 
a SetToolBar() member function to the root class of objects. This function 
calls CMainFrame::SetSdlBar( UINT bmapID, UINT *codes, int numCodes ), which  
in turn calls LoadBitmap(...), SetButtons(...) and RecalcLayout().

Be careful if you have cases where the toolbar should be empty...

Hope this helps

GioVAX

Giovanni Pezzino- VMS/WIN/UNIX programmer |  DECNET: 39037::PEZZINO
 CRES - Centro per la Ricerca Elettronica |  Internet: PEZZINO@CRES.IT
        in Sicilia      (Palermo - Italy) |  




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