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

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


Text in ToolBar ?

brijesh@pune.gssl.ernet.in
Friday, January 19, 1996

Hello buddies,
	Is it possible to put pure text in Toolbar. If yes,then 
can someone tell me how can be done. I don't want the text's on
the buttons (as it can be done using CToolBarCtrl) but on the
client area of toolbar. 
	Apart from this I would like to know that can I put my 
toolbar as the child of the view. I tried this but the toolbar 
was not visible. All the time view only was availble in whole 
area without toolbar. The only reason I could detect is that
toolbar must be a child of window derived from CFrameWnd. The 
documentation of CToolBAr at any place does't say that it must 
be the child of a frame window.

-------------------------------------------------------------------------
	One can't change the past but one can ruin a perfectly good
	present by worrying about the future.


Brijesh Kumar Mishra
e-mail : brijeshm@gssl.ernet.in
-------------------------------------------------------------------------



Brad Wilson -- bradw@netnet.net
Tuesday, January 23, 1996

[Mini-digest: 2 responses]

Brijesh Mishra wrote:
 
> Hello buddies,
>         Is it possible to put pure text in Toolbar. If yes,then
> can someone tell me how can be done. I don't want the text's on
> the buttons (as it can be done using CToolBarCtrl) but on the
> client area of toolbar.

Sure.  Put a static text control on the toolbar.

>         Apart from this I would like to know that can I put my
> toolbar as the child of the view. I tried this but the toolbar
> was not visible. All the time view only was availble in whole
> area without toolbar. The only reason I could detect is that
> toolbar must be a child of window derived from CFrameWnd. The
> documentation of CToolBAr at any place does't say that it must
> be the child of a frame window.

I don't think so ... toolbars and status bars are owned by the frame window.

--
class CBradWilson : public CWorldWatchProgrammingTeam {
  public:
    void GetInetAddr  ( CString& s ) { s = "bradw@exptech.com";      }
    void GetE164Addr  ( CString& s ) { s = "+1 (810) 620-9803";      }
    void GetURL       ( CString& s ) { s = "http://www.exptech.com"; }
    void GetDisclaimer( CString& s ) { s = "All I say is fact :-p";  }
};

-----From: Christophe Nasarre 

Brijesh Mishra wrote:

> Is it possible to put pure text in Toolbar. If yes,then 
> can someone tell me how can be done. I don't want the text's on
> the buttons (as it can be done using CToolBarCtrl) but on the
> client area of toolbar. 

I don't which version of Visual C++ you are using but you should find a sample 
called CTRLBARS where a ComboBox is added to a toolbar. 
Just replace the Combo with a static and here you are !


> Apart from this I would like to know that can I put my 
> toolbar as the child of the view. I tried this but the toolbar 
> was not visible. All the time view only was availble in whole 
> area without toolbar. The only reason I could detect is that
> toolbar must be a child of window derived from CFrameWnd. The 
> documentation of CToolBAr at any place does't say that it must 
> be the child of a frame window.

In VC++ 1.5x, WINFRM.CPP source file implements CFrameWnd class. You can find 
three function under this title : "CFrameWnd standard control bar management"
   OnSysColorChange() (received by a view ?? --> only for a top level window)

   OnUpdateControlBarMenu()
   OnBarCheck()
   called by OnIdleUpdateCmdUI() when it is time to refresh buttons and status bars
   

I'm not sure that it will be easy for you to add methods to your View in order to 
support toolbar as a frame window even if RecalcLayout() is a CWnd method...


Good luck

   Chris -- a poor lonely frenchie --






John Addis -- jaddis@mail.erols.com
Thursday, January 25, 1996

Brijesh Mishra wrote:

<...> 
>         Apart from this I would like to know that can I put my
> toolbar as the child of the view. I tried this but the toolbar
> was not visible. <...> The only reason I could detect is that
> toolbar must be a child of window derived from CFrameWnd. The
> documentation of CToolBAr at any place does't say that it must
> be the child of a frame window.

A CToolBar doesn't *have* to be the child of a CFrameWnd -- it's just 
much more convenient that way. I'm going to assume that you are talking 
about a CView derived class in an MDI child window, correct? If so what 
you need to do is the following:

1) Derive a new class from CMDIChildWnd for the frame of the view
2) Add a CToolBar to the new frame wnd class
3) Override OnCreate as normal and create the toolbar

-- 
John Addis        Master of Time and Space
jaddis@erols.com  C++, MFC, Win32, Win95, TCP/IP
"Invalid or missing REALITY.COM Universe halted."





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