Add MWX logo to MenuItem

How does one add an image to a MenuItem? There is no spot for an imageWell or canvas, and it is NOT an icon.
How?

Mac? Win? iOS? Web?

1 Like

Didn’t think there would be differences.
Desktop would be nice, but I’ll take everything, so I don’t have to ask again.

Read the docs… is always a good idea; usually the answer is there (not always, but yes, it is in this case).

And yes, it is an image, but beware of its size, mostly on Windows.

BTW: a link, maybe ?

http://documentation.xojo.com/api/deprecated/menuitem.html#menuitem-icon

So. It is an icon?

No, an image, but who cares ?

Back to basics:
what is an icon ?

An image. I build an image and set it to an OS object. The OS (Explorer, Finder, Linux equivalent) translate that to icon, store it internally and display it to you.

In the OP question, the OS do the same: you pass a small image to the MenuItem (once more read the docs) and the OS will display it where it have to be.

Just do it !

Sorry but it isn’t clear. When I think of icon, I think of 16x16 pixels and not 300x200 pixels.

From where do you found 300x200 ?

Creata an image that is 16 x 16, save it using RedApple.png as its name, drop it into your project and use the code below.

What is unclear there ?

Follow the example from the docs:

Example

The following code is in the Open event of the main window. The image appears to the left of the menu item’s text.

EditFind.Icon = RedApple

One of MWX logos is about 300x200.
MWX = Made With XOJO

And you want to have that sized image in a Menu ??? :wink:

MWX was unknow to me.

It’s available on XOJO.com under Company and at the bottom.
It’s also there in Dark Mode

Sorry. I do not understand that you wanted to set that image into a MenuItem.

Resize it to 16 x 16 and you will understand that what you want to do is not possible: unreadable.

The question was not clear (for me), so my answer was for “I want to add images into MenuItems”.

When i read the title, I changed MWX logo to image… :frowning:

I chose the wrong words for the subject. I don’t know what the popup is called. It’s not a window or a page. And it is not a popup.

I also cannot change the subject, even though there is a pencil indicating it’s modifiable.

Please put the MWX logo on a window, e.g. an about this app window.

Sorry. I just realized I might be asking for the impossible.

I am trying to avoid creating another permanent window. I was wondering if adding an image can be done by code. I guess not

This is code from XDev Magazine (11.2) from the About Box.
#if TargetMacOS then
declare function NSClassFromString lib “Cocoa” ( className as CFStringRef ) as Ptr
declare function sharedApplication lib “Cocoa” selector “sharedApplication” ( classRef as Ptr ) as Ptr
declare sub orderFrontStandardAboutPanel lib “Cocoa” selector “orderFrontStandardAboutPanel:” ( ref as Ptr )
orderFrontStandardAboutPanel( sharedApplication( NSClassFromString( “NSApplication” ) ) )
#EndIf

orderFrontStandardAboutPanel and orderFrontStandardAboutPanelWithOptions are also in NSApplicationMBS class.