mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 23:02:28 +01:00
Author:halw
Date:2008-12-21T21:14:24.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@143 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -31,8 +31,7 @@ When the display is finished, the application wait for you to pressed the return
|
||||
This application shows how to use the thread <eiffel>THREAD_POOL</eiffel>.
|
||||
An asynchronous thread is launched:
|
||||
<code>
|
||||
feature {THREAD_POOL}.queue_user_work_item_wait_callback_object
|
||||
(create {WAIT_CALLBACK}.make (Current, $my_async_operation, l_async_operation_done))
|
||||
{THREAD_POOL}.queue_user_work_item (create {WAIT_CALLBACK}.make (Current, $async_operation, l_async_operation_done))
|
||||
</code>
|
||||
and is associated to the local variable <code>l_async_operation_done</code>. Both threads perform simultaneously some operations. The main thread wait for the asynchronous thread to complete his own operations
|
||||
<code>
|
||||
|
||||
@@ -34,11 +34,11 @@ When the display is finished, the application wait for you to pressed the return
|
||||
|
||||
This application shows how to use the thread <eiffel>TIMER</eiffel>. The timer is launched:
|
||||
<code>
|
||||
create my_timer </code>.make_with_callback (create {TIMER_CALLBACK}.make (Current, $check_status), Void, 0, 2000)
|
||||
create my_timer.make_with_callback (create {TIMER_CALLBACK}.make (Current, $check_status), Void, 0, 2000)
|
||||
</code>
|
||||
and call the feature <eiffel>check_status</eiffel> that displays the message <code> "Checking Status." </code> every two seconds.
|
||||
and calls the feature <eiffel>check_status</eiffel> that displays the message <code>"Checking Status."</code> every two seconds.
|
||||
|
||||
This sample contains the following class:
|
||||
This sample contains the following classes:
|
||||
* <eiffel>TIMER</eiffel>
|
||||
* <eiffel>TIMER_CALLBACK</eiffel>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ To compile the example:
|
||||
|
||||
After launching the application, you will see a window displayed with a similar appearance to the one above.
|
||||
|
||||
Click on the <span><eiffel>BUTTON</eiffel></span> "Click Me!" and a message box will appear with the text that you have entered in the <span><eiffel>TEXT_FIELD</eiffel></span>.
|
||||
Click on the <span><eiffel>BUTTON</eiffel></span> "Click Me!" and a message box will appear with the text that you have entered in the <span><eiffel>TEXT_BOX</eiffel></span>.
|
||||
|
||||
|
||||
|
||||
@@ -32,16 +32,27 @@ Click on the <span><eiffel>BUTTON</eiffel></span> "Click Me!" and a message box
|
||||
|
||||
The application shows how to use the very useful <span><eiffel>MESSAGE_BOX</eiffel></span> control.
|
||||
|
||||
An event ( <span><eiffel>EVENT_HANDLER</eiffel>)</span> is associated to a control (here to the <span><eiffel>BUTTON</eiffel></span>). So the line '
|
||||
<code>my_button.add_click (create {EVENT_HANDLER}.make (Current, $on_my_button_clicked ))</code>
|
||||
An event ( <span><eiffel>EVENT_HANDLER</eiffel>)</span> is associated to a control (here to the <span><eiffel>BUTTON</eiffel></span>). So the line
|
||||
<code>
|
||||
my_button.add_click (create {EVENT_HANDLER}.make (Current, $on_my_button_clicked ))</code>
|
||||
associates a click to <span>my_button</span> to the feature <span><eiffel>on_my_button_clicked</eiffel></span>. So every time the <span>BUTTON</span> <span><eiffel>my_button</eiffel></span> is clicked, the feature <span>on_my_button_clicked</span> is executed.
|
||||
|
||||
The feature <span><eiffel>my_button_clicked</eiffel></span> displays a <span><eiffel>MESSAGE_BOX</eiffel></span> ( <span>feature</span> { <span>WINFORMS_MESSAGE_BOX</span>}. <span><eiffel>show</eiffel></span> ( ''msg'')) with the text contained in <span><eiffel>TEXT_FIELD</eiffel></span> ( ''msg'' := <span><eiffel>my_text_field</eiffel></span>. <span><eiffel>text</eiffel></span>).
|
||||
|
||||
The feature <span><eiffel>my_button_clicked</eiffel></span> displays a <span><eiffel>MESSAGE_BOX</eiffel></span>
|
||||
<code>
|
||||
{WINFORMS_MESSAGE_BOX}.show (msg)
|
||||
</code>
|
||||
with the text contained in <eiffel>TEXT_BOX</eiffel>
|
||||
<code>
|
||||
msg := "Text is : '"
|
||||
msg.append (my_text_box.text)
|
||||
msg.append ("'")
|
||||
</code>
|
||||
|
||||
This sample contains the following classes:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
* <span><eiffel>BUTTON</eiffel></span>
|
||||
* <span><eiffel>TEXT_FIELD</eiffel></span>
|
||||
* <span><eiffel>TEXT_BOX</eiffel></span>
|
||||
* <span><eiffel>EVENT_HANDLER</eiffel></span>
|
||||
|
||||
==Notes==
|
||||
|
||||
@@ -25,12 +25,12 @@ After launching the application, you will see a window displayed with a similar
|
||||
|
||||
The application shows how to display a Windows Form under the windows environment. The application inherits the <span><eiffel>FORM</eiffel></span> class, and just set the title with <span><code>"Hello world"</code></span> with the inherited feature <span><eiffel>set_title</eiffel></span>.
|
||||
<code>
|
||||
set_title (("Hello world").to_cil)
|
||||
set_title (("Hello world").to_cil)
|
||||
</code>
|
||||
|
||||
The application is launched in a <eiffel>PROCESS</eiffel> with this command line:
|
||||
<code>
|
||||
feature {WINFORMS_APPLICATION}.run_form (Current).
|
||||
feature {WINFORMS_APPLICATION}.run_form (Current).
|
||||
</code>
|
||||
|
||||
This sample contains the following classes:
|
||||
|
||||
Reference in New Issue
Block a user