searchView "results" tree - handle OnItemClick to custom open document / navigate to a page  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

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.
Post Reply
zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 05, 2019 3:49 pm

Hi support,

I need to be in control what happens when a tree item is clicked in the searchView results tree.

What happens now: document gets open (+ navigated to the page where the searched for term is found).

This does not use "cmd.open" - so custom handling it does not help.

Why: when working with multiple instances of the pxv_control, if a resulting document DocA is already opened in FrameA and I'm searching in FrameB and DocA is in results - I want the copy to be opened in FrameB and not FrameA activated....

p.s.
Yes, I can implement IUIX_TreeCallbacks for the "results" tree - but no help here as opening (+navigating to a page) of document happens behind the scenes (I cannot get to the Tree's internal data).


-žarko

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 05, 2019 6:30 pm

Btw,

If "e.searchView.resultSelected" is to be used - please provide some info around it: how to get the selected item with its data required to navigate to (document + location).

It looks like this could used to get the IPXV_SearchEntry (and similar) - just am not sure how.



-žarko

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Wed Nov 06, 2019 10:02 am

Hello žarko,

Just checked the inner code - the document is being opened on item click if the item is pointing to the other document. You can prohibit it's opening by catching the e.operBeforeExecute event and checking whether it's an op.openDoc operation and act accordingly.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Wed Nov 06, 2019 11:16 am

Hi Alex,

Thanks, that's something.

Need more help though :)

What is pEvent in this case?

Once I have it (IOperation) I can get to the actual file using InstAFS.DefaultFileSys.NameToString(IAFS_Name) if op.Params.Root['Input'] is IAFS_Name.

However, when search results tree is clicked, it will open a file but also go to specific location - how can I get that also?

Also, how do I know in what MainFrame this is happening (search results pane)?

-žarko

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Wed Nov 06, 2019 1:27 pm

Hi Alex,

To add complexity to this question (any hopefully explain myself better):

1. Document_A is opened in Frame_A
2. SearchView is used in Frame_B (searching in folders) - Frame_B is active
3. Search results include Document_A
4. Clicking on a search result entry connected to Document_A will activate Frame_A

I simply must stop this from happening and open the document (and navigate to result item) in the calling MainFrame (where the searchView is used / initiated) - Frame_B.

So, I'm looking for how to be notified, but also be able to react, when clicking on a search result item.

-žarko

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 12, 2019 12:09 pm

Hi support,

I've jumped over many hurdles while adjusting to how the SDK works when I have many PXV_Controls that I want to run separately from others (so, multiple control instances, calling each one "Control" here).

So far so good, I'm in control over document opening, I can handle events specific to the Control in which the even occurs, ...

I'm now in front of the wall and the wall is "searchView" - and after a few days of trying crazy different approaches it seems I cannot jump over that one.

Searching in the active document is ok - no issues here.

The first issue is searching "In all open documents" - if I have 2 Controls and each has one document (Control_A has Doc_A and Control_B has Doc_B), the search pane will display "In all open documents (2)" - and the results will include both documents. If I'm searching in Control_A - I'm in trouble as clicking on a search result for Doc_B will activate Control_B - and for me this is a biiig issue - no auto activating of different Controls must happen for me.

I think I could overcome this (have not actually started coding) by handling the "e.operBeforeExecute" for "op.search" and checking what's inside Input array (ipxv_documents) and clear / setup array to only list documents in the Control where the operation is executed.
But, I do not know how to get from the IOperation to where it is being executed / in what Control (to know what documents to feed it with)? Let's say that would be Active control (ActiveMainFrm) .. so maybe this will work. ? Also, "who" initiated the "op.search", the "Search" button in searchView or was it executed by some other means...

The "search in folder" is even more complex - no going into details until some feedback.

So, please ... some feedback here...


-žarko

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Tue Nov 12, 2019 1:34 pm

Hello žarko,

OK, first, you can get the MainView from the SearchView that is being clicked on - by getting the tree's UIObj on click and then getting the MainView from that object. Sadly, no way of getting the information directly from the operBeforeExecute event - as the pFrom is IOperation. But, you can store some kind of marker what search view was clicked and then act accordingly. Also, I think that the ActiveMainView would also be correct as someone clicked on the view thus the operation was launched so the active view should be the one that you need.

How the entire opening process looks like:
1) The user clicks on the item in the search list.
2) If the item is document then the we'll try to obtain the document - either from the IPXV_Inst (that checks whether it's already opened) or from the IAFS_Name (if it was not opened). Here, when the document was not yet being opened, the ActiveFrame is being used. Thus intercepting the click on the search item and making the needed frame active (if it is not) and then continuing with the original on click can cause opening of the document in the active/activated frame.
3) If we open document from IAFS_Name, then first we are opening the IPXC_Document. This will launch the op.openDoc operation (that you can intercept) after which we obtain the resulting IPXC_Document.
4) Then the document is being opened in the ActiveView using the enabled mode (single doc, new frame etc) and we get the IPXV_Document.
5) And then the SearchView uses it's inner data to go to the needed position in that IPXV_Document.

Sadly, you cannot extract any information about the precise coordinates where the document should be opened. You can only tweak the document itself and the active view - that's all.

Basically what can be done is manually searching for the IPXV_Document by the resulting IPXC_Document and if it does exist - open it's duplicate in the frame you need (that all should be done in the e.operExecuted event after the operation was executed and the document was opened). If the document does not exists - then there won't be any problem as the active frame was clicked so the document will be opened in it.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 12, 2019 2:28 pm

Hi Alex,

Thanks for the input, mostly all I expected. I have no problems with opening documents from search results that are not already opened in any of the MainFrames.

My problem is with this part:
... either from the IPXV_Inst (that checks whether it's already opened...
When a document is already opened in a different MainFrame - you will activate that frame (and activate the document and go to the page with search result).

This is what I need to be able to stop if the found document is not in the MainFrame where the search operation was executed (and then I would open it in the needed Frame).

Your internal code is probably using something like FindDocBySrcFileName and you have your internal list of opened documents and then you compare by file name. You find the first match and activate (never mind in what Frame it is).

So an event like "e.FoundSearchResultsDocumentInSomeFrame" that I could use to say: "no, not that document".

Or in general, an event like "e.FoundDocumentInSomeFrame" raised by your code when you are searching for documents for whatever the reason (hint: link navigation) - would come more than handy in multiple controls scenarios.

p.s.
If I open a document by IStream it will have an empty string for CoreDoc.SrcInfo.ActualFileName. If such a document is opened in the active MainFrame and the search results have it, clicking on it in the search results - you will double open it - as you are "not" finding it.



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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Tue Nov 12, 2019 3:30 pm

Hello žarko,

As I told before, you can get the resulting IPXC_Document in operExecuted event and see whether it is opened via the https://sdkhelp.tracker-software.com/vi ... cByCoreDoc method (or one that uses file path). Then you can duplicate it in the needed frame and then let the operation continue - then the API will try to find already opened document and will find it and hopefully will find it and will switch to the needed frame.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 12, 2019 4:01 pm

Hi Alex,

I need to correct myself:
When a document is already opened in a different MainFrame - you will activate that frame (and activate the document and go to the page with search result).
That's actually not true. You will highlight search results in that different frame (if a document is already opened there) and "e.activeDocChanged" will *not* happen. if the search result points to a different page, this page will be set. However all this happens behind the scenes.


zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 12, 2019 4:35 pm

Sasha - Tracker Dev Team wrote:
Tue Nov 12, 2019 3:30 pm
As I told before, you can get the resulting IPXC_Document in operExecuted event and see whether it is opened via the https://sdkhelp.tracker-software.com/vi ... cByCoreDoc method (or one that uses file path). Then you can duplicate it in the needed frame and then let the operation continue - then the API will try to find already opened document and will find it and hopefully will find it and will switch to the needed frame.
Sorry Alex, I lost you now. I guess you are referring to e.operExecuted for op.openDoc ? The thing is that this will not happen if the document is already opened in another frame (and your API locates it there).


zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 12, 2019 9:13 pm

Hi Alex,

Let me try to "reset" this topic, since after quite some testing I think I know what would be the only possible solution (for my scenario).

Just to repeat: I'm working with multiple control instances and I want each control to be "on its own".

When using the SearchView and executing a search, the search operation is run / initiated in the active Main Frame.

Let's presume I have more than one MainFrame with some files opened in each.

Now, "Where would you like to search?" combo options:

In case of "In the Active Document" - no issue at all :)

