Last modified by writer on 2023/09/12 16:59

Hide last authors
Edgar Allan Poe 4.1 1 {{info title="**Attention!**"}}
2 Calling dialog windows from macros has been available since PUMOTIX 3.5.0. Earlier versions do not support this functionality.
writer 1.1 3 {{/info}}
4
Edgar Allan Poe 4.1 5 Dialog boxes allow the user to send values to the macro from the program interface (before that there were several parameters that can be sent using a G-code string).
writer 1.1 6
Edgar Allan Poe 4.1 7 The function of calling a dialog window is implemented through the **ShowDialogSimple()** command. It is designed to call a window that has a text description and several fields for entering a value.
writer 1.1 8
Edgar Allan Poe 4.1 9 An example of calling the **ShowDialogSimple()** function:
writer 1.1 10
11 {{code language="lua"}}
Edgar Allan Poe 4.1 12 local res,out1,out2 = ShowDialogSimple("Enter parameters","","")
writer 1.1 13 {{/code}}
14
Edgar Allan Poe 4.1 15 The result of this command is shown in the screenshot.
writer 1.1 16
Edgar Allan Poe 4.1 17 [[image:PUMOTIX_Dialog_en.png||data-xwiki-image-style-alignment="center" height="250" width="305"]]
writer 1.1 18
Edgar Allan Poe 4.1 19 A general function template:
writer 1.1 20
21 {{code language="lua"}}
22 Bool result, String out1, String out2, ... ,String outn =
23 ShowDialogSimple(String label, String in1, ... ,String inn);
24 {{/code}}
25
Edgar Allan Poe 4.1 26 |**Bool result**|a variable that takes on the value //true// if the "OK" button was clicked and //false// if the "Cancel" button was clicked.
27 |**String out1,String out2,..., String outn**|the values of the fields that were filled in in the dialog window.
28 |**String label**|a string with a description that will appear in the called window.
29 |**String in1, ...,String inn**|strings with values that will be filled fields by default. Count of fields that will be displayed in the dialog window depends on the number of values among the function arguments **in1, in2, ... , inn**.
writer 1.1 30
Edgar Allan Poe 4.1 31 The function can also output simple **yes/no** queries. To do this, it is enough to add one parameter which will be displayed as text and request the result into a variable. Example:
writer 1.1 32
33 {{code language="lua"}}
Edgar Allan Poe 4.1 34 local res = ShowDialogSimple("An error has occurred. Complete the task anyway?")
writer 1.1 35 {{/code}}