[Solved] [Calc] Create several dialog boxes

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Makronos
Posts: 3
Joined: Wed May 08, 2019 12:09 pm

[Solved] [Calc] Create several dialog boxes

Post by Makronos »

Hi,
This is the first time for me and I would like to thank the forum and all the speakers for their work.
I have diverted the usual use of a dialog box to make a stopwatch. Easy to handle, easy to move, it is very practical but not quite functional.
To be fully operational, it would not require ONE stopwatch but MORE than ONE.... (at will).

This is precisely what brings me here today, is it possible to generate several dialog boxes independent of each other and manipulable all at the same time?
Given the unusual use I claim to make of it, I have not encountered any subject dealing with it.
I therefore rely on your skills because I am in the most total deadlock.


The code that generates the dialog box (Stopwatch) is:

Code: Select all

Dim oPDialog As Object
Sub DialogBox
	Dim dDialog As Object	
	DialogLibraries.LoadLibrary("Standard")
	oDialog = DialogLibraries.Standard.Dialog1
	oPDialog = CreateUnoDialog(oDialog)	
	oPDialog.setTitle("Petit test")	
	reInit()
'''''''''''''''''EXIT''''''''''''''''
	iDialogResult = oPDialog.Execute()	
End Sub

In the attached document, I have somewhat anticipated the arrival of the newcomers and although much remains to be done, the priority for the time being remains that set out in the title.
That is, how to create several dialog boxes that can be used at the same time.

Thank you for your attention.
Sincerely, Mark
Attachments
Kronos 2.0.ods
(21.69 KiB) Downloaded 189 times
Last edited by Makronos on Sat May 11, 2019 8:56 pm, edited 1 time in total.
Open Office 4.1.5
Windows 10
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Calc] Create several dialog boxes

Post by JeJe »

You can only have one modal dialog but you can have several non modal ones. If you replace your dialogBox sub with this it will create several dialogs. But why not have several instances of the stopwatch on a single dialog?

Code: Select all

Sub DialogBox
	Dim dDialog As Object	


	DialogLibraries.LoadLibrary("Standard")

for i = 0 to 3
	oDialog = DialogLibraries.Standard.Dialog1
	oPDialog = CreateUnoDialog(oDialog)	
	oPDialog.setTitle("Petit test")	
	reInit()
 oPDialog.setvisible(true)
  oPDialog.setpossize 200 * i,200 * i,0,0,3

next

wait 2000
End Sub

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Makronos
Posts: 3
Joined: Wed May 08, 2019 12:09 pm

Re: [Calc] Create several dialog boxes

Post by Makronos »

Good evening JeJe,
Thank you for your quick answer. I'll test your macro and keep you informed as soon as possible.
This is the first time I have created a dialog box and I will have to understand the mechanisms (modal, not modal).
Once again, thank you for opening my perspectives.

P.S: Several instances of stopwatches in the same dialog would be a good idea. But above all, I try to individualize the work of about forty people.
(with each one his start of the race, his arrival, his rest etc...).

Thank you for everything and see you soon!
Open Office 4.1.5
Windows 10
Makronos
Posts: 3
Joined: Wed May 08, 2019 12:09 pm

Re: [Solved] [Calc] Create several dialog boxes

Post by Makronos »

Hello Jeje,
I followed your advice and created a non-Modal dialog box. So I can have several of them.

The result is not exactly the desired one. (Many bugs...)
So I'm thinking about other alternatives.

Thank you very much for your help and see you soon.
Attachments
Kronos 3.2 test.ods
(15.82 KiB) Downloaded 201 times
Open Office 4.1.5
Windows 10
Post Reply