osx - TMainMenu - managing Help and Search menu items -


running firemonkey app in osx, search box automatically appears on last menu item, have labeled "help." far good, because menu search box standard osx.

next, needed add file. purchased impressive utility help crafter , made apple helpbook. placed helpbook bundle resources folder of main app. used project|options|version info in ide edit info.plist file. added 2 keys cfbundlehelpbookfolder , cfbundlehelpbookname info.plist point helpbook.

running app, found had 2 menu items -- item had programmed , apparently automatically created mac os, complete submenu item brings helpbook. amazement, had working without coding whatsoever.

next, wanted remove menu item had created in order eliminate duplication. search box still located under menu item, not on menu item created os. , when deleted menu item, search box relocated last menu item created me.

  1. how can specify search box should located on os-created menu item?

  2. alternatively, can specify os should not automatically create menu item (so can create myself)? in case, should need know how program loading of helpbook.

  3. if stick os-created menu item, how can add additional submenu items it?

it appears apple documentation , search functions provided os when helpbook has been registered. 2 functions supposed on same menu item. wondering if may firemonkey bug being split up.

there 3 parts question above. have had no luck 1 , 3, have partial solution 2.

to prevent os automatically creating menu, necessary delete cfbundlehelpbookfolder , cfbundlehelpbookname keys in info.plist. registering of helpbook accomplished in formcreate with:

var {$ifdef macos}   helpbundle: nsbundle;   appbundle: nsbundle;   path: string;   helpreg: boolean; {$endif} begin {$ifdef macos}   helpmgr := tnshelpmanager.create; // helpmgr declared global variable   appbundle := tnsbundle.wrap(tnsbundle.occlass.mainbundle);   path := appbundle.bundlepath.utf8string +     '/contents/resources/myapphelp.help';   helpbundle := tnsbundle.wrap(tnsbundle.occlass.bundlewithpath(strtonsstr(path)));   helpreg := helpmgr.registerbooksinbundle(helpbundle);   if not(helpreg)     showmessage('failed register book'); {$endif} 

to open helpbook, placed following code in onclick event of appropriate submenu item (i.e. help| myapp help):

helpmgr.openhelpanchor(strtonsstr('page0'),          strtonsstr('com.mycompany.myapp.help')); 

this approach resulted in spotlight help field being added automatically menu. unfortunately, spotlight doesn't index helpbook anymore. approach had first tried (using info.plist described in original post), spotlight did index helpbook but, reported, spotlight field created on my last menu item , on new menu item created automatically os, while functional non-standard.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -