Forum > Cocoa

[Solved] menu not accessible after window creation osx

<< < (2/3) > >>

trev:
Ok, I added the override directive and now it compiles. It looks fine to me. There is no menu because you have not coded one :-)

Please go read the Lazarus Wiki article Writing a Cocoa app without the LCL for how to add a menu.

Key-Real:
the program in the posted link shows the same behavier.

If I start it, I can not click on the menu (nothing hapens), than I click on another window (my prog looses focus), than I click back on my window app, now I can click on the menu.

macOS 11.6.4


l attach the screen recording as evidence:

http://www.sistavip.com/pub/screen.zip

trev:
If you are creating a GUI executable, then you need to wrap it in an application bundle. You can execute the bundle with:


--- Code: --- open mybundle.app
--- End code ---

or


--- Code: ---./mybundle.app/Contents/MacOS/mybundle
--- End code ---

and  if you do that, then the menu items are accessible.

Key-Real:
Thx,
now I create a Bundle and everything works well.

But
I toke the Info.plist from the Lazarus link above

--- Code: XML  [+][-]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";}};} ---<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'<plist version="1.0"><dict>  <key>CFBundleDevelopmentRegion</key>  <string>English</string>  <key>CFBundleExecutable</key>  <string>test</string>  <key>CFBundleIconFile</key>  <string>macicon.icns</string>  <key>CFBundleIdentifier</key>  <string>org.magnifier.magnifier</string>  <key>CFBundleInfoDictionaryVersion</key>  <string>6.0</string>  <key>CFBundlePackageType</key>  <string>APPL</string>  <key>CFBundleSignature</key>  <string>MAG#</string>  <key>CFBundleVersion</key>  <string>1.0</string></dict></plist> 
he trows my a parsing error.
I removed this file from the bundle, everything works

Do I need this file?

trev:
I just used the script to create an Info.plist file and then checked it by using the property list utility thus:


--- Code: Bash  [+][-]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";}};} ---trev@macmini7 [/Users/trev] $ cd Magnifier.app/trev@macmini7 [/Users/trev/Magnifier.app] $ cd Contents/trev@macmini7 [/Users/trev/Magnifier.app/Contents] $ plutil Info.plistInfo.plist: OK
and as you can see it is parsed as OK. I also opened it in Xcode's PlistEditor plugin and no parsing error was detected.

Looking at the file you pasted into your post, the error is on line 2 where you have a trailing ' (single quotation mark) character.

Yes, the Info.plist file is a required application bundle file.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version