Dear all,
I want to write a (smart)eiffel program, where I want to
launch some graphical windows from within the command line.
The following graphic hello_world program included with
smarteiffel works perfectly. In particular I can close the
toplevel window.
class HELLO
inherit
GRAPHIC
creation {ANY}
make
feature {}
toplevel_window: TOPLEVEL_WINDOW
make is
local
label: LABEL
do
create toplevel_window.default_create
toplevel_window.set_title("Hello World")
toplevel_window.set_background_color(white_color)
toplevel_window.map
-- put the window on the screen; may be done later
create label.make(U"Hello World !")
toplevel_window.child_attach(label)
-- register procedure to call on user requests on 'quit'
toplevel_window.when_close_requested(
agent vision.loop_stack.break)
-- start the event loop. The event loop executes registred
-- behavior for user actions.
-- It will stop when break is called
--(vision.loop_stack.break).
vision.start
io.put_string("The end%N")
end
end -- class HELLO
However the following modification of the graphic hello world programm
does no work.
class TEXT_GRAPHIC_HELLO
inherit
GRAPHIC
-- Give access to constants (vision, colors...)
creation {ANY}
make
feature {ANY}
make is
local
input: STRING
label: LABEL
do
std_input.read_line
from input:=std_input.last_string until input.is_equal("quit")
loop
create toplevel_window.default_create
toplevel_window.set_title("Hello World")
toplevel_window.set_background_color(white_color)
toplevel_window.map
create label.make(U"Hello")
toplevel_window.child_attach(label)
-- register procedure to call on user requests on 'quit'
toplevel_window.when_close_requested(
agent vision.loop_stack.break)
vision.start
std_input.read_line
input:=std_input.last_string
end
end
toplevel_window: TOPLEVEL_WINDOW
end -- class TEXT_GRAPHIC_HELLO
This program compiles perfectly on debian gnu linux etch on
smarteiffel 2.3. It is also possible to start it, on the
commandline you can then enter a command different to quit,
the hello world window will then pop up, however it is
impossible to close it. It seems to me that
"toplevel_window.when_close_requested(agent vision.loop_stack.break)"
does not work. Can anyone help me
Thanks
Jean