About and preferences dialogs

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 869
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

About and preferences dialogs

Post by marksmithhfx » Wed Nov 09, 2022 10:31 pm

Hi, when you build a Mac standalone, under the application menu it has entries for About <Application> and Preferences... (Currently greyed out). I imagine these are customisable but I've just not found any documentation on how to do this. Thanks for any advice or links to any lessons you can provide.

Mark
macOS 12.5 (Monterey), Xcode 13.2, LC 9.6.8, iOS 15.2
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9438
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: About and preferences dialogs

Post by FourthWorld » Thu Nov 10, 2022 3:07 am

See the User Guide, section "Programming Menus & Menu Bars", in the subheading "Special menu items" on page 176.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 869
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: About and preferences dialogs

Post by marksmithhfx » Thu Nov 10, 2022 10:31 am

See the User Guide, section "Programming Menus & Menu Bars", in the subheading "Special menu items" on page 176.
Thanks Richard. I should probably re-read the user guide at some point :)

Mark
macOS 12.5 (Monterey), Xcode 13.2, LC 9.6.8, iOS 15.2
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9438
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: About and preferences dialogs

Post by FourthWorld » Thu Nov 10, 2022 6:27 pm

marksmithhfx wrote:
Thu Nov 10, 2022 10:31 am
I should probably re-read the user guide at some point :)
It's too big to read straight through. I just use the Search feature in most PDF programs to find topic-specific stuff as it comes up.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 869
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: About and preferences dialogs

Post by marksmithhfx » Sun Nov 13, 2022 10:35 pm

FourthWorld wrote:
Thu Nov 10, 2022 6:27 pm
It's too big to read straight through. I just use the Search feature in most PDF programs to find topic-specific stuff as it comes up.
As I discovered. Even just reading the section on Programming Menus & Menu Bars (starting at pg 173) with its dizzying array of options and explanations was a bit overwhelming in one go. Notably, however, it did describe how LC pulls together an "application-specific" menu by pulling "Quit" from the last entry in a File menu, "Preferences" from the last item in an Edit menu, and "About" from the last element in a Help menu and mixing that with a bunch of OS specific defaults. While I understood what the author was telling me, without a concrete example it was a bit difficult to imagine the steps required to do this. Which led me to BYU and Devin Assay's excellent example of building a custom application menu. Hats off to Devin. I could now build and install my own application menu. I hadn't actually done this in my application yet, just a test stack I built for the exercise. And I was left wondering, because I saw no mention of this in the User Guide or Devin's notes... "What happens to the default application menu that LC creates for your standalone, and are the items in it (like About, Preferences and Quit) editable or scriptable in any way?" And after a bit of head scratching I concluded the answer was, "No, you are supposed to create your own menu to REPLACE the default one, and so the items in the default (placed there by LC) menu are not accessible". I could be wrong (I actually hope I am) because what comes next is not what I was looking for.

So to keep this short, I tried various ways (scripting, using the menu builder, different orders of code lines, etc, whatever I could think of) to get rid of the File, Edit and Help menus that were required to populate the menu items on the application menu and I could not. It seems to me you are stuck with them. You can disable each individual button in those menus, but the menus themselves still sit there, only with greyed out buttons that can't be selected (which I think looks a little bit silly).

I am probably missing something obvious. Is it possible to create a single custom application menu with About, Preferences and Quit without having to have File, Edit and Help menus as well?

One hopes!

Thanks,
Mark
macOS 12.5 (Monterey), Xcode 13.2, LC 9.6.8, iOS 15.2
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9438
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: About and preferences dialogs

Post by FourthWorld » Sun Nov 13, 2022 11:48 pm

marksmithhfx wrote:
Sun Nov 13, 2022 10:35 pm
Is it possible to create a single custom application menu with About, Preferences and Quit without having to have File, Edit and Help menus as well?
What kind of app needs a menu bar without the required File, Edit, and Help menus?

To answer the question, the Application menu is unique to macOS, and only supported in LC Script with regard to moving the required items (Quit, Preferences) from their respective positions on other OSes into the Mac's Application menu. If you need to create a fully custom Application menu you'd need access to Apple's lower-level APIs, accessible within LC with LC Builder.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 869
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: About and preferences dialogs

Post by marksmithhfx » Mon Nov 14, 2022 12:30 pm

FourthWorld wrote:
Sun Nov 13, 2022 11:48 pm
To answer the question, the Application menu is unique to macOS, and only supported in LC Script with regard to moving the required items (Quit, Preferences) from their respective positions on other OSes into the Mac's Application menu. If you need to create a fully custom Application menu you'd need access to Apple's lower-level APIs, accessible within LC with LC Builder.
Thanks Richard. I just wanted to confirm I wasn't missing anything obvious. The app is a very simple utility that performs a very specific task, so there really isn't any need for menus, but in the interests of conformity I've opted to move some of the options that were previously available in buttons into the menus (redundantly) but probably with a preference option to "Hide buttons" for those who prefer menus. :D

With any luck (and a blessing from Apple) I may have this in Test Flight in the near future. Then you can beat up on it and provide input (hopefully) for the next iteration. This version will most definitely be an MVP.

Mark
macOS 12.5 (Monterey), Xcode 13.2, LC 9.6.8, iOS 15.2
Targets: Mac, iOS

Post Reply

Return to “Mac OS”