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

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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.
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

One IUIX_Cmd for two IUIX_CmdItems - different title / tip ?

Post by zarkogajic »

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 :)


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

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

Post by Sasha - Tracker Dev Team »

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.pdf-xchange.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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

Hi Alex,

As I said: you never know :)

This is awesome! Thanks.


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

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

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