User Tools

Site Tools


en:code:examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:code:examples [2024/11/24 12:44] richarden:code:examples [2024/11/24 12:52] (current) richard
Line 1: Line 1:
-===example for selection and it goes to another line.===+===Show a custom dialog box===
 <code javascript> <code javascript>
-var stuff { +var window new QDialog(); 
-    "no": "no", +var layout = new QFormLayout(window); 
-    "yes": "yes" +var nameLineEdit = new QLineEdit(window)
-}; +var ageSpinBox = new QSpinBox(window)
-// choice no or yes. +var buttonBox = new QDialogButtonBox(window); 
-var choice+ 
-var dialogforAntiRaid = new InputDialog({ +buttonBox.addButton(QDialogButtonBox.Ok); 
-    title: "Anti-Raid-System #1", +buttonBox.addButton(QDialogButtonBox.Cancel)
-    inputType: InputDialog.Items, + 
-    items: ["no", "yes"], +buttonBox.accepted.connect(window.accept); 
-    onValueChanged: function (items{ +buttonBox.rejected.connect(window.reject); 
-        choice = stuff[items]+ 
-    } +layout.addRow("Name:"nameLineEdit); 
-}); +layout.addRow("Age:", ageSpinBox); 
-// Variable Conditionif true go to line 1if false go to line 10. +layout.addRow(buttonBox)
-if (choice == "yes"{ + 
-    Script.nextLine = 1+if(window.exec() == QDialog.Accepted) 
-} else { + MessageBox().setText("Your name is " + nameLineEdit.text + "\nYou are " + ageSpinBox.value + " years old.").showModal();
-    Script.nextLine 10; +
-}+
 </code> </code>
en/code/examples.txt · Last modified: 2024/11/24 12:52 by richard