detect closing seach pane or search popup

PDF-XChange Editor SDK for Developers

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

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
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

detect closing seach pane or search popup

Post by EricAriens »

Hi,

Is it possible to detect if the search pane or the seach popup are closing?

Regards
Eric
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

Hello Eric,

As far as I know, that can't be done easily. I will investigate whether this can be done with the current code available and will write back asap.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: detect closing seach pane or search popup

Post by EricAriens »

Ok

TIA

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

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

Hello Eric,

You will need to implement a custom event handler for the search view panel object:
1) From the active IPXV_MainView, you'll need to get search view Pane:

Code: Select all

int nID = pdfCtl.Inst.Str2ID("searchView");
PDFXEdit.IPXV_View view = pdfCtl.Inst.MainFrm[0].View.Panes.Active[nID];
2) Then, for it's object, you'll need to register your custom event handler.
3) In the custom event handlers OnEvent method, you'll need to handle the e_Visible event code:

Code: Select all

if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Visible)
{
	if (Obj_.Visible == false)
	{
		//pEvent.Handled = true;
	}
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: detect closing seach pane or search popup

Post by EricAriens »

Hi Alex,

I just implmented the custom event handler. What a nice coincidencey :D

I understand point 1 and 3.

For point 2 you mean someting like

Code: Select all

int nID = pdfCtl.Inst.Str2ID("searchView");
PDFXEdit.IPXV_View view = pdfCtl.Inst.MainFrm[0].View.Panes.Active[nID];
myEventTarget = new CustomEventTarget(view, this);
Eric
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

Yes, that's exactly what I meant :wink:
Only:

Code: Select all

myEventTarget = new CustomEventTarget(view.Obj, this);
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: detect closing seach pane or search popup

Post by EricAriens »

Hi Alex,

Ok.

Do I do this
  • once and destroying the handler when closing the control.
    every time the search pane is activated and destroying the handler when the pane is closed.
Regards

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

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

As far as I see it, you'll need to do it once and destroy the handler when closing the control.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: detect closing seach pane or search popup

Post by docu-track99 »

Hello, I am trying to implement the following but I don't understand what #2 means. What is CustomEventTarget? Is this a class that I must create? Can you show me the code for this please? Also what is myEventTarget and how is it defined?

You will need to implement a custom event handler for the search view panel object:
1) From the active IPXV_MainView, you'll need to get search view Pane:
int nID = pdfCtl.Inst.Str2ID("searchView");
PDFXEdit.IPXV_View view = pdfCtl.Inst.MainFrm[0].View.Panes.Active[nID];

2) Then, for it's object, you'll need to register your custom event handler.
myEventTarget = new CustomEventTarget(view, this);

3) In the custom event handlers OnEvent method, you'll need to handle the e_Visible event code:
if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Visible)
{
if (Obj_.Visible == false)
{
//pEvent.Handled = true;
}
}
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

Hello docu-track99,

In some other post I gave the reference to this gist:
https://gist.github.com/Polaringu/f3de7 ... 65695e364c
The custom event target allows you to define the custom handler for an object, meaning that you will have the possibility to control and correspond to the object's events.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: detect closing seach pane or search popup

Post by EricAriens »

Hi docu-track99,

I added my FullDemo.
It has an extra tab Test with a button SearchPane and checkbox visible to show correct working.

Regards
Eric
Attachments
Full demo.rar
(378.5 KiB) Downloaded 120 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: detect closing seach pane or search popup

Post by Sasha - Tracker Dev Team »

Hello Eric and docu-track99,

Thanks for the sample, Eric.

Though the situation with the removing of the pane's elements is a bit different.
This code should not be called on the e_Visible directly, because the attempt to delete the elements will be before the actual element appearance on the pane, because the list loading is also happening on e_Visible AFTER that when the developer catches this event. This happens because if you make your custom event handler that it will catch all of the events first and the Control will catch them afterwards.
There are two possible solutions in this situation:
1) You catch e_Visible and look whether the pane is visible and if so, then:

Code: Select all

Sender.CallNextEventProcess(this, pEvent); // this - your listener (handler)
pEvent.bHandled = true;

RemoveBrowseForFolderItem(Sender);
2. You put the specific style for a Search page object so that it will call it's listeners (handlers):
searchPane.Obj.SetStyle(UIX_ObjStyle_NeedPostEvent, UIX_ObjStyle_NeedPostEvent);
after that in your listener will be called
IUIX_ObjImpl::OnPostEvent()

- in which you will be able to handle any UI-event after default processing, without using of CallNextEventProcess method.

All of these methods allow the Control to catch the event first and then the event will be caught by your custom event handler.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply