MDI children forms
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
MDI children forms
I'm getting an initialization error when accessing the PDF viewer in a MDI child form.
If the form is not made a MDI child of the parent the control works fine.
Is there a setting or flag that I'm missing?
If the form is not made a MDI child of the parent the control works fine.
Is there a setting or flag that I'm missing?
-
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
Re: MDI children forms
Hi wcarlsrud,
Thanks for the post - I'm not sure that I understand the issue. Are you using our SDK, or the end user app? Also please clarify what product, specifically, you are using, as you have posted in the Editor forum but are referencing the Viewer.
Lastly please provide any relevant sample documents, such as a copy of a working form and one that shows the error, as well as step-by-step instructions to reproduce.
Thanks,
Thanks for the post - I'm not sure that I understand the issue. Are you using our SDK, or the end user app? Also please clarify what product, specifically, you are using, as you have posted in the Editor forum but are referencing the Viewer.
Lastly please provide any relevant sample documents, such as a copy of a working form and one that shows the error, as well as step-by-step instructions to reproduce.
Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
AxInterop.PDFXEdit.dll v1.0.0.0
Interop.PDFXEdit.dll v1.0.0.0
I am using the AxPXV_Control
When I place the control on a 'regular' form the control works as expected.
When it is on a MDI child form the control throws an error when it is referenced.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at AxPDFXEdit.AxPXV_Control.OpenDocFromPath(String sSrcPath)
at ADC_PDF_Launcher.frmTracker.frmTracker_Load(Object sender, EventArgs e) in C:\SourceCode\VS2015\ADC_PDF_Launcher.NET\frmTracker.vb:line 17
here is the code fragment:
licKeyDEMO = "demo key was here"
AxPXV_Control1.SetLicKey(licKeyDEMO)
AxPXV_Control1.OpenDocFromPath("C:\users\carlsw\desktop\Sample.pdf")
Interop.PDFXEdit.dll v1.0.0.0
I am using the AxPXV_Control
When I place the control on a 'regular' form the control works as expected.
When it is on a MDI child form the control throws an error when it is referenced.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at AxPDFXEdit.AxPXV_Control.OpenDocFromPath(String sSrcPath)
at ADC_PDF_Launcher.frmTracker.frmTracker_Load(Object sender, EventArgs e) in C:\SourceCode\VS2015\ADC_PDF_Launcher.NET\frmTracker.vb:line 17
here is the code fragment:
licKeyDEMO = "demo key was here"
AxPXV_Control1.SetLicKey(licKeyDEMO)
AxPXV_Control1.OpenDocFromPath("C:\users\carlsw\desktop\Sample.pdf")
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: MDI children forms
Hello wcarlsrud,
OK, so you have the Editor SDK not the Viewer one.
Please provide a small working sample in attachment so that we can debug it an tell you what the problem is.
Cheers,
Alex
OK, so you have the Editor SDK not the Viewer one.
Please provide a small working sample in attachment so that we can debug it an tell you what the problem is.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
I have a sample vs2015 solution. the zip file is too large to attach. Where can I email it?
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
Got rid of the big PDF and put in a placeholder.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: MDI children forms
Hello wcarlsrud,
Will look at it.
You've pasted sample with license key. Please do NOT post your license key here, or we will be forced to deactivate it.
Will look at it.
You've pasted sample with license key. Please do NOT post your license key here, or we will be forced to deactivate it.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
That is the 'demo' license key from the sample application.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: MDI children forms
Ok my bad - sorry for the inconvenience.
I've inspected the problem and there was a 'Wrong Thread' exception that means that the control creation and the methods used are in different threads. I do not know why this occurred but will try to find out. Maybe you could provide some information in this respect?
HTH,
Alex
I've inspected the problem and there was a 'Wrong Thread' exception that means that the control creation and the methods used are in different threads. I do not know why this occurred but will try to find out. Maybe you could provide some information in this respect?
HTH,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
We are evaluating the product to determine if this is 'better' than another vendor's
I can only point to the sample solution and say that the error only appears to happen when the form is launched with the MDI parent property set to the MDI parent.
I'm not sure why that would cause the control to fail when it tries to load a PDF. The MDI child form will display with the control as long as a PDF is not loaded.
I can only point to the sample solution and say that the error only appears to happen when the form is launched with the MDI parent property set to the MDI parent.
I'm not sure why that would cause the control to fail when it tries to load a PDF. The MDI child form will display with the control as long as a PDF is not loaded.
-
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: MDI children forms
Hi wcarlsrud.
We investigated your case and found some issues on our side. When VB creating MDI-Child with embedded ActiveX control it does one strange trick: it creates ActiveX-object, then instantiates UI-control based on this object, then destroys this control and creates new again for the same ActiveX object. But unfortunately, currently we are not supported correctly the re-creating of UI-control for the same ActiveX-object. We will fix this issue in the next build.
Also we have some tips for case when app. requires using of multiple our ActiveX Control in the same time.
1. Add code to initialize/uninitialize SDK only once time, otherwise might be next situation:
- now, all ActiveX Controls, instantiated between MainForm::Load()/MainForm::Closed(), will only increment/decrement special counter of SDK-initializations.
2. other note: in case with creating of MDI-child is too early to open document(and to use many other functions) in context of Form::Load(). In this moment the ActiveX-object isn't a UI-control. Currently we have no idea why. We found simple workaround for that:
HTH.
We investigated your case and found some issues on our side. When VB creating MDI-Child with embedded ActiveX control it does one strange trick: it creates ActiveX-object, then instantiates UI-control based on this object, then destroys this control and creates new again for the same ActiveX object. But unfortunately, currently we are not supported correctly the re-creating of UI-control for the same ActiveX-object. We will fix this issue in the next build.
Also we have some tips for case when app. requires using of multiple our ActiveX Control in the same time.
1. Add code to initialize/uninitialize SDK only once time, otherwise might be next situation:
Code: Select all
Controls.Add(AxPXV_Control1) // instantiating of first control initializes SDK
Controls.Add(AxPXV_Control2)
...
...
AxPXV_Control2.Destroy()
AxPXV_Control1.Destroy() // destroying of last control uninitializes SDK
....
Controls.Add(AxPXV_Control3) // AGAIN: instantiating of first control initializes SDK
...
AxPXV_Control3.Destroy() // destroying of last control uninitializes SDK
Multiple init/uninit of SDK will definitely slow down performance of your app. So exists simple solution to do it once only:
MainForm::Load()
{
Dim licKey As String = String.Empty
Try
PXV_Inst = New PDFXEdit.PXV_Inst()
PXV_Inst.Init(Nothing, licKey)
Catch ex As Exception
End Try
}
MainForm::Closed()
{
If PXV_Inst IsNot Nothing Then
Try
PXV_Inst.Shutdown()
Catch ex As Exception
End Try
PXV_Inst = Nothing
End If
}
2. other note: in case with creating of MDI-child is too early to open document(and to use many other functions) in context of Form::Load(). In this moment the ActiveX-object isn't a UI-control. Currently we have no idea why. We found simple workaround for that:
Code: Select all
MDIChild::Load()
// Init()
}
MDIChild::Init()
{
Try
AxPXV_Control1.OpenDocFromPath("D:\TestFile.pdf")
Catch ex As Exception
End Try
}
MainFrame::OnCreateMDIChild()
{
MDIChild.MdiParent = Me
MDIChild.Show()
MDIChild.Init()
}
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.
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.
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
I'm not able to make the work-around for #2 (the MDI child) actually work.
When I try to load the control in any of the available events, it appears to just ignore the command.
In the Load event, it throws the reflection error.
When I try to load the control in any of the available events, it appears to just ignore the command.
In the Load event, it throws the reflection error.
-
- User
- Posts: 8
- Joined: Wed Jan 20, 2016 9:55 pm
Re: MDI children forms
Got it figured out. I had to create the control in the parent MDI and manually add it to the child form.
When is your next build scheduled to be released?
When is your next build scheduled to be released?
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: MDI children forms
Hello wcarlsrud,
Glad you got it figured out. As far as I know - it should be in February (though I'm not certain).
Cheers,
Alex
Glad you got it figured out. As far as I know - it should be in February (though I'm not certain).
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