Ask Your Question
0

In Macros, how to specify position of Dialog when it is loaded?

asked 2020-10-05 10:20:42 +0100

kpk gravatar image

updated 2020-10-05 12:42:34 +0100

When loading a Dialog from a Macro, using oDlg.setVisible(true) or oDlg.Execute(), is it possible to specify the position where it will open? Either absolute with respect to Desktop or relative with respect to the LibreOffice window.

(I think, in OpenOffice, there is a method setPositionSize. This gives "BASIC runtime error, '423'" in LO. Is there an equivalent available in LO?)

Sample Calc file with macro and dialog.

Screenshot of default dialog position -- at centre

Screenshot of dialog position required -- towards left

edit retag flag offensive close merge delete

Comments

Please upload you sample file/macro code here.

Zizi64 gravatar imageZizi64 ( 2020-10-05 11:15:39 +0100 )edit

As requested, sample Calc file (with macro code and dialog --- the code is quite long for a complicated process...) and screenshots of how dialog appears by default and what is required, have been uploaded by editing the original question. Thanks for the quick response.

kpk gravatar imagekpk ( 2020-10-05 12:44:38 +0100 )edit

I just X-rayed the oDlg object in your code. It has not any method named setPositionSize() but it has setPosSize() method. It not throw error message, but it work a littlebit strangelly...

I suggest you to install and use the Xraytool. Then you will able to list all of the existing properties and methods of the programming objects...

Zizi64 gravatar imageZizi64 ( 2020-10-05 12:55:58 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2020-10-05 13:06:25 +0100

Zizi64 gravatar image

updated 2020-10-05 13:10:53 +0100

I just X-rayed the oDlg object in your code. It has not any method named setPositionSize() but it has setPosSize() method. It not throw error message, but it work a littlebit strangelly...

I suggest you to install and use the Xraytool. Then you will able to list all of the existing properties and methods of the programming objects...

image description

I hope these inforations will help you:

Link 1

Link 2

note: the 5. parameter of the method is a flag. The second link shows, what the bits of the flag mean.

oDlg.setPosSize(0, 0, 400, 400, 15)

15 means (binary 1111) that you want to modify the all of the four parameters: x, y, width, height.

3 means (binary 0011) that you want to modify the position only.

edit flag offensive delete link more

Comments

Thanks a lot! I will try the method setPosSize and also definitely try out the Xraytool... I hope the method works.

kpk gravatar imagekpk ( 2020-10-06 06:47:55 +0100 )edit

Yes, the setPosSize method worked!

I also thought I will add a few lines on the XrayTool, since I think there is no other comment on the tool in ask-LO. It was downloaded from https://sourceforge.net/projects/ooom... (version 5.2 -- though released in 2006 works well with LO 7).

Unzipped to get the file XrayTool52_en.sxw. Opening this .sxw file in Writer (with Macro enabled) shows the instructions and also embedded buttons to install the tool.

Adding a line in macro:

Xray oDlg

showed the Xray tool with screenshot as mentioned by @Ziz64

Thanks again!

kpk gravatar imagekpk ( 2020-10-06 08:05:37 +0100 )edit

You can download the latest version of the XrayTool from Bernard Marcelly's web site (He is the author.)

XrayTool

Zizi64 gravatar imageZizi64 ( 2020-10-06 08:41:48 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-10-05 10:20:42 +0100

Seen: 70 times

Last updated: Oct 05 '20