Is it possible to have a different set of toolbar graphics for Windows and Mac programmatically? … on account windows doesn’t scale at all. Thanks Windows.
install all the buttons and icons you need in the IDE, then make them visible or not by program.
Maybe I don’t understand the challenge, but if you do want to use the same images for your toolbar buttons for both Mac & Windows, I think this does work, providing you setup your images correctly.
I’m using Xojo 2019r1.1 and my current project has a toolbar and the images look and scale the same on Mac & Windows 10 (whether 100, 150 or 200%).
In my case, I added some images (“Insert” menu > “Image”), then added three sized *.png images for my icons, starting at 32x32 (@1), then 64x64 (@2) and 96x96 (@3). These sized versions should be accurate for each size (true 32x32, 64x64 & 96x96 representation of the image), and not a rescaled version of the same original image that you’ve resized yourself in an image editor - if that makes sense?
Then from the Toolbar Inspector, I selected my images from the “Icon” drop-down for each of the buttons. When I run the app, the appropriate image should show for the given screen scaling.
The only annoying difference I found with the Toolbar is that Windows doesn’t support the Flexible Space feature. But I can live with that.
Or is this a problem for older versions of Windows than 10?
I hope some of this helps.
If you intend to set images different for Mac and for Windows, then do it after you are sure that the toolbar has been initialized.
Something like this:
if Toolbar11.ToolItem1.icon <> nil then
//apply the icons for Win
//apply the icons for Mac
Actually, you can set the icons in the IDE for your main platform, and use the conditional execution of applying icons only for the other platform.
and if you forgot youve done that and load the project from your other platform OS laptop
Actally I use the snippet above to change icons and their captions on the fly, since that particular app needs that kind of approch…
Otherwise one could initialize the toolbar in its open event.
and if you forgot youve done that and load the project from your other platform OS laptop [/quote]
It does not matter. Conditional compilation does not depend on the platform the project runs on.
I certainly misread. I understand: the main platform is the running platform. So, this part is not conditional.
I guess I am surprised the Windows OS doesn’t automatically standardize the icon size to 32x32 or something. It honestly got so confusing when there are standard definition and high definition (retina) screens out there.
I follow the path you ran, resized some icons to different sizes and keep the one that do not enlarge the menu height (I thnk it was that).
Like many (bad boys), I never go to the MS documentation. Usually, I get an eye on what major applications do and follow the path. This s not always reliable, but works most of the time.
I am not sure icons in the Menus add something to the users (do they even care ?); but this add beauty to the application and good writings in reviews (I think).
The main issue is that windows can scale to almost any percent. Let me know if you want a link to the more modern edition: