359 vs 361 IUIX_Icon.GetItem  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Sean - Tracker, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1214
Joined: Thu Sep 05, 2019 12:35 pm

359 vs 361 IUIX_Icon.GetItem

Post by zarkogajic »

Hi Support,

Trying to upgrade my code from 359 to 361 ...

The IUIX_Icon seems to no longer expose GetItem method.

In 359 : GetItem would return IUIX_ImageData.

In 361 this seems to be replaced by GetItemImage -> but using this method I receive null for IUIX_ImageData using the same code - just replacing GetItem with GetItemData (they have the same signature).

I've also tried using Get_Item which returns IUIX_IconItem and then GetImage -> but the resulting IUIX_ImageData is stil null.

p.s.
What my code does: grabs the icon associated with a command and draws it on some canvas... (via CreateIXCPage and StretchDraw)

-žarko
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2190
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: 359 vs 361 IUIX_Icon.GetItem

Post by Vasyl-Tracker Dev Team »

Hi Zarko.

Yes, in 360 build we refactored our backend for icons due to the proper support of the vector format for it. As result, the 99% of icons in Editor are vectorial. So now you cannot get raster-images via IUIX_Icon::GetItemImage/IUIX_IconItem::GetImage from them because they don't contain any raster inside (it works only for icons created from raster images). Instead, to get bitmaps from vector-icons you need to use something like:

Code: Select all

SIZE sizeIn = { availWidth, availHeight };
SIZE sizeOpt;
icon.GetOptimalSize(sizeIn, 0, out sizeOpt); // or: sizeOpt = sizeIn;
img = uiInst.CreateNewImage(sizeOpt.cx, sizeOpt.cy);
RECT r = { 0, 0, sizeOpt.cx, sizeOpt.cy };
icon.DrawToImage(img, r, r);
// img
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1214
Joined: Thu Sep 05, 2019 12:35 pm

Re: 359 vs 361 IUIX_Icon.GetItem  SOLVED

Post by zarkogajic »

Hi Vasyl,

Thanks. That does it.

p.s.
For future readers: DrawToImage is a method of IUIX_IconItem one gets from Icon.Get_Item()

-žarko
User avatar
Paul - Tracker Supp
Site Admin
Posts: 5864
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

359 vs 361 IUIX_Icon.GetItem

Post by Paul - Tracker Supp »

:)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply