Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -3,55 +3,55 @@ import extensions;
public class MainWindow : SDIDialog
{
Button btmIncrement;
Button btmRandom;
Edit txtNumber;
Button btmIncrement;
Button btmRandom;
Edit txtNumber;
constructor new()
<= new()
{
btmIncrement := Button.new();
btmRandom := Button.new();
txtNumber := Edit.new();
constructor new()
<= super new()
{
btmIncrement := Button.new();
btmRandom := Button.new();
txtNumber := Edit.new();
self
.appendControl:btmIncrement
.appendControl:btmRandom
.appendControl:txtNumber;
self
.appendControl:btmIncrement
.appendControl:btmRandom
.appendControl:txtNumber;
self.Caption := "Rosseta Code";
self.setRegion(100, 100, 160, 120);
self.Caption := "Rosseta Code";
self.setRegion(100, 100, 180, 140);
txtNumber.setRegion(7, 7, 140, 25);
txtNumber.Caption := "0";
txtNumber.setRegion(20, 7, 140, 25);
txtNumber.Caption := "0";
btmIncrement.setRegion(7, 35, 140, 25);
btmIncrement.Caption := "Increment";
btmIncrement.onClick := (args){ self.onButtonIncrementClick() };
btmIncrement.setRegion(20, 35, 140, 25);
btmIncrement.Caption := "Increment";
btmIncrement.onClick := (args){ self.onButtonIncrementClick() };
btmRandom.setRegion(7, 65, 140, 25);
btmRandom.Caption := "Random";
btmRandom.onClick := (args){ self.onButtonRandomClick() };
}
btmRandom.setRegion(20, 65, 140, 25);
btmRandom.Caption := "Random";
btmRandom.onClick := (args){ self.onButtonRandomClick() };
}
private onButtonIncrementClick()
{
var number := txtNumber.Value.toInt();
private onButtonIncrementClick()
{
var number := txtNumber.Value.toInt();
number := number + 1;
self.changeTextBoxValue(number)
}
number := number + 1;
self.changeTextBoxValue(number)
}
private onButtonRandomClick()
{
if(messageDialog.showQuestion("Inf", "Really reset to random value?"))
{
self.changeTextBoxValue(randomGenerator.eval(99999999))
}
}
private onButtonRandomClick()
{
if(messageDialog.showQuestion("Inf", "Really reset to random value?"))
{
self.changeTextBoxValue(randomGenerator.nextInt(99999999))
}
}
private changeTextBoxValue(number)
{
txtNumber.Caption := number.toString()
}
private changeTextBoxValue(number)
{
txtNumber.Caption := number.toString()
}
}

View file

@ -0,0 +1,32 @@
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();
}
});
});
})
}