• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

Problem with 2 tree views

Explorer ,
Sep 16, 2023 Sep 16, 2023

Copy link to clipboard

Copied

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

TOPICS
SDK

Views

612

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 16, 2023 Sep 16, 2023

Copy link to clipboard

Copied

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, 
}
},

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 17, 2023 Sep 17, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 17, 2023 Sep 17, 2023

Copy link to clipboard

Copied

Did you debugged to find the crash point ?

 

Did you debug your TreeViewHierarchyAdapter and TreeViewWidgetMgr ?

 

When you instantiate the dialog, then TreeViewHierarchyAdapter and TreeViewWidgetMgr gets called for both tree views.

 

or there could be problem related to duplicate IDs defined in WatermarkUIID.h. Did you tried running your plugin with InDesign debug build  ? you could get some asserts.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 20, 2023 Sep 20, 2023

Copy link to clipboard

Copied

Hi Rahul,

 

The program is not crashing now. I have created 2 TreeViewWidgets. I have created 2 TreeViewHierarchyAdapter, 2 TreeViewWidgetMgr and 2 TreeNodeWidgets for each TreeViewWidgets. 

One of  the TreeView is populated on initialization from a file, this is happening.

In the other tree, a node is added on click of button, but this is not happening. PS the image below: 

 

user6965273_0-1695205493334.png

The "ApplyDataToWidget" method of the TreeViewWidgetMgr associated with this tree is not getting called at all.

 

Kindly help.

 

The 2 treeviewwidget boss: -------------------------------------

Class
{
kWMSlDlgTreeViewWidgetBoss,
kTreeViewWidgetBoss,
{
IID_ITREEVIEWWIDGETMGR,            kWMSlDlgTreeViewWidgetMgrImpl,
IID_ITREEVIEWHIERARCHYADAPTER,    kWMSlDlgTreeViewAdapterImpl,
/** Hold names of the list item */
IID_ISTRINGLISTDATA,        kStringListDataImpl, 
}
},
 
Class
{
kWMSlDlgTreeViewWidgetBoss2,
kTreeViewWidgetBoss,
{
IID_ITREEVIEWWIDGETMGR,            kWMSlDlgTreeViewWidgetMgrImpl2,
IID_ITREEVIEWHIERARCHYADAPTER,    kWMSlDlgTreeViewAdapterImpl2,
/** Hold names of the list item */
IID_ISTRINGLISTDATA,        kStringListDataImpl, 
}
},

-------------------------------------------------------

The 2 treeviewwidget definitions: -----------------------------------

type WMSlDlgTreeViewWidget2 (kViewRsrcType) : TreeViewWidget (ClassID = kWMSlDlgTreeViewWidgetBoss2)
{
WidgetEveInfo;
};

type WMSlDlgTreeViewWidget (kViewRsrcType) : TreeViewWidget (ClassID = kWMSlDlgTreeViewWidgetBoss)
{
WidgetEveInfo;
};

-----------------------------------------------------------------------------

The 2 tree adapter impl id and class mappings ------------------------------

CREATE_PMINTERFACE(WMSlDlgTreeViewAdapter, kWMSlDlgTreeViewAdapterImpl)

CREATE_PMINTERFACE(WMSlDlgTreeViewAdapter2, kWMSlDlgTreeViewAdapterImpl2)

--------------------------------------------------------------------------------------------------

The 2 tree view widget managers ------------------------------------------------------------

CREATE_PMINTERFACE(WMSlDlgTreeViewWidgetMgr, kWMSlDlgTreeViewWidgetMgrImpl)

CREATE_PMINTERFACE(WMSlDlgTreeViewWidgetMgr2, kWMSlDlgTreeViewWidgetMgrImpl2)

------------------------------------------------------------------------------------------------------------------------

 

UIFactoryList.h -----------------------------------------------------

REGISTER_PMINTERFACE(WMSlDlgTreeViewWidgetMgr, kWMSlDlgTreeViewWidgetMgrImpl)
REGISTER_PMINTERFACE(WMSlDlgTreeViewAdapter, kWMSlDlgTreeViewAdapterImpl)
REGISTER_PMINTERFACE(WMSlDlgTreeViewWidgetMgr2, kWMSlDlgTreeViewWidgetMgrImpl2)
REGISTER_PMINTERFACE(WMSlDlgTreeViewAdapter2, kWMSlDlgTreeViewAdapterImpl2)

---------------------------------------------------------------------------------------------------------------------------

 

You can download the current code from here 

 

Thanx & Regards,

 

Ziauddin Syed

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

Rahul ji,

 

🙏🏻🙏🏻 please reply to my message below. I have already crossed delivery deadline and client is threatning to cancel the contract.

 

Thanx & Regards,

 

Ziauddin Syed

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 21, 2023 Sep 21, 2023

Copy link to clipboard

Copied

LATEST

@Robert at ID-Tasker - Thanks, corrected.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines