Forum > Cocoa
MainMenu: How to use the "Quit <App>" item that has been added in trunk?
rich2014:
hi, Madref
since you need to automatically generate the Quit menu item, you don't need to set dontAutoCreateItems.
--- Quote --- CocoaConfigMenu.appMenu.dontAutoCreateItems := True;
--- End quote ---
madref:
But if I set it to false I get all the other options too...
I only want to have [About] [Settings] and [Quit]
And do you know how to change the [About test] to let's say [About Referee DB]
rich2014:
CocoaConfigMenu.appMenu.customMenus for full control.
--- Quote ---CocoaConfigMenu.appMenu.customMenus:= TMenuItem_costomMenus;
--- End quote ---
madref:
I finally found a solution to this problem with the help from Rich2014 and some tinkering.
I created a pop-up menu with a sub menu in it with the right references to the correct procedures.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- PUM_Main_Sub: TMenuItem; PUM_Main_Settings: TMenuItem; PUM_Main_Info: TMenuItem; PUM_Main_Exit: TMenuItem; PUM_Main: TPopupMenu;Then the following code to create it all
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm_Lint.FormCreate(Sender: TObject);begin {$IFDEF DARWIN} CocoaConfigMenu.appMenu.customMenus := PUM_Main_Sub; CocoaConfigMenu.appMenu.dontAutoCreateItems := True; {$ENDIF}end; // FormCreateBy setting the dontAutoCreateItems to True you get only the menu you created.
for the result see the attachment
madref:
I still do have a question about this:
How can I change the bitmap once the menu has been created.
If you look closely the [Info]-bitmap is black and I am using a blue set of color.
So how can I change this during runtime because the user might change the color-scheme to red or another different color
Navigation
[0] Message Index
[*] Previous page