[Solved] [Calc] Create several dialog boxes

Creating a macro - Writing a Script - Using the API

[Solved] [Calc] Create several dialog boxes

Postby Makronos » Wed May 08, 2019 2:34 pm

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   Expand viewCollapse view
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 17 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
Makronos
 
Posts: 3
Joined: Wed May 08, 2019 12:09 pm

Re: [Calc] Create several dialog boxes

Postby JeJe » Wed May 08, 2019 4:27 pm

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   Expand viewCollapse view
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

Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 507
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Calc] Create several dialog boxes

Postby Makronos » Wed May 08, 2019 10:35 pm

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

Postby Makronos » Sat May 11, 2019 9:16 pm

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 20 times
Open Office 4.1.5
Windows 10
Makronos
 
Posts: 3
Joined: Wed May 08, 2019 12:09 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests