Icon on MacOS menu

Hello everyone, is there any code that I can use to place an icon on the menu bar on the (right side) of the Mac OS screen while my app is active?

I’ve already looked and haven’t found anything specific. I’m using older apps made in XOJO 2017 and porting them to XOJO 2025 and I need them to work on both. If anyone can help, I’d appreciate it.

Please check NSStatusItemMBS in MBS Plugins.
We have plenty of examples for this.

1 Like

GitHub - vidalvanbergen/macoslib at master-64bit still working for me.

Sorry for the large screen shot, but here it is:

Choose the MainMenuBar on the Navigation pane (on the left)
Choose a Menu (here: Quit)
Click in Appearance → Icon and choose one.

You do not have choices there ?

Put your Icons files in a Folder (macOS), and drop the folder into the navigation pane.

Click to choose one from what you just dropped.

Standard Quality (1x) or HiDPI (2x, 3x) ?
Size of the 1x icon ?

BTW: you can download the Examples and search if there is one that fits.

Cmd-N, look on the bottom-left, press option-click to download the archive (I think it’s option-click), then search in the decompressed archive.

SORRY: right side of the screen, not in the application menus… (as you can read, it’s late at night here)

So, there:
image

Look at the previous answers.

Tanks Emile Schwarz and Carlo Rubini, I’ll take a look at your suggestion and then get back to you. Today is a busy day, but I’ll look into it tomorrow.

Hello, I took a look but didn’t see anything I could use, I even did some tests but it gave an error, could you help me to shed some light on this case ?
Maybe I didn’t understand what and how to use the examples!

What you need to do is to show exactly what you did (with code) and what results you got. Your post is too vague.

Let’s say you downloaded the plugins and found this example:

/MacCocoa/NSStatusItem/StatusItem

To make it work, you need the following plugins installed:

  • MBS MacCocoa Plugin
  • MBS MacBase Plugin
  • MBS Main Plugin

Xojo needs to start again after you copied the plugin files in order to recognize them.

For more tests maybe ask for trial license.

Or see a video here:

Thumbnail288x160 MBS Plugin Installation on macOS

Thumbnail288x160 MBS Plugin Installation on Windows

Here is a working example: it contains MacOSLibrary and launching the Xojo file should put a menu on the right of MenuBar.
It find it enough for my needs.
statusItemExample.zip (627.1 KB)

1 Like