May 10, 2024, 04:21:15 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


menus in child windows

Started by LarryMc, April 09, 2010, 10:26:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Working on the visual designer I was to the point of displaying the menu on the form displayed in the 'form editor' tab.

I put the normal menu commands right after the openwindow command; no menu displayed
I put the normal menu commands in the @IDCreate message handler; no menu displayed
I created a menu using the createmenu() functions in both the above places;; no menu displayed

Created a test program with my menu and it worked fine with the menu code i was using.

Kept trying things for a couple of hours; ; no menu displayed

Started striping code out.
Got it down to where all my handle had was was a closewindow in the handler; no menu displayed

Took all my style flags out when opening the window; no menu displayed

change the parent to 0;  got my menu.

So, I learned the hard way that non-mdi child windows can't display menus.

Anyone know a work-around?

If not then I have to open up the positioning bucket of worms i was trying to avoid and draw a dummy menu bar.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

You should read the Windows SDK documentation, search for the WS_CHILD style.  Child windows cannot have menus.  MDI child windows don't really have menus either, they just replace the MDI frame main menu when activated. Only top level windows are allowed to have a menu.

Yes it is confusing, but that is Windows.  Consider the CreateWindow and CreateWindowEx API functions.  They have an HMENU parameter that serves two purposes, if it is a top level window you can pass it a menu handle, but if it is a child window then the parameter is used for the child window identifier, and passing it a menu handle would set the identifier to the integer value of the handle. 

So no, there isn't work around.
Ionic Wind Support Team

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library