![]() |
TMainMenu unter OSX
Hi,
ich hab mal eine Frage. Bei XE2 musste ich, um den ersten Menüeintrag im Applikationsmenü zu haben folgendes machen: application.ApplicationMenuItems := mnuMain; mnuMain.Visible := false; Wie mache ich das unter XE5? |
AW: TMainMenu unter OSX
Mit Bordmitteln geht das nicht wirklich, auch scheinen die Shortcuts zerfriemelt.
Meine Behelfsfunktion schaut so aus (FMX.Platform muss eingebunden sein):
Code:
Ich sollte eventuell erwähnen das das Hauptformular kein Menü haben sollte, sondern entweder ein Unterformular oder ein Datenmodul.
function ActivateMenu(const Menu: TMainMenu): Boolean;
var MenuService: IFMXMenuService; begin result := assigned(Menu) and TPlatformServices.Current.SupportsPlatformService(IFMXMenuService, IInterface(MenuService)); if result then MenuService.CreateOSMenu(Application.MainForm, Menu); end; |
AW: TMainMenu unter OSX
Nachtrag:
Es ist wesentlich sauberer, wenn Du das hier machst:
Delphi-Quellcode:
Das ist in abgewandelter Form von hier:
TMainMenu = class(FMX.Menus.TMainMenu, IItemsContainer)
protected procedure DoRecreateOSMenu(const Form: TCommonCustomForm); override; public procedure Activate; end; { TMainMenu } procedure TMainMenu.Activate; begin IFMXMenuService(TPlatformServices.Current.GetPlatformService( IFMXMenuService)).CreateOSMenu(Application.MainForm, Self); end; procedure TMainMenu.DoRecreateOSMenu(const Form: TCommonCustomForm); begin { do nothing - Activate method now controls this } end; ![]() Christian |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:35 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz