Custom Pane creation  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: 650
Joined: Thu Sep 05, 2019 12:35 pm

Custom Pane creation

Post by zarkogajic » Fri Oct 25, 2019 9:08 am

Hi support,

Looking for some code on how to create / add a custom pane ?

p.s.
I need something similar to the Links pane - therefore some pane based on IUIX_List with my data....

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Fri Oct 25, 2019 9:20 am

Hello žarko,

This requires some time - we'll be holding a release soon, so I will prepare a sample in a week or so, when I have time.

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

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

Re: Custom Pane creation

Post by zarkogajic » Fri Oct 25, 2019 9:39 am

Ok, eagerly waiting for it ;)


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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Tue Nov 19, 2019 3:25 pm

Hello žarko,

Just to bump this one - I have not forgotten about it :)

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

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

Re: Custom Pane creation

Post by zarkogajic » Wed Nov 20, 2019 4:02 pm

Alex,

Is this usable (or needs to be updated to work?) : https://github.com/tracker-software/PDF ... CustomPane

I have not tried implementing, so just asking should I try with the above or wait for an update to it?

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Thu Nov 21, 2019 8:26 am

Hello žarko,

We'll I totally forgot about that sample due to the callbacks inoperabillity. It should be OK, though I will look at it later to see whether it should be updated.

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

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

Re: Custom Pane creation

Post by zarkogajic » Wed Jan 15, 2020 10:16 am

Hi Alex,

I've tried the CustomPane sample project.

It does show the custom pane, but none of other panes get created :)

The CreateNewView method of CustomViewCreator:IPXV_ViewCreator gets called for all (default existing) panes, and not only for the custom pane. There's no code in it to handle "searchView", "propertiesView" and the rest - so they do not get properly created.

I guess, some kind of default IPXV_ViewCreator implementation would need to called for other panes, I was not able to figure out how and what (when nViewID != m_sCustomPaneID).

Could you take a look? I'd really love to be able to add my custom pane to the UI :)

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Wed Jan 15, 2020 11:00 am

Hello žarko,

You should return the E_INVALIDARG error when it's not your view - then other creators will be called.

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

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

Re: Custom Pane creation

Post by zarkogajic » Wed Jan 15, 2020 12:22 pm

Hi Alex,

CreateNewView (of IPXV_ViewCreator) does not return a value but has an out pNewView parameter - so am not sure what you mean here ..

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Wed Jan 15, 2020 1:48 pm

Hello žarko,

In c++ we return the HRESULT value - that's where the mentioned result should be returned. It will be managed by our empty code and the creator array will continue to be parsed further.

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

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

Re: Custom Pane creation

Post by zarkogajic » Wed Jan 15, 2020 3:15 pm

Hi Alex,

Can you please double check that in your code - as CreateNewView is a void type (cannot return value).

Edit: ah sorry.. you mean "throw new System.ArgumentException();".

Ok, this seems to work.

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Thu Jan 16, 2020 8:26 am

Hello žarko,

The thing is that the C++ interface methods always return HRESULT, but languages like C#, VB.Net etc. wrap those methods so they do not return the HRESULT but can return the last out parameter for example. So you will have to pass an exception like that in non-C++ environment.

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

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

Re: Custom Pane creation

Post by zarkogajic » Thu Jan 16, 2020 4:22 pm

Hi Alex,

This all seems to work fine :)

I have one issue... when I move the pane to the left edge, to display as:

image.png

Now, resizing the pane's width would result in strange rendering:

image.png
image.png (60.07 KiB) Viewed 3334 times

Result:

image.png


If I then resize (or hide/show) the entire window - all gets redrawn and looks good.

What event (UIX_EventCodes?) to catch, when using the slider to change the pane's width, to redraw the custom control?


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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Fri Jan 17, 2020 12:37 pm

Hello žarko,

You have specified that you are moving the pane to the left edge - is the result different when you are trying to move it to any other edge?

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

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

Re: Custom Pane creation

Post by zarkogajic » Fri Jan 17, 2020 2:46 pm

Hi Alex,

Thanks.

So many "edges" .. and it seems all is okish if far-right or bottom. When left / top or floating - resizing the pane results in garbage display.


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

Re: Custom Pane creation

Post by zarkogajic » Mon Jan 20, 2020 3:41 pm

Hi Alex,

