**SOLVED** Disappearing User Control in Custom Pane

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
sherron_docit
User
Posts: 12
Joined: Wed Apr 07, 2021 5:24 pm

**SOLVED** Disappearing User Control in Custom Pane

Post by sherron_docit »

Hi there.

I am trying to achieve a custom floating pane in the PDF Editor.

I have followed this git example:

URL: https://github.com/tracker-software/PDFEditorSDKExamples/blob/master/CSharp/CustomPane/Form1.cs

I had to use Method #2 which uses the ICabNode to add my pane.

So far everything is mostly working, but I do have an item I am stuck on.


Issue - UserControls disappears when closing and reopening pane.

I have a button in the menu that controls the drawing of the pane. When the document is first opened the pane will not be drawn. If the user then clicks the button it will draw the Custom Pane with my user control inside of it. This works fine.

The issue is, if they click the button again to close the Pane and then click it again to reopen it, it will draw the pane but the user control is missing.

The code I am using to remove the pane is:

Code: Select all

 pdfCtrl.Inst.ActiveMainView.ResetPanesLayout()
 
This will successfully remove the pane, but when I call my draw method again it only draws the blank pane without the user control inside of it.

My drawing code is:

Code: Select all

        Dim paneAdded As Boolean = False
        myPanesCreator.userCtrl = UcAdvancedBookmark2.TablePanel1
        Do

            Dim layout As ICabNode = pdfCtrl.Inst.Settings("MainView.Layout")

            If HasPane(layout("Root"), MY_PANE_ID) = True Or HasPane(layout("FloatingRoots"), MY_PANE_ID) = True Then
                Exit Do
            End If

            Dim root As ICabNode = layout("Root")

            Dim placeHolders As ICabNode = root("Kids")

            Dim placeholder As ICabNode = Nothing

            If placeHolders.Count = 0 Then
                placeholder = placeHolders.Add()

            Else
                placeholder = placeHolders(placeHolders.Count - 1)
            End If

            Dim kid As ICabNode = placeholder("Kids").Add

            kid("ID").v = MY_PANE_ID 'Pane ID
            kid("S").v = DirectCast(UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_FixedSize, Integer) 'Pane Size
            kid("FW").v = UcAdvancedBookmark2.Width 'Pane Width
            kid("FH").v = UcAdvancedBookmark2.Height 'Pane Height
            kid("Title").v = "Advanced Bookmarks" 'Pane Title

            paneAdded = True

        Loop Until False

        If paneAdded = True Then
            pdfCtrl.Inst.ActiveMainView.LoadPanesLayout()
        End If
I am lost as to why this works the first time, but when you do a LayoutReset and try it again the user control is missing from the Pane?

Any help would be appreciated.

Thanks,

Sam
Last edited by sherron_docit on Tue Apr 13, 2021 2:25 pm, edited 2 times in total.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Disappearing User Control in Custom Pane

Post by zarkogajic »

Hi Sam,

I've implemented a few custom panes, so I'll try to help...

I would suggest *not* using "ResetPanesLayout" for the purpose of hiding the pane.

To show or hide your pane use something like (note this is Delphi code):

Code: Select all

  function ShowHide(const theView: IPXV_View; const paneID : integer; const animated : boolean) : boolean;
  var
    view : IPXV_View;
  begin
    result := false;
    if theView = nil then Exit;

    view := theView.Panes.Active[paneID];
    if Assigned(view) then
    begin
      if theView.Panes.IsVisible[view] then
        theView.Panes.Hide(view, animated)
      else
        theView.Panes.Show(view, animated);

      result := theView.Panes.IsVisible[view];
    end;
  end;
In the above, "theView" is the IPXV_MainView (if your pane is inserted into the MainView object) or IPXV_DocumentView (if you create a pane for a document); "paneID" is your pane's ID.

HTH.

-žarko
sherron_docit
User
Posts: 12
Joined: Wed Apr 07, 2021 5:24 pm

Re: Disappearing User Control in Custom Pane

Post by sherron_docit »

Hi Zarko,

This method worked flawlessly once I translated the syntax to my language.
I appreciate your response as it was immensely helpful.

We can mark this thread as solved now. :D

Regards,

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

Re: **SOLVED** Disappearing User Control in Custom Pane

Post by zarkogajic »

:)

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

Re: **SOLVED** Disappearing User Control in Custom Pane

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Thanks for the assistance :)

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