[comp.windows.ms.programmer] Menus in dialogs

kstout@medieval.East.Sun.COM (Kate Stout - Sun BOS Software) (04/16/91)

I would like to include menus in a dialog. Any thoughts or 
suggestions on how to go about this? References to correct
documentation, Petzold examples, are good too.

Thanks

Kate Stout

bonneau@hyper.hyper.com (Paul Bonneau) (04/18/91)

In article <5542@eastapps.East.Sun.COM> kstout@medieval.UUCP () writes:
>
>I would like to include menus in a dialog. Any thoughts or 
>suggestions on how to go about this? References to correct
>documentation, Petzold examples, are good too.
>
The key here is to get the (*!(!&!$&!%) dialog editor to emit
a text file, instead of a .res file.  Do this by performing a
file saveas and give an explicit .dlg extension.

Now, edit the resulting text file and simply add the CLASS
statement to the header, with the name of a class you will
register for the dialog proc (instead of using the default
as usual).

Instead of returning true or false, your dialog proc will
call DefDlgProc() for any messages it does not handles.  It
will be a "true" window proc, with a long return value.

Also, since you will now register a class for the dialog
proc, you don't need to do a MakeProcInstance() (but make
sure the name is in your .def file!).  Essentially, you
are just using a regular window proc instead of a dialog
proc.

Oh, yeah.  Of course you need to create a MENU resource
and supply the name when you register your class.  I
haven't tried this personally, but in theory it should
work!

cheers - Paul Bonneau.

dweinste@wookumz.gnu.ai.mit.edu (David Weinstein) (04/19/91)

In article <5542@eastapps.East.Sun.COM> kstout@medieval.UUCP () writes:
#I would like to include menus in a dialog. Any thoughts or 
#suggestions on how to go about this? References to correct
#documentation, Petzold examples, are good too.

Windows in a dialog box? Sick, twisted, documented, and easy. :-)

The specifics are in the Reference Volume 2 (around 7-35). Look up
the specifics regarding the creation (indirectly) of a dialog box,
and you will find that the dialog template structure includes a slot
for an asciiz string which specifies the menu (which you compile in
with the resource compiler). 

Be warned, so far as I can tell, you can't use the arrow keys to shift
from menu to menu to like you can in a normal window, but Alt-(char)
works just fine...


--Dave

--
Dave Weinstein                            Internet: dweinste@isis.cs.du.edu
Disclaimer: You aren't serious, are you?            dweinste@gnu.ai.mit.edu
In the beginning, there was nothing. And God said, "Let there be Light."
And there was still nothing. But, you could see it.

roberth@microsoft.UUCP (Robert HESS) (04/22/91)

Kate Stout (kstout@medieval.East.Sun.COM) asks:

|  I would like to include menus in a dialog. Any thoughts or
|  suggestions on how to go about this?

...Yes. Don't Do It!

Menus are *not* supported in dialogs (or child windows), while it is
possible to install a menu in a dialog (but not child windows), there
are a number of things that won't work right once you get it there.

Dialog boxes are not supposed to have menu bars, scroll bars (on the
client area), size borders, or be allowed to be minimized.  This is not
to say you can't do any of these things, just that it is highly
recommended that you don't.

When developing your Windows application, it is very important that you
do things the same way that other Windows applications do it.  This
maintains a standard interface for the user, and allows them to easily
understand how to utilize new programs.

If you want to flex your UI muscles a little, and add something whizzy,
unique and creative, then do it in your 'About' box, and not in your
applications interface.

-Robert

 __________________________________________________________________________
     #####   ####### |	  Robert B. Hess, Microsoft Corp., Redmond, WA
    ######  #######  |-----------------------------------------------------
   ####### #######   |	roberth@microsof.uu.net
  #### ##### ####    |	{decvax, uunet, uw-beaver}!microsof!roberth
 ####  ###  ####     |_____________________________________________________
   "...my opinions are strictly my own, and not those of my employer..."

dweinste@wookumz.gnu.ai.mit.edu (David Weinstein) (04/28/91)

In article <71984@microsoft.UUCP> roberth@microsoft.UUCP (Robert HESS) writes:
#
#
#Kate Stout (kstout@medieval.East.Sun.COM) asks:
#
#|  I would like to include menus in a dialog. Any thoughts or
#|  suggestions on how to go about this?
#
#...Yes. Don't Do It!
#
#Menus are *not* supported in dialogs (or child windows), while it is
#possible to install a menu in a dialog (but not child windows), there
#are a number of things that won't work right once you get it there.

SDK Reference Volume 2:

      dtMenuName[]   Specifies a null-terminated string that specifies
                     the name of the dialog box's menu. If this field
                     is NULL, the dialog-box window does not have a menu.

    (page 7-33)


Now this looks awfully "supported" to me (although I will agree with you
that the default Dialog Window Proc doesn't handle the Menu as fully as
I'd like). As for maintaining a consistent look/feel across various
Windows Apps, if it looks like a popup window, and it acts like a popup
window, the end-users don't care *how* I implement it....

--Dave


--
Dave Weinstein                            Internet: dweinste@isis.cs.du.edu
Disclaimer: You aren't serious, are you?            dweinste@gnu.ai.mit.edu
In the beginning, there was nothing. And God said, "Let there be Light."
And there was still nothing. But, you could see it.