One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?  SOLVED

PDF-XChange Editor SDK for Developers

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

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: 630
Joined: Thu Sep 05, 2019 12:35 pm

One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?

Post by zarkogajic » Thu Mar 19, 2020 3:39 pm

Hi support,

I'm creating a custom command, IUIX_Cmd, and adding it twice to my custom bar - so two IUIX_CmdItem are placed on the bar.

Can I somehow specify different title for different CmdItem?

p.s.
Yes, the command will do the same thing in both cases when executed, but the context between first item and second item is different - that's why I need those two items to display different titles.

p.s.2
Ok, ok, I'll admit, those two items are not actually on the same bar, each cmdItem goes to a different instance of IPXV_Control (hence "context" above).

p.s.3
Yes, I know (read: fear) the answer is 99.99% "no" - but you never know in this day and age :)



User avatar
Sasha - Tracker Dev Team
User
Posts: 4855
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?

Post by Sasha - Tracker Dev Team » Thu Mar 26, 2020 8:25 am

Hello zarkogajic,

Well, luckily for you, there is a way of doing that :)
You will have to use the IUIX_CmdHandler2 interface though in place of the IUIX_CmdHandler.
The https://sdkhelp.tracker-software.com/vi ... Appearance method should give the needed index of the appearance based on your needs. Basically it's called on the CommandItem update (redraw, creation or manual refresh by code).
Then there are a bunch of the command's methods and properties that need to be SET for appearance usage:

Code: Select all

HRESULT AddNewAppearance([in, defaultvalue(0)] LONG nSrcAppIndex, [out, retval] LONG* nNewAppIndex);

	HRESULT SetTitle(LONG nAppIndex, BSTR sTitle, [in, defaultvalue(-1)] VARIANT_BOOL bUpdateItems);
	HRESULT SetShortTitle(LONG nAppIndex, BSTR sShortTitle, [in, defaultvalue(-1)] VARIANT_BOOL bUpdateItems);
	HRESULT SetTip(LONG nAppIndex, BSTR sTip, [in, defaultvalue(-1)] VARIANT_BOOL bUpdateItems);
	HRESULT SetIcon(LONG nAppIndex, IUIX_Icon* pIcon, [in, defaultvalue(-1)] VARIANT_BOOL bUpdateItems);
	HRESULT SetUserData(LONG nAppIndex, PARAM_T nData, [in, defaultvalue(-1)] VARIANT_BOOL bUpdateItems);
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 630
Joined: Thu Sep 05, 2019 12:35 pm

Re: One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?  SOLVED

Post by zarkogajic » Thu Mar 26, 2020 1:46 pm

Hi Alex,

As I said: you never know :)

This is awesome! Thanks.



User avatar
Sasha - Tracker Dev Team
User
Posts: 4855
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?

Post by Sasha - Tracker Dev Team » Thu Mar 26, 2020 2:08 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply