Anonymous user
GUI component interaction: Difference between revisions
m
→{{header|Elena}}
imported>Arakov |
|||
(7 intermediate revisions by 5 users not shown) | |||
Line 13:
{{omit from|Lotus 123}}
{{omit from|Maxima}}
{{omit from|Minimal BASIC|It does not handle GUI}}
{{omit from|Nascom BASIC|It does not handle GUI}}
{{omit from|PARI/GP}}
{{omit from|PostScript}}
{{omit from|Retro}}
{{omit from|SQL PL|It does not handle GUI}}
{{omit from|Tiny BASIC|It does not handle GUI}}
{{omit from|Palo Alto Tiny BASIC|It does not handle GUI}}
Almost every application needs to communicate with the user in some way.
Line 332 ⟶ 335:
; a timer.</syntaxhighlight>
=={{header|
==={{header|BaCon}}===
Requires BaCon version 4.0.1 or higher, using GTK3.
<syntaxhighlight lang="bacon">OPTION GUI TRUE
Line 371 ⟶ 375:
WEND</syntaxhighlight>
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
<syntaxhighlight lang="bbcbasic"> INSTALL @lib$+"WINLIB2"
Line 892 ⟶ 896:
=={{header|Elena}}==
ELENA
<syntaxhighlight lang="elena">import forms;
import extensions;
Line 898 ⟶ 902:
public class MainWindow : SDIDialog
{
}</syntaxhighlight>
=={{header|Euphoria}}==
Line 3,147 ⟶ 3,092:
end</syntaxhighlight>
[[File:GuiComponentRunBasic.png]]
== {{Header|Rust}} ==
{{libheader|egui}}
<syntaxhighlight lang="rust">
use eframe::egui;
use rand::Rng;
fn main() -> Result<(), eframe::Error> {
let options = eframe::NativeOptions {
initial_window_size: Some(egui::vec2(214.0, 100.0)),
..Default::default()
};
// Our application state:
let mut value = "0".to_owned();
eframe::run_simple_native("GUI component interaction", options, move |ctx, _frame| {
egui::CentralPanel::default().show(ctx, |ui| {
ui.horizontal(|ui| {
let name_label = ui.label("Value: ");
ui.text_edit_singleline(&mut value)
.labelled_by(name_label.id);
});
ui.horizontal(|ui| {
if ui.button("Increment").clicked() {
if let Ok(v) = value.parse::<usize>() {
value = (v + 1).to_string()
}
}
if ui.button("Random").clicked() {
value = (rand::thread_rng().gen_range(1..=10000)).to_string();
}
});
});
})
}</syntaxhighlight>
[[File:Rust GUI component interaction.png|none|thumb]]
=={{header|Scala}}==
Line 3,414 ⟶ 3,396:
Graphical
Notes:
1) "v install ui" to get, also to locally check source and examples.
2) For alternative UI toolkits, check github.com/vlang/awesome-v (Awesome V).
<syntaxhighlight lang="Zig">
import ui
Line 3,424 ⟶ 3,410:
win_height = 40
)
[heap]
struct App {
Line 3,471 ⟶ 3,458:
fn (mut app App) btn_click_inc(mut btn ui.Button) {
for value in app.counter {
if value.is_digit() == false {
Line 3,486 ⟶ 3,472:
fn (mut app App) btn_click_ran(mut btn ui.Button) {
ui.message_box("Will jump to random number between 1 and 100.")
app.counter = rand.int_in_range(1, 100) or {0}.str()
Line 3,628 ⟶ 3,613:
{{libheader|DOME}}
{{libheader|Wren-polygon}}
<syntaxhighlight lang="
import "input" for Mouse, Keyboard
import "dome" for Window
|