In case of "In All Open Documents (X)" - this one is problematic. If I have 2 controls (/main frames) and a document in each, this option would search (and highlight results,...) in both (X=2) and this is what I would like to avoid.

If you could add one more entry to the combo: "In all documents in *this* window/frame" - problem solved, as I can remove the "in all open documents (x)" option from the drop down.
Or, not adding one more option to the combo, but adding a global setting that would work in that way ("ignore documents in other frames") - problem solved.

For the moment, if this option is selected I can handle e.operBeforeExecute and clear the Input array and fill it with only documents in the *active* MainFrame (where the search is being executed). I also need to edit the text (because of "(x)") in the cb.where combo in the searchView dialog - but I can live with that (needs to be done every time a document is opened or closed - the count of documents changes).

In case of "search in folder" - that's the most problematic one. The only solution here would be to have an option to ignore documents in other MainFrames. By ignoring I mean: when the search is executed and your internal code does the results highlighting (in opened documents) or opens a document (and then does highlighting) - to ignore those documents that are not in the "calling" frame. When a document, not opened in the active frame is selected, allow to open it in the active frame (never mind if already open in another).

So, yes, I'm requesting some new features/options :)

For the moment I cannot use the "search in folder" at all (in my scenario, of course) - and that's a shame as this is a fantastic feature of the SDK (made me say "yes!" when I saw how it works).

So, pretty please :)

-žarko

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Wed Nov 13, 2019 7:48 am

Hello žarko,

Have you tried using the Callback option of the https://sdkhelp.tracker-software.com/view/PXV:op_search operation? There, you can take the old callbacks and only execute them when the IPXV_SearchEntry matches your needs - else, you don't execute them that will result in no highlighting or adding to the list.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Wed Nov 13, 2019 1:34 pm

Thanks Alex, this sounds interesting...

The problem is that the search is running in different thread(s) and any access to any View/Frame from OnNewEntry results in Access Violation. :(

I can get to the ActiveMainFrame, I can also vDoc := FindDocBySrcFileName for the coredoc from IPXV_SearchPtr. So some of Inst methods run nevermind the thread.

But when I use GetMainViewFromUIObj(vDoc.ActiveView.Obj), to compare the Document's View with ActiveMainFrame.View, the AV happens.

Any ideas?

ps.
How can this be:

Inst.ActiveMainFrm.View.ActiveDocView.Doc - returns a document, but
Inst.ActiveMainFrm.View.DocViewsArea.DocViews.Count == 0 ? (as I wanted to go over all document views/documents)




zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Thu Nov 14, 2019 9:50 am

Hi support,

Oh my, oh my ... there's much more happening behind the scenes than I can keep track of.

I need again to reset this topic, and go from the beginning :( Hopefully something can be done, or I can forget about the searchView functionality completely.

Here's the first thing I'd like to stop from happening:
image.png
Here's the scenario:

1. We have two Controls (2 MainFrames) Frame_1, Frame_2
2. A document is opened in Frame_1 (in the picture on the right)
3. Search (in active document) is initiated
3.1 SearcView tree gets populated with results
3.2 Document chunks get highlighted (+ vertical scroll bar nicely gives visual clues to where the search results in the document are)

So far so good. Now comes the "funny" (I mean "oh, no") part:

4. The same document is opened in Frame_1, just opened, nothing more. (in the picture on the left)
5. Upon opening, document chunks get highlighted (+ scroll clues).

I need this not to happen.

How to stop this from happening?


-žarko

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Mon Nov 18, 2019 11:48 am

Hi support,

I'm stuck with this .. so please an answer if possible :)

How to stop the auto-highlight of newly opened document chunks when a document is the same document opened in another frame and was a part of the last search result set ... as explained graphically in my previous post...


Btw, It seems I can "solve" this if I close OR hide the search pane in the Frame where the search was initiated - as this will "reset" the search (clear out results and highlights). So basically, when I switch to another Frame I would hide/close the searchView for all other frames (at that moment not active frames).

Still, can the auto-highlight-stop be done from code even if the searchView (having results as explained) is visible in another frame?

p.s.
To overcome the threading problem I'm now using IPXV_ThreadSafeCallback with ThreadSafeCall to check if the document in result is in my ActiveFrame ... but more on that later...

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Tue Nov 19, 2019 9:00 am

Hello žarko,

Are these different IPXV_Documents on your screenshot - or is it a same one (codewise)?

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 19, 2019 9:12 am

Hi Alex,

Same file (in terms of file name) opened in two Frames - 2 different ipxv documents.

ž

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Tue Nov 19, 2019 4:14 pm

Hello žarko,

If you control how the highlighters are added then you can just simply skip the adding process. This can be done by using the callbacks for the search operation. Here's the sample that I had:

Code: Select all

public class SearchCallback : PDFXEdit.IPXV_SearchCallback
{
	PDFXEdit.IPXV_Inst m_Inst = null;
	//This array will tell us whether we already have visited this document so only the first search result will be shown
	List<uint> m_aDocuments = new List<uint>();
	public SearchCallback(PDFXEdit.IPXV_Inst Inst)
	{
		m_Inst = Inst;
	}
	public void OnFinish(int nResCode)
	{

	}

	//public void OnNewEntry(PDFXEdit.IPXV_SearchEntry pEntry)
	//{
	//	//Highlighting first item in the first document
	//	uint i = 0;
	//	PDFXEdit.IPXC_Document doc = null;
	//	PDFXEdit.IPXV_Document vDoc = null;
	//	PDFXEdit.IPXC_Page page = null;
	//	while (i < pEntry.Count)
	//	{
	//		PDFXEdit.IPXV_SearchEntryItem item = pEntry[i];
	//		PDFXEdit.IPXV_SearchPtr ptr = item.Ptr;
	//		uint nDocID = 0;
	//		for (uint j = 0; j < ptr.Count; j++)
	//		{
	//			PDFXEdit.PXV_SearchPtrChunk chunk = ptr[j];
	//			//First we get the document
	//			if (chunk.nType == (uint)PDFXEdit.PXV_SearchPtrChunkType.PXV_SearchPtrChunk_Document)
	//			{
	//				nDocID = chunk.nValue;
	//				doc = ptr.Doc[chunk.nValue];
	//				vDoc = m_Inst.FindDocByCoreDoc(doc);
	//			}
	//			else if (chunk.nType == (uint)PDFXEdit.PXV_SearchPtrChunkType.PXV_SearchPtrChunk_Page)
	//			{
	//				if (m_aDocuments.Contains(nDocID))
	//					break;
	//				if (doc != null)
	//					page = doc.Pages[chunk.nValue];
	//				if (page != null)
	//				{
	//					m_aDocuments.Add(nDocID);
	//					if (vDoc != null)
	//					{
	//						//Setting the current page of the document to the one with the results
	//						vDoc.ActiveView.PagesView.Layout.CurrentPage = page.Number;
	//					}

	//				}

	//			}
	//		}
	//		i++;
	//	}
	//}
	public void OnNewEntry(PDFXEdit.IPXV_SearchEntry pEntry)
	{
		//Highlighting items in the document
		uint i = 0;
		PDFXEdit.IPXC_Document doc = null;
		PDFXEdit.IPXV_Document vDoc = null;
		PDFXEdit.IPXC_Page page = null;
		PDFXEdit.IPXV_DocHighlighter highlighter = null;
		while (i < pEntry.Count)
		{
			PDFXEdit.IPXV_SearchEntryItem item = pEntry[i];
			PDFXEdit.IPXV_SearchPtr ptr = item.Ptr;
			for (uint j = 0; j < ptr.Count; j++)
			{
				PDFXEdit.PXV_SearchPtrChunk chunk = ptr[j];
				//First we get the document
				if (chunk.nType == (uint)PDFXEdit.PXV_SearchPtrChunkType.PXV_SearchPtrChunk_Document)
				{
					doc = ptr.Doc[chunk.nValue];
					vDoc = m_Inst.FindDocByCoreDoc(doc);
					//Now we'll need to check whether the document is opened so that we can highlight it
					if (vDoc != null)
					{
						highlighter = vDoc.AddNewHighlighter(PDFXEdit.PXV_DocHighlightType.PXV_DocHighlight_Page);
					}
				}
				else if (chunk.nType == (uint)PDFXEdit.PXV_SearchPtrChunkType.PXV_SearchPtrChunk_Page)
				{
					if (doc != null)
						page = doc.Pages[chunk.nValue];
					if (page != null)
					{
						//Now we have the page where the text is found
						for (uint k = 0; k < item.TextRangesCount; k++)
						{
							//Now we need to get the coordinates of the highlight boxes
							PDFXEdit.IPXC_QuadsF quads = item.GetTextRangeQuads(k);
							//Highlighting the search results
							if (highlighter != null)
							{
								PDFXEdit.PXV_DocHighlightAdvanced ha = new PDFXEdit.PXV_DocHighlightAdvanced();
								highlighter.Add(page, quads, null, null, ref ha, 0);
								//Setting the current page of the document to the one with the results
								vDoc.ActiveView.PagesView.Layout.CurrentPage = page.Number;
							}
						}
					}

				}
			}
			i++;
		}
	}

	public void OnStart()
	{

	}

	public void OnStartPtr(PDFXEdit.IPXV_SearchPtr pPtr)
	{

	}

	public void OnStopPtr(PDFXEdit.IPXV_SearchPtr pPtr, bool bIncomplete)
	{

	}
}

private void SearchOperation(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.search", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	input.Add().v = Doc.CoreDoc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["AND"].Add().v = "stream";
	options["AND"].Add().v = "is";
	options["AND"].Add().v = "defined";
	SearchCallback clbk = new SearchCallback(pdfCtl.Inst);
	options["Callback"].v = clbk;
	options["Flags"].v = (int)PDFXEdit.PXV_SearchFlags.PXV_SearchFlag_GetTextQuads | (int)PDFXEdit.PXV_SearchFlags.PXV_SearchFlag_IncludePageText;
	Op.Do();
}
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Tue Nov 19, 2019 4:37 pm

Hi Alex,

Thanks, I knew this.

I am not controlling it - I'm leaving it to the default implementation.

The thing is that when a document is opened your internal code somehow figures out there was a search operation and directly highlights results in this new (but same file name) document - even if the search happened in a different frame.

This auto highlight is something I must be able to stop somehow.

I was hoping I could use something like RemoveHighlighter, if your internal code uses AddNewHighlighter, but I do not have access to something we could call "current" highlighter for a document.


-žarko

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page  SOLVED

Post by Sasha - Tracker Dev Team » Wed Nov 20, 2019 8:36 am

Hello žarko,

That's the thing - right now there is no possibility to remove the highlighter if you don't have a pointer to it. I will ask whether it would be possible to add such properties/methods to the IPXV_Document interface.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Wed Nov 20, 2019 9:08 am

Hi Alex,

Thanks.

One great addition to the SDK would be to be able to react when your internal code is looking for an existing document (by file name, for whatever the reason) in any of Frames - so a developer could say "no, not there".

Example: document A has a link to document B. A opened in Frame_A, B opened in Frame_B. When the A to B link is clicked (in Frame_A) - your internal code would locate B in Frame_B and activate it (and navigate to the corresponding location in it).
Being able to "cancel" the result of your internal search would help a lot - so I could cancel your result and specify: "no, B is not in to be located in Frame B, because the source of the action is in Frame_A" and you will not activate it, rather the process will continue and a duplicate of B will be open in Frame A (or action canceled or whatever).

The same applies for search results navigation. When searching in a folder, if the resulting document is opened in Frame_A and the search operation (by the means of searchView, so UI) is initiated in Frame_B - clicking on the search results will activate Frame_A. Again I would like to be able to "cancel" your internal "LookForDocumentByFileName" and say that no it is not open in the Frame where the search results are being navigated to.

I hope you get my point...

I will "solve" this topic - as my general conclusion (how I understand what you said) is that this auto-results-highlight-when-the-same-document-opens-in-another-frame cannot be canceled. Or?



-žarko

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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Wed Nov 20, 2019 1:14 pm

Hello žarko,

That is correct - that kind of advanced logic is not available via the SDK.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 670
Joined: Thu Sep 05, 2019 12:35 pm

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by zarkogajic » Wed Nov 20, 2019 1:52 pm

Hi Alex,

OK, thanks.


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

Re: searchView "results" tree - handle OnItemClick to custom open document / navigate to a page

Post by Sasha - Tracker Dev Team » Wed Nov 20, 2019 1:57 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply