Is it possible to open and resize a form dynamically?

Have stated multiple times. Broken down:

Form Event

.
Document is going to be closed
.
Not the internal form but the form event:

1 Like

Phew! Are there other mysterious places like this in this software. So I can deduce that anything related to the form in the document and not the forms in the form, that Customize menu is where things happen. Also, part of my misunderstanding is that I didn’t understand the subtlety between Document event of a form and Form Event of a form.
.
OK, you’re probably going to tell me Read the manual, but please be lenient.
.
Alright, everything works. All I have to do is disable the MsgBox.
.
As for opening with defined default window dimensions, I will do a search on this site as you suggested.
.
This time again, I have to thank you and Villeroy. Both of you have contributed greatly. But it’s still you who brought the elements making everything work as I wanted.

Sorry, but do not know where you got that. The image is for Events.
.

Yes. One that comes to mind is text box.
.

.
Without at least skimming through documentation, your lack of knowledge of the terminology used is going to be a hindrance.

Hello Villeroy,
.
I am rereading the comments and indications that you and Ratslinger gave me following the question that I had asked.
.
In your file, “counter_2022.odB”, you mentioned that you stored the position, size and zoom in the form’s user-defined properties.
.
I was able to read these coordinates in the udp variable used by the macro you wrote. These are : H=800, W=800, X=0, Y=50, Z=80.
.
I’m trying to access these user-defined properties, but can’t see how. I looked in the manual and when we talk about property, it is always associated with existing elements in a form or the properties of the forms inside the form.
.
Please, can you tell me where these coordinates are so that I can visualize things?

@Renel
.
This is the heart of the code in my sample (originally by Villeroy) in Sub onFormUnload(ev)

    frm = ev.Source.DrawPage.Forms.getByName("WindowSettings")

	doc = getParentObject(frm, "com.sun.star.document.OfficeDocument")
	view = doc.CurrentController
	ps = view.Frame.ContainerWindow.getPosSize()
print ps.X, ps.Y, ps.Width, ps.Height
	frm.updateLong(1, ps.X) 
	frm.updateLong(2, ps.Y) 
	frm.updateLong(3, ps.Width) 
	frm.updateLong(4, ps.Height) 
	frm.updateLong(5, view.ViewSettings.ZoomValue) 

.
You get the document, the CurrentController, the Frame, the ContainerWindow and there you obtain:

getPosSize()

in the code that is now ps. So in ps get:

X = ps.X
Y = ps.Y
W = ps.Width
H = ps.Height

Also once you have the CurrentController (view in this case), you can get ViewSettings and then get ZoomValue.
.
Edit:
.
Examining the internals can be done with a tool such as MRI. For more information on this see the links within this post → How to Get and Put data from/to form fields with a macro
.
There is a bunch of info out there (and posted within this site). Got to search and read - a lot.

Ok, I understand that with macros it is essential to have a very good understanding of the Application Programming Interface.
.
I also understand why Villeroy seems to encourage me to invest in understanding the SQL language rather than investing my time in macros. API seems a complex and obscure world for a neophyte like me…
.
I will follow the link you suggested anyway. Thanks!