Import a folder full of icons

I prepared standard and @2 images in a folder for a ToolBar.

Once done, I drag and drop it to discover I have all icons (standard + 2) in the PopupMenu.

Bug ?

Example:

Why wouldn’t it? Import them in the usual maner.

What is ā€œthe usual wayā€? I couldn’t find anything about it in the documentation at a quick glance: Image Set Editor — Xojo documentation. :person_shrugging:

1 Like

So, you will import (how) 13 icons manually one after the other ?

Can you elaborate on what you call ā€œthe usual mannerā€

When dealing with images, either I drop it to the navgator pane (as I do for the icons) or I load it/them with a FolderItem (depends).

I selected the ToolBar Icons destination Folder and right-click:

I have a folder in the navigator called icons and I put them all there.

how ?

Drag and drop.

Once in there, Xojo gives each a name which you can use to refer to them in code.

However, @Emile_Schwarz problem seems to be the automatic (or not automatic) assignment of the @2 (@3) variants of the images to their (@1) variants.

In your example, all images are imported as individual image sets, right?

All three images one file afteter the other… ? :wink:

I retold the story since some do not followed the first time:

1 in my hard disk I created a folder I named ToolBar_Icons_Liste,
Then, I created 13 sets oc ToolBar Icons and I placed then in the Finder folder.

Once done, I drag ā€˜n’ drop the ToolBar_Icons_Liste folder from the Finder into The Navigator Pane.

Then I started to set the icons to the ToolBadButton(s)…

At that moment, I noticed I have 26 sets of ToolBar Icons… in the PopupMenu.

I deleted all that were suffixed ā€˜2’ and all is correct NOW.

But,this looks like a bug to me. And you ?

Please, don’t TLIA5 !

THEY ARE TOOLBAR ICONS; they is no "refer them to codeā€; you can see the OpopupMenu where there names are stored by Xojo above. Look and read carefully before answering, please. :slight_smile:

Even ToolBar Icons can be referred within Code. :wink:


Back on topic: I’d rather create a feature request, because according to the description here: Getting started with graphics — Xojo documentation, this all seems normal.

However, the behavior you suggested makes sense and would be a relief.

I pretty much only refer to them in code - all my toolbar buttons are created at app startup.

They don’t even explain the developer must add a suffix to the 2x and 3x images files (@2, @3).

Of course, if I’ve done as I usually do:
create a Folder in the Navigator,
Create the images and drag the base one into that folder

I will never experiment that. But for once, I started creating the icons first.

BTW: May I change an icon from a ToolbarButton on the fly (when the application run) ?
I have an Icon that either use a Company art (and how can I change that is the question) or I use a Who (the text) instead to have a generic.
Of course I prefer to ba able to change the icon (using the company who run the application logo).

Simply drag and drop the ā€œdefaultā€ (@1x) icons into the IDE:

explorer_1d3xWcMecU

4 Likes

That is good when you have one or two images, but as I already wrote:

I had 113 set of 2 images I stored in a folder, then I drag and drop the Folder into the navigation pane.

Xojo creates a folder, populate each image found there (two times); here lies the trouble.

Then do them one pair at a time. It only needs to be done once. File a feature request if you want it to group items together by name in a single drag and drop action.

Or save yourself time and runtime memory and only load them when you need them, storing a reference in a dictionary as you go so the same picture can all use the same instance. That’s how the IDE does it. It’ll make your project smaller and more compatible with version control systems too!

2 Likes

We often have over 100 sets of images.
Simply order them by measurements, select the @1x and drag them into the project.

1 Like

Thank you for that Gif!

It showed me how to import all three sizes of images in one go. My icon generator includes icon sizes in the name, along with the @2x/@3x, and that’s why it never imports the @2x and @3x, because it assumes different names are different icons, instead of the same icon at @2x and @3x sizes.

I’ll have to do some renaming of the files before importing to make it so much easier.

2 Likes

If you just drag the small ones, Xojo will still populate the other sizes all in one drag and drop action. Watch StefanA’s gif.