Skip to content

Commit

Permalink
Menu items without actions are disabled
Browse files Browse the repository at this point in the history
Signed-off-by: obulat <obulat@gmail.com>
  • Loading branch information
obulat committed Apr 14, 2018
1 parent 711419b commit b30fd8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/winforms/toga_winforms/app.py
@@ -1,7 +1,9 @@
import sys

import toga

from .libs import Threading, WinForms, add_handler
from .window import Window
import toga
import sys


class MainWindow(Window):
Expand Down Expand Up @@ -60,10 +62,9 @@ def create_menus(self):
submenu.DropDownItems.Add(item)
if submenu:
menubar.Items.Add(submenu)

self.interface.main_window._impl.native.Controls.Add(menubar)


self.interface.main_window._impl.native.MainMenuStrip = menubar
self.interface.main_window.content.refresh()

def open_document(self, fileURL):
'''Add a new document to this app.'''
Expand Down
11 changes: 8 additions & 3 deletions src/winforms/toga_winforms/window.py
@@ -1,4 +1,3 @@
import toga
from toga import GROUP_BREAK, SECTION_BREAK
from travertino.layout import Viewport

Expand Down Expand Up @@ -66,10 +65,16 @@ def set_app(self, app):
@property
def vertical_shift(self):
# vertical shift is the toolbar height or 0
result = 0
try:
return self.native.interface._impl.toolbar_native.Height
result += self.native.interface._impl.toolbar_native.Height
except AttributeError:
return 0
pass
try:
result += self.native.interface._impl.native.MainMenuStrip.Height
except AttributeError:
pass
return result

def set_content(self, widget):
if self.toolbar_native:
Expand Down

0 comments on commit b30fd8e

Please sign in to comment.