Skip to main content
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

Uniface Development: [SOLVED] fill ocx container by pdf source

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

31 replies

Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hi, I understood Thank you again


Author: Dylan (dylan.huart@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

That OCX will not support image types. (You can't open them in Adobe reader).  What we have done is to paint two widgets, one an OCX widget linked to adobe, and the other a picture widget side by side on the form, and set both of them to attach to window borders (left, right and bottom).  If the loaded file ends in ".pdf" we load it into the ocx as above and hide the picture widget , if not we use  lfileload/image "c:\\test2.jpg", FIELDPIC.CINOMPJ and then hide the ocx field. 


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hello, Thank you for your reply, but I have still the same problem: I create a FRM test to understand the OCX container, in this FRM I create a entity "CINOMPJ" in which I put my OCX, I then assigned AcroPDF then a button , in the trigger "Details" I put this code: variables HANDLE lh_ocx boolean ln_b endvariables lh_ocx = $ocxhandle ( FIELDOCX.CINOMPJ ) lh_ocx->loadfile( ln_b, "c:\\test2.pdf" ) display   but when I test the OCX remains gray Cry any idea?   Thank you


Author: Dylan (dylan.huart@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

With the ocx widget connected to the ocx container, import the signature (button on the OCX properties form) This should give you a signature caller ACROPDF (I think) The operation to use against this signature is loadfile(boolean,string) e.g. v_filename = "c:\\temp\\fred.pdf" $ocxhandle(ocx_field)->loadfile(v_loaded,v_filename)   This needs to be done after the edit or show command has been run on the form containing the ocx widget. (so not in the exec trigger, unless there's an explicit show).  Other operations imported with this signature should/will allow you to control which adobe functions are shown in the adobe menu, and to do things like print out the pdf from a uniface button/proc. 


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hi Dylan, If memory serves me right, sometimes the OCX widget has to be 'run' outside the IDF - in other words, tested from a Uniface.exe / application shell environment - and that might be what's causing you the problem. Here's a snippet from the manual:

Testing

When the form containing the OCX is run using File ► Test in the Development Environment, the OCX control runs in the UDE rather than in your application. This means that the OCX is loaded in a type of development mode (AmbientUserMode=false) that might have some restrictions for the OCX. For more information, see Test Form Components Containing OCX Controls. Regards, Knut


Author: Knut (knut.dybendahl@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hi Dylan, $ocxhandle can only be used after the OCX has been instantiated. And this happens when the form on which the OCX is painted has executed a show, edit or display statement. Hope this helps. Regards, Daniel


Author: diseli (daniel.iseli@uniface.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hi, Thank you for your information, I'll try to test it one last question : when I do the display or edit ? Regards, Dylan


Author: Dylan (dylan.huart@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help
Hi Dylan, This should work:
 

variables HANDLE lh_ocx boolean ln_b endvariables

show

lh_ocx = $ocxhandle ( FIELDOCX.CINOMPJ ) lh_ocx->loadfile( ln_b, "c:\\test2.pdf" )

display

 
And if you want to use display or edit depends on the purpose of the form in question - display: display only, content cannot be changed; edit: content can be changed.
 
Hope this helps.
 
Regards, Daniel

Author: diseli (daniel.iseli@uniface.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Although if your code is in the details trigger of a button, you shouldn't need either the show or display. In fact, I think display has no function outside the exec trigger.  I do believe the thing doesn't work unless in an actual runtime environment, (i.e. not from the test function in the IDF).  Also, ensure you have run the adobe reader on your machine and accepted the licence agreement.  (If running his in debug, what is the status on the loadfile operation)   Iain


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:17 AM UTC

[SOLVED] fill ocx container by pdf source

Author: dylan.huart@gmail.com (Dylan)

Hello Wink , I wanted to know how to fill an "OCX​​" by a data source (pdf) stored for example on the c :/ temp I have a FRM which, thanks to a button provides access to the OCX container Thank you for your help

Hi, So, I've successful with a button  from the same "FROM"  without a "display" and "show", but by another "FRM" the problem remains the same : => FRM1 -> click on button -> call FRM2 "execute" ->

variables HANDLE lh_ocx boolean ln_b endvariables

show

lh_ocx = $ocxhandle ( FIELDOCX.CINOMPJ ) lh_ocx->loadfile( ln_b, "c:\\test2.pdf" )

display

I don't understand...   Dylan   Thank you for your help Wink


Author: Dylan (dylan.huart@gmail.com)