-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathled.rs
33 lines (28 loc) · 917 Bytes
/
led.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// hello1.rs example written in LED.
#[macro_use]
extern crate iup;
use iup::prelude::*;
use iup::Handle;
use iup::control::Button;
use iup::led;
fn main () {
iup::with_iup(|| {
// See also led::load(path) to load from a file
led::load_buffer(r######"
# This is a LED comment.
btn = button[EXPAND=YES, TIP="Exit button"]("Ok", 0)
dlg = dialog[TITLE="Hello"]
(
vbox[GAP=10, MARGIN=10x10, ALIGNMENT=ACENTER]
(
label("Hello, world!"),
btn
)
)
"######).unwrap();
let mut dialog = Dialog::from_handle(Handle::from_named("dlg").unwrap()).unwrap();
let mut button = Button::from_handle(Handle::from_named("btn").unwrap()).unwrap();
button.set_action(|_| CallbackReturn::Close);
dialog.show()
}).unwrap();
}