Page 1 of 1

Custom Dialog "Cancel" pressed , default value

Posted: Fri Jun 09, 2023 11:19 am
by gremlin
Hy,

how can I set a default value to all "Text Edit" fields, when "cancel" is pressed ?
Snipaste_2023-06-09_12-18-20.png
Snipaste_2023-06-09_12-18-20.png (20.76 KiB) Viewed 5858 times
I had 3 "Text Edit" fields, which need to be filled (laenge,breite,hoehe)

Thanks
Steven

Re: Custom Dialog "Cancel" pressed , default value

Posted: Fri Jun 09, 2023 12:08 pm
by Oleg
When you press "Cancel" you can assign some value that indicates that Cancel pressed.
You can analyze this value without stopping the task
If you want to use some default values you should specify default values in field configuration. You just should press OK or Enter key to confirm the values.
Look at my example below

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|327819672
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1435"
Hide=INTEGER|0
ID=INTEGER|-898468420
LogOnAsUser=INTEGER|1
Name=STRING|"Custom Input Dialog Example"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_CUSTOM_INPUT_DIALOG"
Enabled=INTEGER|-1
Name=STRING|"Custom Input Dialog"
Params=FOLDER

[Actions\Action1\Params]
default_value=STRING|"none"
dialog_caption=STRING|"Input Dialog"
dialog_height=STRING|"400"
dialog_width=STRING|"400"
field_count=STRING|"3"
field0=STRING|"{""type"":""CustomInputDialog"",""version"":""1.0"",""fieldGroups"":[{""caption"":""Field Properties"",""showCaption"":false,""fields"":[{""type"":""Simple Edit"",""labelText"":""Field Name:"",""name"":""name"",""value"":""value1""},{""type"":""Simple Edit"",""labelText"":""Caption:"",""name"":""labelText"",""value"":""Text Edit 1:""},{""type"":""Simple Edit"",""labelText"":""Default Value:"",""name"":""value"",""value"":""aaaa""},{""type"":""Checkbox"",""labelText"":""Password Input"",""name"":""passwordInput"",""value"":false},{""type"":""Checkbox"",""labelText"":""Numbers only"",""name"":""numbersOnly"",""value"":false},{""type"":""Checkbox"",""labelText"":""Required"",""name"":""required"",""value"":false}]}],""className"":""Text Edit"",""fieldName"":""value1""}"
field1=STRING|"{""type"":""CustomInputDialog"",""version"":""1.0"",""fieldGroups"":[{""caption"":""Field Properties"",""showCaption"":false,""fields"":[{""type"":""Simple Edit"",""labelText"":""Field Name:"",""name"":""name"",""value"":""value2""},{""type"":""Simple Edit"",""labelText"":""Caption:"",""name"":""labelText"",""value"":""Text Edit 2:""},{""type"":""Simple Edit"",""labelText"":""Default Value:"",""name"":""value"",""value"":""bbb""},{""type"":""Checkbox"",""labelText"":""Password Input"",""name"":""passwordInput"",""value"":false},{""type"":""Checkbox"",""labelText"":""Numbers only"",""name"":""numbersOnly"",""value"":false},{""type"":""Checkbox"",""labelText"":""Required"",""name"":""required"",""value"":false}]}],""className"":""Text Edit"",""fieldName"":""value2""}"
field2=STRING|"{""type"":""CustomInputDialog"",""version"":""1.0"",""fieldGroups"":[{""caption"":""Field Properties"",""showCaption"":false,""fields"":[{""type"":""Simple Edit"",""labelText"":""Field Name:"",""name"":""name"",""value"":""value3""},{""type"":""Simple Edit"",""labelText"":""Caption:"",""name"":""labelText"",""value"":""Text Edit 3:""},{""type"":""Simple Edit"",""labelText"":""Default Value:"",""name"":""value"",""value"":""ccc""},{""type"":""Checkbox"",""labelText"":""Password Input"",""name"":""passwordInput"",""value"":false},{""type"":""Checkbox"",""labelText"":""Numbers only"",""name"":""numbersOnly"",""value"":false},{""type"":""Checkbox"",""labelText"":""Required"",""name"":""required"",""value"":false}]}],""className"":""Text Edit"",""fieldName"":""value3""}"
grid_lines=STRING|"1"
label_column_width=STRING|"140"
save_to=STRING|"DialogResult"
stop_if_cancel=STRING|"0"
vertical_layout=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"none"
value2=STRING|"{DialogResult}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Cancel pressed!!"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"3"
msg0=STRING|"Cancel pressed!!"
msg1=STRING|"No data"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Ok pressed"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"Ok pressed"
msg1=STRING|"data: {DialogResult}"
msg2=STRING|"Value1 = {json:DialogResult.value1}"
msg3=STRING|"Value2 = {json:DialogResult.value2}"
msg4=STRING|"Value3 = {json:DialogResult.value3}"
msgcount=STRING|"5"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"


Re: Custom Dialog "Cancel" pressed , default value

Posted: Fri Jun 09, 2023 1:44 pm
by gremlin
Ok, thank you. Now I understand how it works.