Modal window ... menu disabled

Is this possibly related to <https://xojo.com/issue/21826> ?

Open the modal window
Add a Menu Handler for whatever menus you want to implement
By default menus are set to enabled if there’s a menu handler & disable if there isn’t one

No, since this occurs on the MS-Windows - side only. On Mac the same source has the menu-items enabled and selectable. Did not test with Linux by now.

Checked with feedback, it seems this had never been reported. Rick, maybe you file a report?

[quote=52296:@Rolf Genster]No, since this occurs on the MS-Windows - side only. On Mac the same source has the menu-items enabled and selectable. Did not test with Linux by now.

Checked with feedback, it seems this had never been reported. Rick, maybe you file a report?[/quote]

Workin on it.

[quote=52264:@Norman Palardy]Open the modal window
Add a Menu Handler for whatever menus you want to implement
By default menus are set to enabled if there’s a menu handler & disable if there isn’t one[/quote]

Thanks for clarifying.

OK try this - really
1 - create a new desktop project (this gives you a window menu bar & app class)
2 - on the new default window (window1) place a bevel button
3 - implement the action event of the window with
window2.showmodal
4 - add a new window (this will be named window)
5 - add a bevel button to it
6 - implement it’s action event with
self.close
7 - set window2s menu property to “MainMenuBar” in the layout editor - this is important for windows as a window can have NO menu bar if you don’t set one
8 - implement window 2’s EnableMenuItem event with
EditCopy.Enabled = true
9 - add a menu handler to window2 for EditCopy
10 - implement this new menu handler with
break
return true

Change window2s frame type around how ever you want
Run

Window 2 now has a menu bar & edit copy will be enabled and if you select it you should hit the break statement

So are you saying, Norman, that on Windows, a modal dialog has to implement its own handler for every menu item it cares about rather than relying on whatever is implemented in the app class?

No
This was just to illustrate

Is this the same scenario from your previous threads? If so, you may have failed to mention that these windows are modal. Opening a modal window from another modal window can be problematic. If you get too many of them stacked up, it could easily crash. Similar to a stack overflow situation.

[quote=52329:@Norman Palardy]OK try this - really
1 - create a new desktop project (this gives you a window menu bar & app class)
2 - on the new default window (window1) place a bevel button
3 - implement the action event of the window with
window2.showmodal
4 - add a new window (this will be named window)
5 - add a bevel button to it
6 - implement it’s action event with
self.close
7 - set window2s menu property to “MainMenuBar” in the layout editor - this is important for windows as a window can have NO menu bar if you don’t set one
8 - implement window 2’s EnableMenuItem event with
EditCopy.Enabled = true
9 - add a menu handler to window2 for EditCopy
10 - implement this new menu handler with
break
return true

Change window2s frame type around how ever you want
Run

Window 2 now has a menu bar & edit copy will be enabled and if you select it you should hit the break statement[/quote]

Norman, I will definitely give that a try. I’ll report back my results.

I guess I failed to mention any such thing as I did not think of it. In any event, I did not have one modal window opening another in my app.

Thanks though for this info as it would certainly be something to avoid.

There “were” 5 different windows I was opening in a modal state. None of which were open at the same time nor were any of them called from another. I found a better way to do what I was using 3 of them for and now only have 2 left, one of which will stay modal and does not require a menu, the other I can work with as a “Floating Window”

Well, I tried Norma’s “test” and it does work but from that it would seem to me that one would have to “implement its own handler for every menu item it cares about” in order for them to be “active”.

I will test this out on my app at work tomorrow.

[quote=52373:@Rick Yerex]Well, I tried Norma’s “test” and it does work but from that it would seem to me that one would have to “implement its own handler for every menu item it cares about” in order for them to be “active”.
[/quote]
No
But that will depend on what you want each menu handler to do
If you want something unique on each form then you CAN implement something unique on each form - but you don’t HAVE to

[quote=52374:@Norman Palardy]No
But that will depend on what you want each menu handler to do
If you want something unique on each form then you CAN implement something unique on each form - but you don’t HAVE to[/quote]

I added to your test that I created as follows

To the MainMenuBar, I added a Menu and in it I added 2 Menu Items. I named them CtrlA and CtrlB and set the key to A and B and the MenuModifier is On.

I then created menu handlers for each in Window2 that simply display a Messagebox

In the EnableMenuItems event, I set CtrlB.Enabled=True

I then ran the app and opened Window2 … sure enough, CtrlA was disabled and CtrlB was enabled and I could press Ctrl+B on the keyboard and get the messagebox … but NOT Ctrl+A.

This tells me that I will have to “enable” each menu item on a given window that I want to be “active” if the window is opened in a modal state.

This clears it up for me and I thank you.