Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Smarteiffel
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 892 of 930
Post > Topic >>

Smarteiffel

by Jean RUPPERT <ruppertj@[EMAIL PROTECTED] > Oct 27, 2007 at 09:44 PM

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
 




 2 Posts in Topic:
Smarteiffel
Jean RUPPERT <ruppertj  2007-10-27 21:44:13 
Re: Smarteiffel
llothar <llothar@[EMAI  2007-10-30 04:24:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 22:14:14 CDT 2008.