Online Eiffel Documentation |
Documentation Home > Class Libraries > EiffelVision 2 > EiffelVision Interface Content |
EiffelStudio |
Kernel |
The kernel cluster contains classes that provide functionality that are common to most Windowed application. These classes are considered the core, or kernel of any Vision2 application. The most important of these classes is EV_APPLICATION. This is used to initialize the graphical toolkit and event loop of your Vision2 application. Kernel also includes classes such as EV_TIMEOUT that calls procedures (via agents) at a set interval, and EV_COLOR which is used for coloring widgets and items. To start programming with Vision2, you first have to correctly initialize EV_APPLICATION.
EV_APPLICATION is the basis for every Vision2 application and is considered the most important class in the library. It is responsible for initializing the underlying toolkit that is driving the windowing system on the platform that you decide to compile your system on. It also also where the main event loop that drives your application is executed.
Note: It is not possible to create a Vision2 component unless an application exists (query EV_ENVIRONMENT).
You may inherit EV_APPLICATION or use it as a client in order to create your vision2 application. A simple method of using EV_APPLICATION is as follows:An example of a Vision2 application using inheritance from EV_APPLICATION is shown below.
class HELLOWORLD_APP inherit EV_APPLICATION create make feature make is -- Create the application. local helloworld_window: EV_TITLED_WINDOW do default_create create helloworld_window helloworld_window.set_title ("Helloworld!") helloworld_window.close_request_actions.extend (agent destroy) helloworld_window.show launch end end
This is the same Vision2 application but instead using EV_APPLICATION in a client/supplier relationship.
class HELLOWORLD_APP create make feature make is -- Create the Vision2 application with a helloworld window. local app: EV_APPLICATION helloworld_window: EV_TITLED_WINDOW do create app create helloworld_window helloworld_window.set_title ("Helloworld!") helloworld_window.close_request_actions.extend (agent app.destroy) helloworld_window.show app.launch end end
Note: A Vision2 system is event based. This means that you do not have control of the execution within a Vision2 system, but must respond appropriately to events as they occur. Therefore, if you call launch on an EV_APPLICATION, the processing for the application will continue indefinitely unless you have provided a way to exit the application. It is essential to initialize your components correctly, so your application can be exited (call destroy on the application).
Now that you have a basic application skeleton set up you can now go about
Once you have learnt the basics of GUI programming within Vision2, you are well on the way to creating powerful multi-platform applications. The Application Programming Interface (API) of Vision2 has been designed in a way to ensure that the library is as intuitive, consistent and stylistic as possible. Heavy reuse of components from EiffelBase has been one of the main reasons that made this possible.
Copyright 1993-2006 Eiffel Software. All rights reserved. |