Skip to content

Commit 98178d4

Browse files
committed
Add 'other controls' section to Interface example
1 parent 53bbea7 commit 98178d4

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

R/examples.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ interfaceExample <- function(jaspResults, dataset, options) {
1313
paste(gettextf("<br> The radio buttons are set to: %s", as.character(options$radio_buttons)))
1414
)
1515

16+
jaspResults[["others"]] <- createJaspHtml(
17+
title = "Other controls",
18+
text = aux |>
19+
paste(gettextf("The chosen dropdown element is: %s", as.character(options$my_dropdown))) |>
20+
paste(gettextf("<br> The slider value is: %s", as.character(options$my_slider)))
21+
)
22+
1623
jaspResults[["keyboard"]] <- createJaspHtml(
1724
title = "Keyboard controls",
1825
text = aux |>
1926
paste(gettextf("The integer is set to: %s", as.character(options$my_integer), sep = "")) |>
2027
paste(gettextf("<br> The double is set to: %s", as.character(options$my_double), sep = ". ")) |>
2128
paste(gettextf("<br> The percentage is set to: %s", as.character(options$my_percent), sep = ". ")) |>
29+
paste(gettextf("<br> The confidence interval is set to: %s", as.character(options$my_ci), sep = ". ")) |>
2230
paste(gettextf("<br> The text box is set to: <i>%s</i>", options$my_text, sep = ". "))
2331
)
2432

inst/qml/Interface.qml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,38 @@ Form
6363
}
6464
}
6565

66+
Group
67+
{
68+
title: qsTr("Other controls")
69+
70+
DropDown
71+
{
72+
info: qsTr("This is a dropdown that can be used to select one of a list of options")
73+
74+
name: "my_dropdown"
75+
label: qsTr("Select an option")
76+
77+
// We can add some extra control parameters
78+
values: ["option 1", "option 2", "option 3"]
79+
}
80+
81+
Slider
82+
{
83+
84+
info: qsTr("This is a slider that can be used to select a value in a range")
85+
86+
name: "my_slider"
87+
label: qsTr("Select a value")
88+
89+
// We can add some extra control parameters
90+
min: 0
91+
max: 1
92+
value: 0.5
93+
decimals: 3
94+
vertical: false
95+
}
96+
}
97+
6698
Group
6799
{
68100
title: qsTr("Keyboard inputs")
@@ -103,6 +135,14 @@ Form
103135
label: qsTr("Input a percentage")
104136
}
105137

138+
CIField
139+
{
140+
info: qsTr("This is the number that will be used in the operation")
141+
142+
name: "my_ci"
143+
label: qsTr("Input a confidence interval")
144+
}
145+
106146
TextField
107147
{
108148
info: qsTr("This is a text field that can be used to input any text")

0 commit comments

Comments
 (0)