Page 1 of 1

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

Posted: Wed Jun 06, 2018 3:25 pm
by Sébastien C
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

sURL = "vnd.sun.star.script:ResizableDialog.Dialog2?location=application"
by one who would follow the type

Code: Select all

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 :?:

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

Posted: Wed Jun 06, 2018 4:58 pm
by JeJe
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.

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

Posted: Wed Jun 06, 2018 5:31 pm
by Sébastien C
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

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

Posted: Wed Jun 06, 2018 10:04 pm
by hubert lambert
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

oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")
with something like this:

Code: Select all

oDP = getDefaultContext.ServiceManager.createInstanceWithArguments("com.sun.star.awt.ContainerWindowProvider", array(thiscomponent))
Regards.

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

Posted: Wed Jun 06, 2018 10:54 pm
by Sébastien C
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.

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

Posted: Thu Jun 07, 2018 8:46 am
by hubert lambert
Your dialog uri is wrong. This one works:

Code: Select all

sURL = "vnd.sun.star.script:Standard.Dialog1?location=document"
You may also prefer this way of instanciating the ContainerWindowProvider:

Code: Select all

	oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")
	oDP.initialize(array(thiscomponent))

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

Posted: Thu Jun 07, 2018 9:37 am
by Sébastien C
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