Hello, I'm replacing the IconFamilyMBS class with the new NSWorkspace.IconForFile function. In the old way, I used the IconFamilyMBS.data to write all icons of a given item to a binary stream; when reading the file, I'd set the read data back to an IconFamilyMBS.data property, so all the icon sizes would be stored in one call.
I'm playing with converting that to the new way. As far as I understand, there's no way to get all icon sizes as a string with one single call; I have to loop thru all the available sizes, using the Image.Representations method, and write each picture to the binary stream. Am I correct? So, I'm testing this code in a blank project, to show various icon sizes (there's a listbox with 2 columns (width and height) and a canvas; a property (Image as NSImageMBS) is in the window): Sub SetUp(File As FolderItem) dim i As Integer dim r,rl() As NSImageRepMBS if File<>nil then Image=NSWorkspaceMBS.iconForFile(File) if Image<>nil then rl=Image.representations for i=0 to UBound(rl) r=rl(i) LB1.AddRow str(r.pixelsWide) LB1.Cell(LB1.LastIndex,1)=str(r.pixelsHigh) next end if end if End Sub In the Listbox's change event: if Image<>nil and me.ListIndex>-1 then Image.setSize(val(me.Cell(me.ListIndex,0)),val(me.Cell(me.ListIndex,1))) Cnv1.Backdrop=Image.CopyPictureWithMask Cnv1.Refresh end if I have two questions regarding this: 1: I don't understand the difference between r.PixelsHigh and r.Height (and the width counterpart). Am I using the right one? 2: the representations returned have non-unique values: I'm getting, for instance, 32x32 several times, with no clear differences between them (the other properties seem to be identical). Should I just ignore the ones that are repeating to get all the possible icons? Thank you. _______________________________________________ mbsplugins@monkeybreadsoftware.info mailing list %(list_address)s https://ml-cgn08.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info