Skip to main content
Participating Frequently
September 16, 2023
Question

Problem with 2 tree views

  • September 16, 2023
  • 1 reply
  • 1186 views

Hi,

 

I have 2 TreeViewWidgets in my dialog box. However when I dynamically populate 1 the other also gets populated.

Attached is the .fr file.

 

How do I keep upload of these 2 TreeViewWidgets  seperate

This topic has been closed for replies.

1 reply

Inspiring
September 17, 2023

You are using the same Implementation ID and same CPP files for TreeVierwWidgetMgr and TreeViewHierarchyAdapter.

 

When treeview is displayed it calls functions such as GetNumOfItems, GetNthItem etc. Becuase your cpp files are common, both tree view widgets uses the same business logic and displays the same content.

 

Solution -

Create separate implementationID and corresponding cpp files.

 

 

- Rahul Rastogi

Adobe InDesign SDK Plugin Developer.

 

 

Class
{
kWMSlDlgTreeViewWidgetBoss,
kTreeViewWidgetBoss,
{
IID_ITREEVIEWWIDGETMGR,            kWMSlDlgTreeViewWidgetMgrImpl,
IID_ITREEVIEWHIERARCHYADAPTER,    kWMSlDlgTreeViewAdapterImpl,
/** Hold names of the list item */
IID_ISTRINGLISTDATA,        kStringListDataImpl, 
}
},
 
Class
{
kWMSlDlgTreeViewWidgetBoss2,
kTreeViewWidgetBoss,
{
IID_ITREEVIEWWIDGETMGR,            kWMSlDlgTreeViewWidgetMgrImpl,
IID_ITREEVIEWHIERARCHYADAPTER,    kWMSlDlgTreeViewAdapterImpl,
/** Hold names of the list item */
IID_ISTRINGLISTDATA,        kStringListDataImpl, 
}
},
Participating Frequently
September 17, 2023

Hello Rahul,

 

I did try with seperate implemention ID and corresponding cpp files, but it crashes on dialog creation: line 174 in WatermarkUIActionComponent.cpp.

 

You can get the source code from this link .

 

The sub directory "Data Text Files" contains all the text files used in the plugin.

The sub directory "Build Related Files" contains *.vcxproj* files.

 

This is my first plugin. Trying to build my plugin by modifying the watermarkui plugin in SDKSamples. Kindly help.

 

Ziauddin Syed

Robert at ID-Tasker
Legend
September 22, 2023

Hi Ziauddin,

 

On click of button do the following -

 

1. Call ITreeViewMgr->ChangeRoot() and ITreeViewMgr->RefreshSubTree.

This will make sure that tree will be initialized again and ITreeViewAdapter and ITreeViewWidgetMgrWidgetMgr functions gets called again to fill the tree view.

 

2. After above functions are called you can debug and validate whether - ITreeViewHierarchyAdapter->GetNumListItems is getting called or not.

 

Also, implement ITreeViewHierarchyAdapter->GetNthListItem.

 

If ITreeViewHierarchyAdapter->GetNumListItems is returning 0 then "ApplyDataToWidget" will never gets called because you return 0 number of items in "GetNumListItems'.

 

Hope this helps.

 

- Rahul Rastogi

Adobe InDesign SDK Plugin Developer.


@Rahul_Rastogi,  you have a typo in your signature - should be "plugin".