Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Window.WinMenuHandle (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] Window.WinMenuHandle only works once
Next thread: [MBS] SharedObjMBS broken on XP?


Re: [MBS] MIDI Destinations and External Devices   -   Ron Benditt
  [MBS] Window.WinMenuHandle   -   Mike D.
   Re: [MBS] Window.WinMenuHandle   -   Christian Schmitz
    Re: [MBS] Window.WinMenuHandle   -   Mike D.
     Re: [MBS] Window.WinMenuHandle   -   Christian Schmitz
      Re: [MBS] Window.WinMenuHandle   -   Chris Little
       Re: [MBS] Window.WinMenuHandle   -   Mike D.
   Re: [MBS] Window.WinMenuHandle only works once   -   Mike D.

[MBS] Window.WinMenuHandle
Date: 17.04.03 17:29 (Thu, 17 Apr 2003 09:29:18 -0700)
From: Mike D.
This code works great to have Menus on all windows
#if TargetWin32
self.WinMenuHandle = app.globalMenuHandleWin32
self.height = self.height + GetWindowMarginTopW32(self.winHWND)
#endif

However, I find that menu Enabling and Handling all seems to be
routed through to the first window opened, not other windows.

I'd really like my Mac and Windows versions to work the same. Is
there any way to get the EnableMenuItems() and Menu Handlers to work
in a secondary window when using this technique?

I've thought about doing this in the main window but it seems like an
ugly hack:
(In main window menu handler code)

dim w as window
if not fronmostwindow(self) then
for i = 0 to windowcount
w = window(i)
if w isa MyProjectWindow then
select case menuitemselected
case "Edit"
MyProjectWindow(w).DoEditMenuEvent
[etc.]

That's a lot of code for each menu event. Must be a better way?

Re: [MBS] Window.WinMenuHandle
Date: 18.04.03 01:51 (Fri, 18 Apr 2003 02:51:50 +0200)
From: Christian Schmitz
> However, I find that menu Enabling and Handling all seems to be routed
> through to the first window opened, not other windows.

Yes. Why don't you keep the first window invisible, so the menu bar is
not destroyed and you can from this window on send events to the other
windows.

> I'd really like my Mac and Windows versions to work the same. Is there
> any way to get the EnableMenuItems() and Menu Handlers to work in a
> secondary window when using this technique?

No. It's the way Realbasic works, that I can't change.

BTW, this is only a hack and you should fill a bugreport so RS can add
the multiple menubar feature to RB 5.5.
(Something like a checkbox for each window telling that this window
get's a copy of the menubar.)

Or you do like the explorer and launch a copy of the application for
each window.

Mfg
Christian

Re: [MBS] Window.WinMenuHandle
Date: 18.04.03 21:37 (Fri, 18 Apr 2003 13:37:32 -0700)
From: Mike D.
> > However, I find that menu Enabling and Handling all seems to be routed
> > through to the first window opened, not other windows.
>
>Yes. Why don't you keep the first window invisible, so the menu bar is
>not destroyed and you can from this window on send events to the other
>windows.

Ok, but what about the other bug report (that after opening and
closing a window, the 2nd time you can't assign the menu handle, it
remains zero)?

Re: [MBS] Window.WinMenuHandle
Date: 18.04.03 22:59 (Fri, 18 Apr 2003 23:59:34 +0200)
From: Christian Schmitz
> Ok, but what about the other bug report (that after opening and
> closing a window, the 2nd time you can't assign the menu handle, it
> remains zero)?

RB will dispose the menu...

Mfg
Christian

Re: [MBS] Window.WinMenuHandle
Date: 19.04.03 00:07 (Fri, 18 Apr 2003 19:07:59 -0400)
From: Chris Little
on 4/18/03 5:59 PM, Christian Schmitz at <email address removed>
wrote:

>> Ok, but what about the other bug report (that after opening and
>> closing a window, the 2nd time you can't assign the menu handle, it
>> remains zero)?
>
> RB will dispose the menu...
>

Actually Windows does. The solution to Mike's problem is to set the menu to
0 in the window's close event.

Chris

Re: [MBS] Window.WinMenuHandle
Date: 19.04.03 01:20 (Fri, 18 Apr 2003 17:20:37 -0700)
From: Mike D.
>on 4/18/03 5:59 PM, Christian Schmitz at <email address removed>
>wrote:
>
>>> Ok, but what about the other bug report (that after opening and
>>> closing a window, the 2nd time you can't assign the menu handle, it
>>> remains zero)?
>>
>> RB will dispose the menu...
>>
>Actually Windows does. The solution to Mike's problem is to set the menu to
>0 in the window's close event.
>
>Chris
>

That does the trick, thank you!