Skip to main content
Participating Frequently
November 7, 2007
Question

[IDCS2 Win]How to get Interface for ISwatchesUIDData?

  • November 7, 2007
  • 11 replies
  • 801 views
Hi All,

Please tell me how to get the Interface for ISwatchesUIDData.
Also please tell how to make use of GetItemList() method.

I need to get a count of all swatches that are selected in the Swatches Pallette.

Is this the Correct class &method that i have to use for my requirement?

Help needed very urgent.

Thanks
myRiaz
This topic has been closed for replies.

11 replies

_iswan_Author
Participating Frequently
November 13, 2007
Hi<br /><br />I have got the Swatch Names in PMString as below:<br /><br />PMString swatchName= Utils<ISwatchUtils>()->GetSwatchName(db, uid);<br />CAlert::InformationAlert(swatchName.GrabCString());<br /><br />Now i have to write this in a txt file.The found that i ahve to use<br />"IPMSteam" to do this.I tried using the function below:<br /><br />virtual int32 XferByte (uchar *buf, int32 num)=0 <br /><br />The problem is the Swatch name's are in "PMString" but i have to pass<br />"uchar" in XferByte so that i can continue further in writing to a txt file.<br />Plz tell "How to Convert PMString to uchar"?<br />Any Code Snippets Plz.<br /><br />Thanks<br />myRiaz
_iswan_Author
Participating Frequently
November 13, 2007
Hi

Thanks a Lot!I have Done it!Hats off to u!
Known Participant
November 12, 2007
Hi

I believe you can do this with ISwatchUtils's GetSwatchName()

1) Iterate through UIDList
2) Get UID
3) Call GetSwatchName()
4) Repeat for the rest of the items in the UIDList

ISwatchUtils also have a range of helpful functions.
Most of the time you will find what you need in ***Utils.

Good luck!
_iswan_Author
Participating Frequently
November 12, 2007
Hi Jaepil,

How should i get the Swatch Name's of these selected swatches?

Thanks
myRiaz
_iswan_Author
Participating Frequently
November 12, 2007
Its Working Thanks a Lot Jaepil!
Known Participant
November 11, 2007
Hi myRiaz<br /><br />You should never define IID for existing interfaces.<br />Just make sure that all required header files are included.<br /><br />#include "ISession.h"<br />#include "IApplication.h"<br />#include "IPanelMgr.h"<br />#include "SwatchesPanelID.h"<br />#include "ISwatchesUIDData.h"<br /><br />Try the code below. It seems to work for me.<br />But It's not thoroughly tested, so please use it at your own discretion.<br /><br />InterfacePtr<IApplication> application(gSession->QueryApplication());<br />InterfacePtr<IPanelMgr> panelMgr(application->QueryPanelManager());<br />InterfacePtr<IControlView> swatchPanel(panelMgr->GetPanelFromWidgetID(kSwatchesPanelWidgetID));<br />InterfacePtr<ISwatchesUIDData> swatchUID(swatchPanel, IID_ISWATCHESUIDLIST);<br /><br />UIDList swatchList = swatchUIDData->GetItemList();<br />PMString tempString;<br />tempString.AppendNumber(swatchList.Length());<br />CAlert::InformationAlert(tempString);
_iswan_Author
Participating Frequently
November 9, 2007
Hi Jaepil,<br /><br />Thanks a lot for your tremedous help!<br /><br />Im right now trying out [Option B]that you have suggested.<br />Please have a look at the code snippet that i have tried out.<br />When i compile this snippet i get my plugin Built but when i open the Indesign & run my plugin i get the following error"Indesign.exe has encountered a proble and needs to close" & Indesign Quits Suddenly.<br />Some where im going wrong,but dont know where.Plz help me out.<br />Here is the code:<br /><br />InterfacePtr<IApplication> app(gSession->QueryApplication());<br />InterfacePtr<IPaletteMgr> paletteMgr(app->QueryPaletteManager());<br />InterfacePtr<IPanelMgr> panelMgr(paletteMgr, UseDefaultIID());<br />InterfacePtr<IControlView>swatchPanelView(panelMgr->GetVisiblePanel(kSwatchesPanelWidgetID ));<br /> <br />InterfacePtr<ISwatchesUIDData> SwatchUID<br />(swatchPanelView,IID_ISWATCHESUIDLIST); //Here i got an error that IID_ISWATCHESUIDLIST is not declared.So i declared it myself as PMIID IID_ISWATCHESUIDLIST; is this correct?(Problem in this line only i guess!!!)<br /> <br />const UIDList &select=SwatchUID->GetItemList(); <br />sprintf(buf,"%d",select.Length());<br />CAlert::WarningAlert(buf);<br /><br />Plz tell where am i going wrong .WAITING 4 UR REPLY.<br /><br />Thanks<br />myRiaz
Known Participant
November 9, 2007
Found the WidgetID: kSwatchesPanelWidgetID

You need to include this file to access the ID
#include "SwatchesPanelID.h"
Known Participant
November 9, 2007
Hi Myriaz,<br /><br />Yeah I can understand what you want to do now.<br />I haven't done it myself but I think this is what you can do.<br /><br />[Option A]<br />1) Inherit SwatchObserver<br />2) Extend UpdateSwatchesUIDData() function.<br />2.1) Ensure the parent's UpdateSwatchesUIDData() function is called first. Save the result into local variable so you can return it later.<br />2.2) Get InterfacePtr for SwatchesUIDData. (e.g. InterfacePtr<ISwatchesUIDData> SwatchUID(this, IID_ISWATCHESUIDLIST); )<br />2.3) Work with SwatchUID<br />2.4) Return the result from calling the parent method.<br /><br />[Option B]<br />Alternatively you can access the Swatch panel using IPanelMgr::GetPanelFromWidgetID().<br /><br />Example:<br />// Get panelMgr first from Session > Application > PanelManager<br />InterfacePtr<IControlView> swatchPanelView(panelMgr->GetPanelFromWidgetID(??));<br />InterfacePtr<ISwatchesUIDData> SwatchUID(swatchPanelView, IID_ISWATCHESUIDLIST);<br /><br />But I don't know the WidgetID for the Swatch panel, sorry.
Known Participant
November 9, 2007
Hi Jaepil,<br /><br />Thanks for ur reply.I have tried all those you have told before itself.But my task is not just to get a count of swatches that are visible in the Swatches pallette instead i have to get "a count of swatches that are currently clicked or selected in the Swatches Pallette".<br /><br />For doing this i think i have to use ISwatchesUIData i guess!I think i have to use GetItemList()member function to do this.am i right?But i dont know what parameter to pass to get the Interface of ISwatchesUIData <br /><br />i.e What should i pass here inside the paranthesis!!!<br /><br />InterfacePtr<ISwatchesUIData>SwatchUID(?,?); <br /><br />Hope u can understand what im asking.<br />Waiting for ur reply.<br /><br />Thanks<br />myriaz