[Solved] Set the Calc Dialog to fit the Windows Screen

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
MINTHETNAUNG
Posts: 18
Joined: Mon Jun 18, 2018 3:33 am

[Solved] Set the Calc Dialog to fit the Windows Screen

Post by MINTHETNAUNG »

I think there is a solution out there but I can't seem to find it and I don't know how to do it either. I made a program with Calc macro. Basically, it is a dialog Form. I made it on one PC and set up all the width and height of the dialog to look good enough on that PC. Later on, when I tested it on other PC, the dialog is out of the Windows Screen and all texts haywire. So, how could I make my program to adjust the Windows Screen size and fit to it?
Last edited by MINTHETNAUNG on Wed Jul 11, 2018 11:29 am, edited 1 time in total.
Openoffice 4.1.5 on Windows 10
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Set the Calc Dialog to fit the Windows Screen

Post by JeJe »

One way is to maximize a document window then read off the dimensions and set your dialog to the same.

Code: Select all


Sub Main
with ThisComponent.getCurrentController().getFrame().ContainerWindow
.isMaximized = True
ps = .getpossize
end with
f= loadDialog("Standard","Dialog1")
with ps
f.setpossize .x,.y,.width,.height,15
end with
f.execute
End Sub


Function LoadDialog(oLibraryName as String, oDialogName as String) 'just to load dialog
				Dim oLib as Object
				DialogLibraries.LoadLibrary(oLibraryName)
				oLib = DialogLibraries.GetByName(oLibraryname)
				LoadDialog() =  CreateUnoDialog(oLib.GetByName(oDialogName))
End Function



Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
MINTHETNAUNG
Posts: 18
Joined: Mon Jun 18, 2018 3:33 am

Re: Set the Calc Dialog to fit the Windows Screen

Post by MINTHETNAUNG »

Great. This works. But when I do that, the list boxes, combo boxes, text boxes and labels sizes positions are not getting bigger or smaller. How do I keep the ratio of those sizes if I were to maximize the Dialog size?
Openoffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Set the Calc Dialog to fit the Windows Screen

Post by Zizi64 »

How do I keep the ratio of those sizes if I were to maximize the Dialog size?
I suppose it: You must/can recalculate and adjust the object sizes and positions programatically.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
MINTHETNAUNG
Posts: 18
Joined: Mon Jun 18, 2018 3:33 am

Re: Set the Calc Dialog to fit the Windows Screen

Post by MINTHETNAUNG »

I see. I will work on it. Thank you!
Openoffice 4.1.5 on Windows 10
Post Reply