Add feature to ignore some input bytes
[jpcrr.git] / lua / windowtest.lua
blob9fb71973882d0db1e62df8404e74225338db5f42
1 win = jpcrr.window.create("test from Lua");
2 win:create_component({gridx = 0, gridy = 0, gridwidth = 1, gridheight = 1, name = "label1", type = "label", text = "foo"});
3 win:create_component({gridx = 1, gridy = 0, gridwidth = 1, gridheight = 1, name = "text1", type = "textfield", text = "", columns = 40});
4 win:create_component({gridx = 0, gridy = 1, gridwidth = 1, gridheight = 1, name = "label2", type = "label", text = "bar"});
5 win:create_component({gridx = 1, gridy = 1, gridwidth = 1, gridheight = 1, name = "text2", type = "textfield", text = "", columns = 40});
6 win:create_component({gridx = 0, gridy = 2, gridwidth = 1, gridheight = 1, name = "label3", type = "label", text = "baz"});
7 win:create_component({gridx = 1, gridy = 2, gridwidth = 1, gridheight = 1, name = "text3", type = "textfield", text = "", columns = 40});
8 win:create_component({gridx = 0, gridy = 3, gridwidth = 2, gridheight = 1, name = "button1", type = "button", text = "zot"});
9 win:create_component({gridx = 0, gridy = 4, gridwidth = 2, gridheight = 1, name = "checkbox1", type = "checkbox", text = "foobar"});
10 win:show();
11 win:disable("text2");
12 win:select("checkbox1");
14 while true do
15 mtype, message = jpcrr.wait_event();
16 if mtype == "lock" then
17 jpcrr.release_vga();
18 else
19 if message then
20 print("Got '" .. mtype .. "'['" .. message .. "'].")
21 else
22 print("Got '" .. mtype .. "'[<no message>].")
23 end
24 end
25 end