I've been try/fail testing this a bit .. it seems when UIX_ObjStyleEx_CustomPaintWnd is included in nObjStyle for UIX_CreateObjParams "cp" for CreateScrollableObj - the painting is ok (in the sample code it is "0").

While there, can you please explain what exactly are those two instances of UIX_CreateObjParams used for (hierarchy of UI objects?)?

-žarko

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

Re: Custom Pane creation

Post by Vasyl-Tracker Dev Team » Tue Jan 21, 2020 9:28 pm

Hi žarko,

UIX_ObjStyleEx_CustomPaintWnd - this flags means for our UI-subsystem that newly created UI-object need to process the system's WM_PAINT message by itself, otherwise this message will be processed by UI-subsystem and you will receive just e_Render event instead (with IUIX_RenderContext object).
For your own dialogs that aren't based on the our UI-framework - you *need* to use the UIX_ObjStyleEx_CustomPaintWnd at least. Moreover, if you want to handle all system's messages(paint, mouse keyboard, etc) in your dialog directly, without involving our UI-subsystem into this process - you may try to use the UIX_ObjStyleEx_SimpleWndWrapper flag. With this flag our UI will just subclass your window(to just "wrap" your HWND by corresponding new IUIX_Obj) and then just relay all obtained messages directly to the original wndproc (that is your obviously).
While there, can you please explain what exactly are those two instances of UIX_CreateObjParams used for (hierarchy of UI objects?)?
At the moment I'm not sure why the CustomPane sample uses the additional UI-container but I'll clarify it. In you case you may create just one UI-object that is simple "wrapper" of your HWND:

Code: Select all

UIX_CreateObjParams cp = new PDFXEdit.UIX_CreateObjParams();

cp.nStdClass = (int)PDFXEdit.UIX_StdClasses.UIX_StdClass_Blank;
cp.hWndParent = Convert.ToUInt32(pParentObj.WndHandle);
cp.hWnd = Convert.ToUInt32(CV.userControl.Handle.ToInt64());
cp.rc = stPos;

