Search Pane hide some option

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.
kinwind
User
Posts: 38
Joined: Tue May 31, 2016 7:03 am

Search Pane hide some option

Post by kinwind »

Hi.

I want to hide the option 'Browse for folder" .

how can I do .

Image

thanks
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Search Pane hide some option

Post by Vasyl-Tracker Dev Team »

Its possible. The working example(C#):

Code: Select all

PDFXEdit.IPXV_View searchView = pdfCtl.Inst.ActiveMainView.Panes.Active[pdfCtl.Inst.Str2ID("searchView")];
if (searchView != null)
{
    System.IntPtr p;
    searchView.Obj.QueryImpl(typeof(PDFXEdit.IUIX_Dialog).GUID, null, out p);

    PDFXEdit.IUIX_Dialog dlg = (PDFXEdit.IUIX_Dialog)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(p);
    if (dlg != null)
    {
        PDFXEdit.IUIX_Obj ctlObj = dlg.GetItem("cb.where");
        if (ctlObj != null)
        {
            ctlObj.QueryImpl(typeof(PDFXEdit.IUIX_Combo).GUID, null, out p);
            PDFXEdit.IUIX_Combo ctl = (PDFXEdit.IUIX_Combo)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(p);
            if (ctl != null)
            {
                ctl.RemoveItem(ctl.Count - 1); // remove 'Browse for Folder' item
                ctl.RemoveItem(ctl.Count - 1); // remove redundant separator
            }
        }
    }
}
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
kinwind
User
Posts: 38
Joined: Tue May 31, 2016 7:03 am

Re: Search Pane hide some option

Post by kinwind »

thanks.

I have another question

How to hide this icon

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

Re: Search Pane hide some option

Post by Sasha - Tracker Dev Team »

Hello kinwind,

When you open the document, you'll need to remove the flag from the DocViewsArea panes layout:

Code: Select all

PDFXEdit.IUIX_Layout layout = pdfCtl.Inst.MainFrm[0].View.DocViewsArea.Panes.Layout;
if (layout.Root.Count > 0)
	layout.Root[0].SetStyle(0, (int)PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_AddNewTabBtn);
For this you will need to listen to the e.document.initialized with your Control. You can find may samples on this forum how to listen to the events or try our FullDemo project and look at the pdfCtl_OnEvent method.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
kinwind
User
Posts: 38
Joined: Tue May 31, 2016 7:03 am

Re: Search Pane hide some option

Post by kinwind »

Hi, Alex
thank you.

But, I still found the "AddNewTabBtn" icon when I open the document at the first time.

layout.Root.Count is 0 when I open document at the first time.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Search Pane hide some option

Post by Sasha - Tracker Dev Team »

Hello kinwind,

I've just tested that - indeed the tabs area is not loaded yet at that point of the program workflow. The e.document.viewingStarted event does the trick though.

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: Search Pane hide some option

Post by docu-track99 »

Regarding the option to hide "Browse for Folder" where is the best place in code to perform this function? I have a method that works and is called from frmMain.Load() but it only works if the editor is started with the search already open.

Is there a better place to make the call to disable this feature or an alternate method?

Thanks.
docu-track99
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Search Pane hide some option

Post by Vasyl-Tracker Dev Team »

... but it only works if the editor is started with the search already open.
Its strange because I tried to call such code just after:

PDFXEdit.PXV_Inst Inst = new PDFXEdit.PXV_Inst()
Inst.Init(...);
..
MyForm::InitializeComponent(); // here AxPDFXEdit.AxPXV_Control pdfCtl member is created and initialized

// here is code to removing 'Browse for Folder'

- and all works properly, even if Search pane is hidden (by default). Please provide simple example project to reproduce the problem...
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: Search Pane hide some option

Post by docu-track99 »

Hello,

If you create a .NET Windows Application, add the control to the form, the control name is called pdfCtrl. We are using v.317, this is the best I can provide at this time.


Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.HideSearchBrowseByFolder()
End Sub

Private Sub HideSearchBrowseByFolder()

Try
'Code retrieved from search terms 'Search Pane hide some option'
'https://forum.pdf-xchange.com/ ... ch#p102173

Dim searchView As PDFXEdit.IPXV_View = pdfCtrl.Inst.ActiveMainView.Panes.Active(pdfCtrl.Inst.Str2ID("searchView"))

If searchView IsNot Nothing Then

Dim p As System.IntPtr
searchView.Obj.QueryImpl(GetType(PDFXEdit.IUIX_Dialog).GUID, Nothing, p)

Dim dlg As PDFXEdit.IUIX_Dialog = DirectCast(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(p), PDFXEdit.IUIX_Dialog)

If dlg IsNot Nothing Then
Dim ctlObj As PDFXEdit.IUIX_Obj = dlg.GetItem("cb.where")

If ctlObj IsNot Nothing Then
ctlObj.QueryImpl(GetType(PDFXEdit.IUIX_Combo).GUID, Nothing, p)

Dim ctl As PDFXEdit.IUIX_Combo = DirectCast(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(p), PDFXEdit.IUIX_Combo)

If ctl IsNot Nothing Then
ctl.RemoveItem(ctl.Count - 1)
' remove 'Browse for Folder' item
' remove redundant separator
ctl.RemoveItem(ctl.Count - 1)
End If
End If
End If
End If

Catch ex As Exception
mWriteLog(1, "HideSearchBrowseByFolder(): An error has occured.")
mGenericError(ex)
End Try
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Search Pane hide some option

Post by Vasyl-Tracker Dev Team »

If you running your code step-by-step the code:

Code: Select all

ctl.RemoveItem(ctl.Count - 1)
' remove 'Browse for Folder' item
' remove redundant separator
ctl.RemoveItem(ctl.Count - 1)
- is executed as well or not(skipped by conditions above)?
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: Search Pane hide some option

Post by docu-track99 »

Hello,

When I call this method from frmMain.Load() and the Search Pane is closed the method executes to remove the items but the items are not removed. The combobox control does have a count of 4 items but removing the last two items does not work.

When the Search pane is open and the same method is executed from frmMain.Load() then the items are removed.

How can I detect that the search Pane has opened so I can then remove the "Browse for Folder"? This is a bug in 317, is there a newer version?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Search Pane hide some option

Post by Sasha - Tracker Dev Team »

Hello docu-track99,

An answer to your question lies here:
https://forum.pdf-xchange.com/ ... 14#p103214

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Search Pane hide some option

Post by Vasyl-Tracker Dev Team »

Can you provide simple example project to reproduce the issue? Because I tried it in our FullDemo project and all works well even I called this special code in MainFrame() constructor, just after 'InitializeComponent();' line (in that case the pdf-control is embedded and Search pane is hidden, by default)...
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.