[Solved] Use library “ResizableDialog” in an autonomous file

Creating a macro - Writing a Script - Using the API

[Solved] Use library “ResizableDialog” in an autonomous file

Postby Sébastien C » Wed Jun 06, 2018 3:25 pm

Hello Team,

I experiment actually the wonderful code snippet of roland65 : “Resizable dialog”.

This code is a little beyond my abilities, although I can understand the general meaning of it, and use it. I did not have any problem installing the “ResizableDialog” library. Finally, I am personally just interested by the non-modal dialog box. I use LibreOffice and it works without problem.

I find myself in front of a problem. My use would be really easy if my users should NOT have to install a library (or an extension). It is therefore necessary that the code is included in the file, in this case and for what I want to do, in a Calc’s file.

I thought that changing the only line
Code: Select all   Expand viewCollapse view
sURL = "vnd.sun.star.script:ResizableDialog.Dialog2?location=application"
by one who would follow the type
Code: Select all   Expand viewCollapse view
sURL = "vnd.sun.star.script:Standard.Dialog1?location=document"
would solve the problem. Obviously, I've opened a “Standard” library in my file, as much as a “Dialog1” is of course present.

Launching the macro named “ResizableDialog”, I have the following message:

exceptionParent.png

I understood that there was a copy between outer and inner dialog... And I presume it is a problem of a Child without Parent... From there to really understand the mechanism of this system without warning social services, it's a bit complicated for me (or it will take me a lot of time)...

Could you help me :?:
Last edited by Sébastien C on Thu Jun 07, 2018 9:38 am, edited 1 time in total.
LibreOffice 5.x under GNU-Linux Mageia 5.0 and M$-W XP
User avatar
Sébastien C
 
Posts: 57
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Postby JeJe » Wed Jun 06, 2018 4:58 pm

The url with a document doesn't work I'm afraid, either with the standard library or another one in the document. Don't know why - it works with the location = application and that's the reason for the separate library.
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 228
Joined: Wed Mar 09, 2016 2:40 pm

Re: Use the library “ResizableDialog” in an autonomous file.

Postby Sébastien C » Wed Jun 06, 2018 5:31 pm

JeJe wrote:it works with the location = application and that's the reason for the separate library.

I understood that... ;)

JeJe wrote: Don't know why

Precisely, I would like to know why :crazy:

Thanks for your interest.
:D
LibreOffice 5.x under GNU-Linux Mageia 5.0 and M$-W XP
User avatar
Sébastien C
 
Posts: 57
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Postby hubert lambert » Wed Jun 06, 2018 10:04 pm

Hello,

This is the same problem as with the DialogProvider service : you need to instanciate the service with the document as argument, so that the program gets the right context for locating de dialog.

Thus replace this line:
Code: Select all   Expand viewCollapse view
oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")

with something like this:
Code: Select all   Expand viewCollapse view
oDP = getDefaultContext.ServiceManager.createInstanceWithArguments("com.sun.star.awt.ContainerWindowProvider", array(thiscomponent))

Regards.
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
hubert lambert
 
Posts: 83
Joined: Mon Jun 13, 2016 10:50 am

Re: Use the library “ResizableDialog” in an autonomous file.

Postby Sébastien C » Wed Jun 06, 2018 10:54 pm

I am sorry hubert lambert. If your line do not change anything in the context of library, it do not work at same in a context of file. I join a file, just for example, where there are a “resizableDialog” module in “Standard” library. The macro to call is, of course, ResizableDialog().

Thanks for your interest too.
Attachments
paveNonModal.ods
(14.77 KiB) Downloaded 14 times
LibreOffice 5.x under GNU-Linux Mageia 5.0 and M$-W XP
User avatar
Sébastien C
 
Posts: 57
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Postby hubert lambert » Thu Jun 07, 2018 8:46 am

Your dialog uri is wrong. This one works:
Code: Select all   Expand viewCollapse view
sURL = "vnd.sun.star.script:Standard.Dialog1?location=document"

You may also prefer this way of instanciating the ContainerWindowProvider:
Code: Select all   Expand viewCollapse view
   oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")
   oDP.initialize(array(thiscomponent))
Attachments
paveNonModal.ods
(15.7 KiB) Downloaded 18 times
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
hubert lambert
 
Posts: 83
Joined: Mon Jun 13, 2016 10:50 am

Re: Use the library “ResizableDialog” in an autonomous file.

Postby Sébastien C » Thu Jun 07, 2018 9:37 am

Hello everyone,

I am ABSOLUTELY stupid (and a bit tired). Typical of several errors that accumulate after multiple trials. A HUGE thank you for this help Hubert Lambert :bravo: ... and my apologies for the slowness of my neurons!

If it happens, as I believe, to the friend Roland65, to go through here, it will undoubtedly allow him to correct to perfection his code snippet possibly also adding this possibility.

A VERY big thank you to everyone!
:D
LibreOffice 5.x under GNU-Linux Mageia 5.0 and M$-W XP
User avatar
Sébastien C
 
Posts: 57
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests