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

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


New Toolbars and Menus like Office 97

Jens Bohlmann -- bohly@ki.comcity.de
Saturday, March 15, 1997

Environment: VC++ 4.2b, Windows NT 4.0 SP2

Hi,
Has anybody any experience with the new REBAR/FLAT-STYLE TOOLBAR =
controls for creating Menubars ( replacing the standard Menu in the =
window ) as they appear in Office 97? Are there any source code samples =
to convert menu-resources into toolbars which handle the standard =
CCmdUI-mechanism. I think the CFrameWnd must be also overridden to be =
created without a menu.

something like this:

CMainFrm::OnCreate(...)
{
  ....
  if ( !m_MenuBar.Create( this, nMenubarID ) ||
       !m_MenuBar.LoadMenuBar( IDM_MYMENU ) )
  {
    TRACE0("failed to create menubar");
    return FALSE;
  }
  ....
  return TRUE;
}

with a base class like this

class CMenuBar : public CToolBar
{
  ...
  public:
    // create the menubar and assign it to the given id;
    Create( CFrameWnd* pParent, UINT nMenubarID );
  =20
    // fill menubar with the resource menu
    LoadMenuBar( UINT IDM_MYMENU ) ;
    ...
}

I thought VC 5.0 has it, but it seems not so...=20

Thanks for your ideas
Jens





Mike Blaszczak -- mikeblas@nwlink.com
Tuesday, March 18, 1997

[Mini-digest: 3 responses]

At 15:11 3/15/97 +0100, you wrote:
>Environment: VC++ 4.2b, Windows NT 4.0 SP2

> Has anybody any experience with the new REBAR/FLAT-STYLE TOOLBAR
> controls for creating Menubars ( replacing the standard Menu in
> the window ) as they appear in Office 97?

Office 97 is using windows that it draws by itself from scratch.
That is, Office 97 isn't using the ReBar control or flat-style
toolbar controls.

It'd take you about 30 seconds to verify this for yourself by
using Spy++, even if you have a very slow machine.

> Are there any source code samples to convert menu-resources int
> toolbars which handle the standard CCmdUI-mechanism.

Not that I know of.  That would be quite a feat, since toolbars are
just flat lists of buttons while menus are indefinitely hierarchical.

>with a base class like this

>class CMenuBar : public CToolBar
>{

That would be a bad idea. You'd end up creating both a CToolBar and
whatever you wanted to create with your CMenuBar.


.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
       One is too many and a million is not enough.
-----From: Scot 


Hi Jens,

Objective Toolkit has a good first step in this direction - an entirely
customizable toolbar that has an Office 97 look and feel.  We are
working on "full command bars" which basically means replacing the menu.

It's not trivial - I did this once in a previous position and rewriting
CMenu takes a minimum of a man month.  Think about the issues - you've
got to send all of those menu messages at the right time (run spy++ on a
menu sometime and you'll see what I mean).  For example, MFC idles on a
WM_ENTERIDLE message that the menu sends which causes the menu prompts
to be displayed on the status bar.   This is just one of the many
messages you have to get right.

Another big issue is speed.  I don't know if you've noticed or not, but
the 'File' menu on VC5 is noticably slower (to me at least) than in VC
4.2 when it was a CMenu.

With this in mind, if it's still important enough to you to invest that
kind of effort, I'd suggest starting with our new toolbar (that's what
we're doing) - or waiting for us to do it, or check out the ActiveX SDK
which has this rebar thing which implements more of an IE3 l+f.

HTH,
Scot Wingo
Stingray Software
http://www.stingsoft.com




>-----Original Message-----
>From:	Jens Bohlmann [SMTP:bohly@ki.comcity.de]
>Sent:	Saturday, March 15, 1997 9:12 AM
>To:	'mfc-l@netcom.com'
>Subject:	New Toolbars and Menus like Office 97
>
>Environment: VC++ 4.2b, Windows NT 4.0 SP2
>
>Hi,
>Has anybody any experience with the new REBAR/FLAT-STYLE TOOLBAR controls for
>creating Menubars ( replacing the standard Menu in the window ) as they
>appear in Office 97? Are there any source code samples to convert
>menu-resources into toolbars which handle the standard CCmdUI-mechanism. I
>think the CFrameWnd must be also overridden to be created without a menu.
>
>something like this:
>
>CMainFrm::OnCreate(...)
>{
>  ....
>  if ( !m_MenuBar.Create( this, nMenubarID ) ||
>       !m_MenuBar.LoadMenuBar( IDM_MYMENU ) )
>  {
>    TRACE0("failed to create menubar");
>    return FALSE;
>  }
>  ....
>  return TRUE;
>}
>
>with a base class like this
>
>class CMenuBar : public CToolBar
>{
>  ...
>  public:
>    // create the menubar and assign it to the given id;
>    Create( CFrameWnd* pParent, UINT nMenubarID );
>   
>    // fill menubar with the resource menu
>    LoadMenuBar( UINT IDM_MYMENU ) ;
>    ...
>}
>
>I thought VC 5.0 has it, but it seems not so... 
>
>Thanks for your ideas
>Jens
>
-----From: Rajesh Parikh 

Dear Jens,
The VC++ team at MS dropped the idea of supporting REBAR style controls =
as They felt that they should not support till it is becomes a  part of =
Win OS. I had read an article on the web(don't remember the site) =
regarding this. We can expect them in later versions of MFC.

Rajesh Parikh
rparikh@usa.net

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Office :
Software House,
3362-G, AE Block,
8th Street - 11th Main Road,
Anna Nagar, Madras - 600 040
India

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D



----------
From: 	Jens Bohlmann
Sent: 	Saturday, March 15, 1997 7:41 PM
To: 	'mfc-l@netcom.com'
Subject: 	New Toolbars and Menus like Office 97

Environment: VC++ 4.2b, Windows NT 4.0 SP2

Hi,
Has anybody any experience with the new REBAR/FLAT-STYLE TOOLBAR =
controls for creating Menubars ( replacing the standard Menu in the =
window ) as they appear in Office 97? Are there any source code samples =
to convert menu-resources into toolbars which handle the standard =
CCmdUI-mechanism. I think the CFrameWnd must be also overridden to be =
created without a menu.

something like this:

CMainFrm::OnCreate(...)
{
  ....
  if ( !m_MenuBar.Create( this, nMenubarID ) ||
       !m_MenuBar.LoadMenuBar( IDM_MYMENU ) )
  {
    TRACE0("failed to create menubar");
    return FALSE;
  }
  ....
  return TRUE;
}

with a base class like this

class CMenuBar : public CToolBar
{
  ...
  public:
    // create the menubar and assign it to the given id;
    Create( CFrameWnd* pParent, UINT nMenubarID );
  =20
    // fill menubar with the resource menu
    LoadMenuBar( UINT IDM_MYMENU ) ;
    ...
}

I thought VC 5.0 has it, but it seems not so...=20

Thanks for your ideas
Jens




Ervin Fried -- ervinf@netcom.ca
Saturday, March 22, 1997

Hello!

re: menus in Office97 
those are not based on ReBar 
btw, the name is coolbar, as used in the ActiveX SDK docs and include files

re: coolbar mfc class
We did a MFC wrapper for the coolbar (simple as we needed the functionality
of the IE toolbar) we found that is best to have a CWnd as base class.

To convert a menu to the coolbar wouldn't be so hard, but i would suggest
doing some pre-processing, ie not trying to load/process a complete menu at 
run time. What I am thinking about is to display a popup menu in response
to pressing a button on the toolbar (like the favorites menu in IE)

To handle the cmdui mecanism it more dificult (see the previous responses)

Another problem is specifying the bitmaps to be used by the coolbar.
You will have to specify that too, not just the menu resource to be 
converted (unless you are satisfied with having buttons that look the same,
ie just text).

Last but not least, you'll have to remember that coolbar is still beta 
( a strange beta, as IE will install it as 'final', without any warning. 
I supose that the new comctl32.dll contains exactly the same code for old 
common-controls, but with a couple of new entries for the new ones.
Also, i guess that beta is used here re: OS purposes not for IE)

Being beta, it may happen any day that MS will modify it.


Regards,

Ervin

> Environment: VC++ 4.2b, Windows NT 4.0 SP2
> 
> Hi,
> Has anybody any experience with the new REBAR/FLAT-STYLE TOOLBAR controls
> for creating Menubars ( replacing the standard Menu in the window ) as they
> appear in Office 97? Are there any source code samples to convert
> menu-resources into toolbars which handle the standard CCmdUI-mechanism. I
> think the CFrameWnd must be also overridden to be created without a menu.
> 
> something like this:
> 
> CMainFrm::OnCreate(...)
> {
>   ....
>   if ( !m_MenuBar.Create( this, nMenubarID ) ||
>        !m_MenuBar.LoadMenuBar( IDM_MYMENU ) )
>   {
>     TRACE0("failed to create menubar");
>     return FALSE;
>   }
>   ....
>   return TRUE;
> }
> 
> with a base class like this
> 
> class CMenuBar : public CToolBar
> {
>   ...
>   public:
>     // create the menubar and assign it to the given id;
>     Create( CFrameWnd* pParent, UINT nMenubarID );
> 
>     // fill menubar with the resource menu
>     LoadMenuBar( UINT IDM_MYMENU ) ;
>     ...
> }
> 
> I thought VC 5.0 has it, but it seems not so... 
> 
> Thanks for your ideas
> Jens
> 
> 
> 
Ervin



Michael Hupp -- mhupp@ti.lmco.com
Wednesday, March 26, 1997

-----Original Message-----
From:	Ervin Fried [SMTP:ervinf@netcom.ca]
Sent:	Saturday, March 22, 1997 9:00 AM
To:	mfc-l@netcom.com
Subject:	Re: New Toolbars and Menus like Office 97

Hello!

re: menus in Office97 
those are not based on ReBar 
btw, the name is coolbar, as used in the ActiveX SDK docs and include files

This is interesting Ervin.  I ran a grep through all of VC4.2 and VC5.0 include files (including MFC) and I only saw coolbar once.

#define ICC_COOL_CLASSES     0x00000400 // rebar (coolbar) control

I saw Rebar all over the place.

d:\devstudio\vc\include\COMMCTRL.H(996)://====== REBAR CONTROL ========================================================
d:\devstudio\vc\include\COMMCTRL.H(998):#ifndef NOREBAR
d:\devstudio\vc\include\COMMCTRL.H(1001):#define REBARCLASSNAMEW         L"ReBarWindow32"
d:\devstudio\vc\include\COMMCTRL.H(1002):#define REBARCLASSNAMEA         "ReBarWindow32"
d:\devstudio\vc\include\COMMCTRL.H(1005):#define REBARCLASSNAME          REBARCLASSNAMEW
d:\devstudio\vc\include\COMMCTRL.H(1007):#define REBARCLASSNAME          REBARCLASSNAMEA
d:\devstudio\vc\include\COMMCTRL.H(1011):#define REBARCLASSNAME          "ReBarWindow"
d:\devstudio\vc\include\COMMCTRL.H(1021):typedef struct tagREBARINFO
d:\devstudio\vc\include\COMMCTRL.H(1030):}   REBARINFO, FAR *LPREBARINFO;
d:\devstudio\vc\include\COMMCTRL.H(1049):typedef struct tagREBARBANDINFOA
d:\devstudio\vc\include\COMMCTRL.H(1065):}   REBARBANDINFOA, FAR *LPREBARBANDINFOA;
d:\devstudio\vc\include\COMMCTRL.H(1066):typedef REBARBANDINFOA CONST FAR *LPCREBARBANDINFOA;
d:\devstudio\vc\include\COMMCTRL.H(1068):typedef struct tagREBARBANDINFOW
d:\devstudio\vc\include\COMMCTRL.H(1084):}   REBARBANDINFOW, FAR *LPREBARBANDINFOW;
d:\devstudio\vc\include\COMMCTRL.H(1085):typedef REBARBANDINFOW CONST FAR *LPCREBARBANDINFOW;
d:\devstudio\vc\include\COMMCTRL.H(1088):#define REBARBANDINFO       REBARBANDINFOW
d:\devstudio\vc\include\COMMCTRL.H(1089):#define LPREBARBANDINFO     LPREBARBANDINFOW
d:\devstudio\vc\include\COMMCTRL.H(1090):#define LPCREBARBANDINFO    LPCREBARBANDINFOW
d:\devstudio\vc\include\COMMCTRL.H(1092):#define REBARBANDINFO       REBARBANDINFOA
d:\devstudio\vc\include\COMMCTRL.H(1093):#define LPREBARBANDINFO     LPREBARBANDINFOA
d:\devstudio\vc\include\COMMCTRL.H(1094):#define LPCREBARBANDINFO    LPCREBARBANDINFOA

re: coolbar mfc class

Where is this MFC class.  I sure don't see a coolbar mfc class?  If you have a version of MFC that I don't have, how can I get it?
Michael




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