When opening a dialog from another dialog, the new one may be any place on the screen. I tried the following code to control the position, but it seems to be ignored:
oDBDlg.PosSize.X = 100
oDBDlg.PosSize.Y = 10
The above code is also ignored if opening the dialog in BASIC. Any positioning set in the properties sheet is also ignored when ran. The only time the position can be controlled is during development. Is this a bug or is there an answer?
Thanks...
[Solved] How to position a dialog opened from another dialog
[Solved] How to position a dialog opened from another dialog
Last edited by grnhorn on Thu Jul 31, 2008 11:56 pm, edited 3 times in total.
OOo 2.4.X on Ms Windows XP
Re: How to position a dialog opened from another dialog?
http://api.openoffice.org/docs/common/r ... setPosSize
http://api.openoffice.org/docs/common/r ... sSize.html
sets X and Y while ignoring Width and Height.
http://api.openoffice.org/docs/common/r ... sSize.html
Code: Select all
with com.sun.star.awt.PosSize
nWhat= .X + .Y
end with
oDBDlg.setPositionSize(100, 10, 0, 0, nWhat)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: How to position a dialog opened from another dialog
Thanks Villeroy. This works for a dialog that is being used by itself, but I still could not get it to work when calling a second dialog from a first. I did have to make one change and I completely understand how it happened: setPositionSize to setPosSize. One thing about code when you work with a bunch of them, they all look a like.
Code: Select all
with com.sun.star.awt.PosSize
nWhat= .X + .Y
end with
oDBDlg.setPosSize(100, 10, 0, 0, nWhat)
OOo 2.4.X on Ms Windows XP
Re: How to position a dialog opened from another dialog?
I don't know.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: How to position a dialog opened from another dialog?
Hello Grnhorn,
Here is the code;
The fifth parameter is for flag in our example set to 3
The description of flags adress is here. http://api.openoffice.org/docs/common/r ... sSize.html
Dialog1 and Dialog2 come from dialog editor's dialog modules,
setPosSize Methods' Details
setPosSize
[oneway] void
setPosSize( [in] long X,
[in] long Y,
[in] long Width,
[in] long Height,
[in] short Flags );
Description
sets the outer bounds of the window.
Parameter X ; the x-coordinate of the window.
Parameter Y ; the y-coordinate of the window.
Parameter Width ; the width of the window.
Parameter Height ; the height of the window.
Parameter Flags
Flags are of type PosSize and specify, which parameters are taken into account when setting the outer bounds of the window.
This code is working well
Cheers.
Here is the code;
Code: Select all
Private oform1, oform2 as Variant
Sub Form1show
oform1 = createUnoDialog(DialogLibraries.Standard.Dialog1)
oform1.setPosSize(0,0,,,3)
oform1.execute
' You can Assign this macro a dialog1 buton or dialog1 event
Sub Form2show
oform2 = createUnoDialog(DialogLibraries.Standard.Dialog2)
oform2.setPosSize(0,200,,,3)
oform2.execute
End Sub
End Sub
The description of flags adress is here. http://api.openoffice.org/docs/common/r ... sSize.html
Dialog1 and Dialog2 come from dialog editor's dialog modules,
setPosSize Methods' Details
setPosSize
[oneway] void
setPosSize( [in] long X,
[in] long Y,
[in] long Width,
[in] long Height,
[in] short Flags );
Description
sets the outer bounds of the window.
Parameter X ; the x-coordinate of the window.
Parameter Y ; the y-coordinate of the window.
Parameter Width ; the width of the window.
Parameter Height ; the height of the window.
Parameter Flags
Flags are of type PosSize and specify, which parameters are taken into account when setting the outer bounds of the window.
This code is working well
Cheers.
OOo 2.4.X on Ms Windows XP + linux-other
[Solved] How to position a dialog opened from another dialog
Thanks rmdemi and villeroy, I think I understand what is happening now. The second dialog is opening relative to the first and each succeeding dialog opens relative to the previous. There are 2 solutions. 1) close the 1st dialog before opening the 2nd or 2) use the code below and set negative (-100) to move the 2nd dialog further left or higher then the 1st dialog. Positive numbers will move to the right or down. rmdemi (above) has supplied a link for all of the flags.
Both pieces of code above will work, just apply the positive and negative rules for the position.
Thanks all...
Both pieces of code above will work, just apply the positive and negative rules for the position.
Thanks all...
OOo 2.4.X on Ms Windows XP