PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/widget/check_button_demo.e

http://github.com/tybor/Liberty
Specman e | 33 lines | 27 code | 5 blank | 1 comment | 1 complexity | 647b332e09a325eba83a52cafdc1b5d2 MD5 | raw file
 1class CHECK_BUTTON_DEMO
 2	-- Show how to use CHECK_BUTTON.
 3
 4inherit
 5	GRAPHIC
 6
 7creation {ANY}
 8	make
 9
10feature {}
11	make is
12		local
13			toplevel_window: TOPLEVEL_WINDOW; check_button: CHECK_BUTTON
14		do
15			create toplevel_window.default_create
16			toplevel_window.when_close_requested(agent vision.loop_stack.break)
17			toplevel_window.set_background_color(white_color)
18			create check_button.with_label(toplevel_window, U"I'm happy")
19			check_button.when_value_change(agent print_state)
20			toplevel_window.map
21			vision.start
22		end
23
24	print_state (happy: BOOLEAN) is
25		do
26			if happy then
27				io.put_string(once "I'm happy%N")
28			else
29				io.put_string(once "I'm not happy%N")
30			end
31		end
32
33end -- class CHECK_BUTTON_DEMO