cp.nObjStyle = uiInst.MakeObjStyle(0, (int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_SimpleWndWrapper);

uiInst.CreateObj(ref cp);

pNewView = CV;

Cheers.
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.

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

Re: Custom Pane creation

Post by zarkogajic » Wed Jan 22, 2020 9:57 am

Hi Vasly,

Thanks for the extra info on rendering.

"In my case" (custom pane) - I cannot create just one Object - as it will not work - this is why I asked to understand why two objects are required and what's their hierarchy (/purpose).



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

Re: Custom Pane creation

Post by zarkogajic » Thu Jan 23, 2020 10:33 am

Hi support,

The CustomPane code works like a charm .. but I have one issue.

When using Inst.Init with user settings (and then saving the settings before Shutdown) - the custom pane will get stored in "Inst.Settings["MainView.Layout"]["Root"]" - hence "HasPane(layout["Root"]);" returns true.

As a result, the part of code where ICabNode is created is not executed.

This all works fine as long as the pane is left attached (docked) to some edge.

If the pane is left in floating state, the "HasPane(layout["FloatingRoots"])" returns false, the ICabNode is added, and later the CreateNewView of CustomViewCreator throws an exception when CreateObj(cp2). The exception is "The window is subclassed already." - as "if (sID == m_sCustomPaneID)" will be true twice.

So, after closing the app when the pane is left in this state (floating):

image.png

The next run results in exception, plus:

image.png

Therefore,

[Q1] If not "FloatingRoots", where is it if left floating?
[Q2] Is there a style that would disable the pane to be left in floating state - so can only be docked (UIX_LayoutItemStyle_NoFloat is not the answer as it does not allow to dock anywhere else)?



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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Mon Jan 27, 2020 8:31 am

Hello žarko,

Forwarded this one to Vasyl - he'll take a look when he has time.

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

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

Re: Custom Pane creation

Post by Vasyl-Tracker Dev Team » Thu Jan 30, 2020 3:14 am

Hi -žarko

I refactored our sample:
https://github.com/tracker-software/PDF ... CustomPane

fixed some issues, slightly simplified the code, added saving of panes layout on the exit of app and loading it on the start.
Please look..

Cheers.
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.

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

Re: Custom Pane creation

Post by zarkogajic » Thu Jan 30, 2020 1:50 pm

Hi Vasyl,

Thanks!

I needed to refactor it a bit more as in my case the settings are loaded during Inst.Init - and at that time my IPXV_ViewCreator does not exist.

The HasPane(IUIX_Layout) helped a lot!

-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Fri Jan 31, 2020 11:11 am

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

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

Re: Custom Pane creation

Post by zarkogajic » Thu Mar 05, 2020 5:01 pm

Hi Support,

When adding my custom panes, I'm using MainFrame.View.Panes.Layout.Insert with the nInsertBeforeChild parameter. When "0" the pane is inserted to the left edge, with "-1" to the far right.

How to add my custom pane to the bottom edge?

image.png

What should be the value of the InsertBeforeChild in this case?


To extend this :

image.png

When the second pane comes in, say at the bottom, it can be left/right/top/bottom but also create tabbed view.





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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Thu Mar 12, 2020 12:01 pm

Hello zarkogajic,

Forwarded this one to Vasyl - probably he can tell more.

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

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

Re: Custom Pane creation

Post by Vasyl-Tracker Dev Team » Fri Mar 13, 2020 3:47 am

Hi Zarko.

Sorry for delay with answer. You may use the following method:

Code: Select all

...
if ((layout.Root.Style & (int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_VertSplitters) != 0) // root container has vertical splitters?
{
	if (layout.Root.Count > 0) // does root container already contain other panes?
                // wrap all of them by an additional new new subcontainer to keep their vertical splitters style
		layout.WrapAllChildrenByNewSubContainer(layout.Root, layout.Root.Style);

        // make splitters horizontal
	layout.Root.Style &= ~(int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_VertSplitters; 
}
// add new pane to the bottom
layout.Insert(paneContainer.Obj,
				"My Custom Pane",
				layout.Root, ref sz,
				(int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_FixedSize); // make pane fixed size (not proportional)
...
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.

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

Re: Custom Pane creation

Post by zarkogajic » Fri Mar 13, 2020 4:31 pm

Hi Vasyl,

Thanks. This allowed to place panes top or bottom. Two bottom ones are placed one "over" another, like:

image.png

I cannot figure out how to initially have those two bottom ones to be grouped like this:

image.png

?


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

Re: Custom Pane creation

Post by Vasyl-Tracker Dev Team » Tue Mar 17, 2020 6:15 am

Hi Zarko

Here is modified code snippet:

Code: Select all

...
const string MY_PANE_ID1 = "myCustomPane1";
const string MY_PANE_ID2 = "myCustomPane2";

PDFXEdit.IPXV_View paneContainer1, paneContainer2;
PDFXEdit.tagRECT rc;
rc.left = rc.top = rc.right = rc.bottom = 0;

myPanesCreator.CreateNewView(Inst.ActiveMainView, layout.Obj, Inst.Str2ID(MY_PANE_ID1), "", ref rc, out paneContainer1);
myPanesCreator.CreateNewView(Inst.ActiveMainView, layout.Obj, Inst.Str2ID(MY_PANE_ID2), "", ref rc, out paneContainer2);

if (paneContainer1 != null)
{
	if ((layout.Root.Style & (int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_VertSplitters) != 0) // root container has vertical splitters?
	{
		if (layout.Root.Count > 0) // does root container already contain other panes?
			// wrap all of them by an additional new new subcontainer to keep their vertical splitters style
			layout.WrapAllChildrenByNewSubContainer(layout.Root, layout.Root.Style);

		// make splitters horizontal
		layout.Root.Style &= ~(int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_VertSplitters; 
	}

	PDFXEdit.tagSIZE sz;
	sz.cx = sz.cy = defPaneSize;

	// style doesn't contain the UIX_LayoutItemStyle_Splitted (contains by default)
	PDFXEdit.IUIX_LayoutItem tabbedParent = layout.InsertNewSubContainer(layout.Root, sz, (int)(UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_TabBarBottom)); 

	layout.Insert(	paneContainer1.Obj, 
					"My Custom Pane 1",
					tabbedParent, ref sz, 
					(int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_FixedSize); // make pane fixed size (not proportional)
	layout.Insert(	paneContainer2.Obj, 
					"My Custom Pane 2",
					tabbedParent, ref sz, 
					(int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_FixedSize); // make pane fixed size (not proportional)
}
...
If you try it in the CustomPane sample project - then you will have this result:
image.png
(note: the CustomPane loads the panes layout saved in the previous session - temporarily turn off it to avoid confusion).

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.

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

Re: Custom Pane creation

Post by zarkogajic » Tue Mar 17, 2020 12:40 pm

Thanks Vasyl, that was it :)


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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Tue Mar 17, 2020 12:48 pm

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

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

Re: Custom Pane creation

Post by zarkogajic » Wed Apr 01, 2020 9:34 am

Hi Support,

When adding a custom pane - how to specify the initial size of it?

By size I mean Width if UIX_LayoutItemStyle_VertSplitters and Height if opposite.

Further, how do I programmatically change Width/Height of a pane (custom or standard)?

p.s.
I though the pSize parameter of the IUIX_Layout.Insert (when adding my custom one) would do the trick - but seems like not.

I also tried the Resize method of the created IUIX_LayoutItem - but cannot figure out how to use it (raises an AV whatever I pass for parameters)


-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Mon Apr 06, 2020 1:14 pm

Hello zarkogajic,

The problem is that you already have initialized it and the settings themselves come from cab. If you clear them, then the pane will use the inner initializing procedure and will take the underlined param as default width (for vertical panes) and default height (for horizontal panes)
image.png
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

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

Re: Custom Pane creation

Post by zarkogajic » Mon Apr 06, 2020 4:11 pm

Hi Alex,

Thanks. I have it set like that and the Insert method of "layout" does happen and I'm using the defPaneSize value.

What follows, after Insert, is the WM_SIZE event of the corresponding CustomPaneContainer - unfortunately the ClientRect there is "bigger" than needed.

I'll go step by steps to see if I have not missed something ...

Can you let me know how to programmatically resize a pane if I fail to find the reason.



-žarko

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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Tue Apr 07, 2020 6:47 am

Hello žarko,

Does the sample itself work correctly?

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

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

Re: Custom Pane creation

Post by zarkogajic » Tue Apr 07, 2020 10:53 am

Hi Alex,

This seems to be slightly more complex ...

I've just downloaded a clean version of the latest CustomPane solution from github.

Since in my real app I'm loading user settings before I can call RegisterViewCreator I'm commenting/disabling the

//Inst.LoadUserSettings(settingsLocation); // try to load all previously saved settings (including the custom layout of panes)

Also, I'm doing this:

Code: Select all

public Form1()
{
  InitializeComponent();

  PDFXEdit.PXV_Inst Inst = pdfCtl.Inst;

  //ADDED BY ME
  pdfCtl.VisibleCmdPanes = 3;
  pdfCtl.Inst.Settings["Docs.SingleWnd"].v = false;
  pdfCtl.Inst.Settings["Docs.AutoSyncDocPanesLayouts"].v = false;
  pdfCtl.Inst.FireAppPrefsChanged(PDFXEdit.PXV_AppPrefsChanges.PXV_AppPrefsChange_Documents);
...
Now, start the app...

Upon start a pane gets created in the MainView, since we have not loaded user settings the myPanesCreator.CreateNewView gets called as well as layout.Insert and the rest - that's ok.

Then I open one document and the next series of events happen (you can reproduce all this):

1. e_documentView_ready fires
1.1. docView.Panes.Layout does not have the docpane, so CreateNewView and layout.Insert are called as expected
2. pane is positioned in the left edge of the document view

Resize and dock the pane to the right edge.

Now starts the tricky part:

Open another document

1. CreateNewView gets called having nViewID == m_frm.nMY_DOC_PANE_ID
1. 1. New instance of UserControl1 is created for a new CustomPaneContainer
2. e_documentView_ready fires
2.1. The HasPane is false and therefore CreateNewView and layout.Insert do NOT happen
3. the pane is placed where you moved the pane for the first document.

And now a question:

Since (1) happens, in e_documentView_ready the HasPane returns true and Insert does not happen - so you cannot set the initial size/position/placement of the custom pane for this new document.

That's one of whys I'm asking how to resize a pane from code (and now obviously also how to move it to a different location).

Next, activate the first document and dock the custom pane to the bottom edge (so the placement of the custom pane is: document1_bottom, document2_right.

Open third document, and as above: CreateNewView gets called, e_documentView_ready has the pane so no Insert happens. But, the pane gets positioned at the bottom edge (same size as the pane for document1).

What code places it there (and why does it use the same placement from the last activated/placement changed document)? That could only be UIX_CreateObjParams but what parames are used for placement/insert position?

I'll stop here, there are more questions, but let's hopefully first clear out the ones above.

UPDATE 1:
If each opened document will have a different MY_DOC_PANE_ID value then CreateNewView will not find it (upon opening document), and HasPane in e_documentView_ready will be false and therefore CreateNewView + layoutI.Insert will happen for it.

BUT, why does CreateNewView even get called for nViewID of the previously created pane (for "previous" document) ??

Or, in other words: when a new document is opened, and then CreateNewView is called for pParentView being IPXV_DocumentView, why does it also receive nViewID of the previous document's pane??


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

Re: Custom Pane creation

Post by Sasha - Tracker Dev Team » Fri Apr 10, 2020 12:03 pm

Hello zarkogajic,

Probably this can help
viewtopic.php?f=66&t=27068&p=105426&hil ... ne#p105064

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

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

Re: Custom Pane creation

Post by zarkogajic » Fri Apr 10, 2020 1:47 pm

Hi Alex,

Thanks, that kind of did it...

However, here's what's happening in my real world app and it is driving me crazy!

Initially I'm adding my custom pane as horizontal to bottom edge of the IPXV_DocumentView.

As suggested by Vasyl, WrapAllChildrenByNewSubContainer needs to be called when removing the UIX_LayoutItemStyle_VertSplitters flag from the Layout.Root.

First time the pane gets added (settings are empty, so HasPaneLayout is false and Insert is called) the pane's height is somewhere half (more than below mentioned 200px) the DocumentView area.

Of course, I am using UIX_LayoutItemStyle_FixedSize and am setting the pSize parameter, to lets say "200 x 200".

Now, pane gets displayed (incorrect height) and your proposed code is *NOT* working - nothing happens!!

If I then drop-dock to the top edge - the pane resizes itself to 200 height and from this moment Set_FixedSize does actually work!

I've noticed that if I comment the WrapAllChildrenByNewSubContainer (so it does not get called) this will not happen! The Insert method will correctly set the initial size. And the Set_FixedSize works from first time.

BUT, I'm "afraid" to remove the call to WrapAllChildrenByNewSubContainer as (from what I understand) it must be there.

Seems like the creation of this additional LayoutItem (returned by WrapAll...) somehow messes up the parentage or something.

If I would know what happens when I drop-dock to the top edge (or any other) - since this fixes everything - maybe I could do it from code... ?

p.s.
Can I recreate in CustomPane demo - sorry not - as this is within my application. I would need to recode the CustomPane sample a lot to make it work as it works in my code.

UPDATE 1:

OMG!

If the initial insert position of the pane is "0" - it goes to top - and all works (e.g. Set_FixedSize).

However, I need it to go to bottom (initial insert position "-1") - then it does not work as explained above!!







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

Re: Custom Pane creation

Post by zarkogajic » Sat Apr 11, 2020 7:24 am

Hi Support,

Well, this can actually be reproduced in the CustomPane demo.

So, I want my custom document pane to initially go to the bottom edge (horizontal align).

To reproduce the problem:

image.png

So, set the insert position to "-1" and add the lines of code to remove UIX_LayoutItemStyle_VertSplitters.

When the pane is displayed it is *not* of the "defPaneSize" !!


And Set_FixedSize does not work on it:

image1.png


Only when you once drag-dock it from the bottom edge to any other edge - then Set_FixedSize starts to work on it.

p.s.
Seems I'm not crazy after all (but have gone slightly mad about it) :)


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

Re: Custom Pane creation

Post by zarkogajic » Fri Apr 17, 2020 12:55 pm

Support,

Ping...

(my last post has raised some issues)


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

Re: Custom Pane creation

Post by Vasyl-Tracker Dev Team » Tue Apr 28, 2020 12:39 am

Hi zarko.

Seems there is a problem on the our side and we will fix it in the near future. Currently you may use the following workaround:

...
PDFXEdit.IUIX_LayoutItem itm = layout.WrapAllChildrenByNewSubContainer(layout.Root, layout.Root.Style);
itm.SetStyle(0, (int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_FixedSize); // - that is the workaround because
// the WrapAllChildrenByNewSubContainer mistakenly adds the UIX_LayoutItemStyle_FixedSize to the itm
...

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.

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

Re: Custom Pane creation  SOLVED

Post by zarkogajic » Tue Apr 28, 2020 9:44 am

Thanks Vasyl!



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

Custom Pane creation

Post by Sasha - Tracker Dev Team » Tue Apr 28, 2020 11:41 am

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

Post Reply