Copy link to clipboard
Copied
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.
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
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.
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:
The "ApplyDataToWidget" method of the TreeViewWidgetMgr associated with this tree is not getting called at all.
Kindly help.
The 2 treeviewwidget boss: -------------------------------------
-------------------------------------------------------
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
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
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.
Copy link to clipboard
Copied
@Rahul_Rastogi, you have a typo in your signature - should be "plugin".
Copy link to clipboard
Copied
@Robert at ID-Tasker - Thanks, corrected.