Setting Menu Icons only for Windows

I’m sure there’s a simple trick to having Menu Icons show only in Windows, but I can’t find it. Help a brotha out!

Look for #If TargetWin or same for 64 bits…

I’m trying to add icons for the menu items, but when I add an icon in the IDE, it adds them for all platforms. I just want to add them for Windows.

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

Something like:

#If TargetWindows FileOpen.Icon = File_Icon #EndIf

No decent way directly in the IDE since it assume all platforms
Code will let you use #if Target to set it up

Ah. Figured because the menu items and shortcuts change per platform, the icons might too.

Thanks everyone.

So… I added a 16x16 transparent .png to my menu item for Windows, but it’s way too big.
The Xojo docs say the image will be resized to the text size, but it’s actually much bigger.
I assume to get the image into the app, I use the “Add Image” function in the IDE?
When I do that, it shows 3 sizes of Icon, 48x48, 96x96 and 144x144. So, maybe this added image is being resized?

If I’m doing it wrong, what’s the “proper” way of adding a menu item to the app?

Ok, that’s weird. If I just choose an image in the Menu editor, it creates an image folder with the proper sized icons.
Then I delete that selection from the Menu Item and add it in with the #If TargetWindows in MainWindow.Open.

Seems a roundabout way to do it. How do I create an image folder with the proper sized images to start with?

You could create a copy of your toolbar, one with and one without icons
Then assign the one you want inside a #if target

Or you can create a toolbar with icons, and set them to nil in the open or enablemenu events of a window

[quote]I assume to get the image into the app, I use the “Add Image” function in the IDE?
When I do that, it shows 3 sizes of Icon, 48x48, 96x96 and 144x144. So, maybe this added image is being resized?[/quote]

if you want to add a picture without the 48x48, 96x96 and so on (these are app icon sizes, not menu icons) , untick the ‘supports HDI’ option in the IDE, then drag the PNG into your project.
Then assign the name of the icon to your menu item.

[quote=468890:@Jeff Tullin]You could create a copy of your toolbar, one with and one without icons
Then assign the one you want inside a #if target

Or you can create a toolbar with icons, and set them to nil in the open or enablemenu events of a window[/quote]
Good tip, thanks!

[quote]if you want to add a picture without the 48x48, 96x96 and so on (these are app icon sizes, not menu icons) , untick the ‘supports HDI’ option in the IDE, then drag the PNG into your project.
Then assign the name of the icon to your menu item.[/quote]
See above - the size is correct when an image is added via the menuitem icon (proper 16x16) without changing any HDI settings. If I add an image manually, it starts at 48x48.

Not sure what that’s all about.

In a non-HDI Windows environment 1616 will display correctly, occupying exactly 1616 pixels that is. Drag a set of icons directly into a folder ‘Icons’ or similar that you create in the navigator. Label it properly as you can get easily confused as the project grows e.g. different sizes, different labels. Once the icons are there you can use the names as constant.

It is convenient once you have all the icons you want stored in the project to do ‘File’ -> ‘Collect project items’. This will collect alle the physical files and store them in a folder ‘Images’ next to the source files. That allows for moving the project to different locations without breaking the links to the actual files. For a professional and consistent look, I can suggest to download the Axialis Icon Generator, which can generate ton’s of icons in several sizes, from 8 to 512 pixels in both Windows and MacOS filetypes. Not free, though, but beautiful and very convenient.