Hi Support,
How could I do the following from code:
1. Check if a pane is docked. (note: interested only in history, recover and alike - so not specific document related panes).
2. Undock it and resize and position in screen center.
3. Dock it back to where it was (if it was docked) before [2].
-žarko
Undock / dock a pane from code (+ change size) SOLVED
Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
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.
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.
-
- User
- Posts: 1462
- Joined: Thu Sep 05, 2019 12:35 pm
- Vasyl - PDF-XChange
- Site Admin
- Posts: 2444
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Undock / dock a pane from code (+ change size)
1. Check if a pane is docked. (note: interested only in history, recover and alike - so not specific document related panes).
Code: Select all
IUXC_LayoutItem getObjLI(IUXC_Obj o)
{
IUXC_LayoutItem LI;
do
{
if (o == null)
break;
LI = o.LI;
if (LI != null)
break;
o = o.Parent;
} while (true);
return LI;
}
IUXC_LayoutItem LI = getObjLI(pane.Obj);
bool bDocked = (LI != null) && !LI.IsFloating;
2. Undock it and resize and position in screen center.
Code: Select all
IUXC_LayoutItem LI = getObjLI(pane.Obj);
if (LI != null)
LI.MakeFloating2(centerRect);
3. Dock it back to where it was(if it was docked) before[2].
Code: Select all
// before make pane floated - keep the dock-parent and dock-index of the pane's layout-item inside that parent
IUXC_LayoutItem LI_DkParent = LI.Parent;
LI_IndexInDkParent = LI_DkParent.GetItemIndex(LI);
// dock back
LI_DkParent.Layout.MoveItem(LI, LI_DkParent, LI_IndexInDkParent);
// NOTE: IUXC_LayoutItem.Layout property will be added in the upcoming build to simplify getting the layout object.
// However, currently, you may use a more complicated way to get the layout object:
IUXC_Layout getLayoutFromObj(IUXC_Obj o)
{
do
{
if (o == null)
break;
IntPtr impl = IntPtr.Zero;
o.QueryImpl(typeof(IUXC_Layout).GUID, null, out impl);
IUXC_Layout L = (IUXC_Layout)Marshal.GetObjectForIUnknown(impl);
if (L != null)
return L;
o = o.Parent;
} while (true);
return null;
}
PDF-XChange Co. LTD (Project Developer)
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1462
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Undock / dock a pane from code (+ change size) SOLVED
Hi Vasyl,
Fantastic, thanks!
-ž
Fantastic, thanks!
-ž
- Stefan - PDF-XChange
- Site Admin
- Posts: 19826
- Joined: Mon Jan 12, 2009 8:07 am
- Contact: