mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2026-02-10 12:35:36 +01:00
Author:halw
Date:2008-12-24T03:37:43.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@145 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -31,15 +31,15 @@ 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>
|
||||
{THREAD_POOL}.queue_user_work_item (create {WAIT_CALLBACK}.make (Current, $async_operation, l_async_operation_done))
|
||||
return := {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>
|
||||
l_async_operation_done.wait_one
|
||||
return := l_async_operation_done.wait_one
|
||||
</code> to close the application.
|
||||
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following .NET types:
|
||||
* <eiffel>THREAD_POOL</eiffel>
|
||||
* <eiffel>WAIT_CALLBACK</eiffel>
|
||||
* <eiffel>AUTO_RESET_EVENT</eiffel>
|
||||
|
||||
@@ -38,7 +38,7 @@ This application shows how to use the thread <eiffel>TIMER</eiffel>. The timer i
|
||||
</code>
|
||||
and calls the feature <eiffel>check_status</eiffel> that displays the message <code>"Checking Status."</code> every two seconds.
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following .NET types:
|
||||
* <eiffel>TIMER</eiffel>
|
||||
* <eiffel>TIMER_CALLBACK</eiffel>
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ The application uses two local external assemblies, math.dll and parserutils.dll
|
||||
|
||||
parserutils parses the command line entered, and checks if it is of the form operand1 operator operand2. math.dll calculates the actual result of the command line.
|
||||
|
||||
For the parserutils.dll, we have been obliged to introduce the prefix "parser_" to avoid conflicts between name classes.
|
||||
For the parserutils.dll, we have been obliged to introduce the prefix "PARSER_" to class names in this assembly in order to avoid conflicts between class names from this and other sources.
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
* <span><eiffel>BUTTON</eiffel></span>
|
||||
* <span><eiffel>TEXT_FIELD</eiffel></span>
|
||||
|
||||
@@ -23,11 +23,13 @@ To compile the example:
|
||||
|
||||
After launching the application, you will see a window displayed with a similar appearance to the one above. On the left side of the main window a date is displayed in a <span><eiffel>COMBO_BOX</eiffel></span>. Clicking on this <span><eiffel>COMBO_BOX</eiffel></span> and a <span><eiffel>CALENDAR</eiffel></span> control will appear showing the same date as in the <span><eiffel>COMBO_BOX</eiffel></span>. On the right side of the main window are the controls for selecting the format of the displayed date and the style of the <span><eiffel>CALENDAR</eiffel></span> control.
|
||||
|
||||
Clicking on the "Change font" button and a change font dialog box will appear. [[Image:change-font-dialog|change font dialog box]] .
|
||||
Clicking on the "Change font" button and a change font dialog box will appear.
|
||||
|
||||
Clicking on the "Change color" button and a dialog_box will appear. [[Image:dotnet-samples--date-time-picker-change-color-dlg|dialog box]]
|
||||
[[Image:change-font-dialog|change font dialog box]] .
|
||||
|
||||
It will permit you to customize the color appearance of the calendar though a color dialog box [[Image:dotnet-samples--date-time-picker-change-color-dlg|color dialog box]] .
|
||||
Clicking on the "Change color" button and a dialog box will appear. This dialog box will permit you to customize the color appearance of the calendar.
|
||||
|
||||
[[Image:dotnet-samples--date-time-picker-change-color-dlg|color dialog box]] .
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +41,7 @@ When one of the buttons "Change font" or "Change color" is pressed, an event is
|
||||
|
||||
When the entry in the <span><eiffel>COMBO_BOX</eiffel></span> format changes, an event is launched and modify the format of the displayed date.
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>CALENDAR</eiffel></span>
|
||||
* <span><eiffel>COMBO_BOX</eiffel></span>
|
||||
* <span><eiffel>BUTTON</eiffel></span>
|
||||
|
||||
@@ -29,7 +29,7 @@ After launching the application, you will see a window displayed with a similar
|
||||
|
||||
This sample show how to draw some text in a window, using different brushes, different fonts, different style and different colors.
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following class:
|
||||
* <eiffel>FORM</eiffel>
|
||||
|
||||
==Notes==
|
||||
|
||||
@@ -35,7 +35,7 @@ You can choose the organization (cascade, title horizontal or title vertical) of
|
||||
|
||||
This application demonstrates how to create a multiple document interface. More information regarding the use of a MDI, is available [[MDI Details|here]] .
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following class:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
|
||||
==Notes==
|
||||
|
||||
@@ -6,11 +6,13 @@ Multiple Document Interface (MDI) applications have a single, primary window (th
|
||||
==Creating an MDI Application==
|
||||
|
||||
You can create an MDI application by following these steps:
|
||||
# Create a '''Form''' ( '''MainForm''') that represents the MDI parent window and set its '''IsMdiContainer''' property to '''True'''. The following code demonstrates how to set this property.
|
||||
<code>set_is_mdi_container (True)</code>
|
||||
# Create a '''Form''' ('''MainForm''') that represents the MDI parent window and set its '''IsMdiContainer''' property to '''True'''. The following code demonstrates how to set this property.
|
||||
<code>
|
||||
set_is_mdi_container (True)</code>
|
||||
|
||||
# Create child forms and set the '''MdiParent''' property of each form to reference the parent form. The following code demonstrates setting the MDI parent for an instance of a child form. <br/>
|
||||
<code>doc.set_mdi_parent (Current)</code>
|
||||
<code>
|
||||
doc.set_mdi_parent (Current)</code>
|
||||
|
||||
|
||||
If you have different types of data to display, you can have multiple types of child forms. To display a child form, create an instance of the child form and call its '''Show''' method.
|
||||
@@ -20,13 +22,17 @@ If you have different types of data to display, you can have multiple types of c
|
||||
==Standard MDI Menus==
|
||||
|
||||
Typically, an MDI application has a '''Windows''' menu that allows the user to arrange the open child windows through tiling or cascading. The '''Windows''' menu also allows you to navigate to any of the open child windows. To create a '''Windows''' menu, add the menu items for tiling and cascading to a '''Windows''' menu in your parent form and set the '''MdiList''' property to '''True''' for the top-level '''Windows''' menu. The following code demonstrates how to create a '''Windows''' menu in an MDIapplication.
|
||||
<code>mi_window: WINFORMS_MENU_ITEM</code>
|
||||
<code>
|
||||
mi_window := main_menu.get_menu_items.add (("&Window").to_cil)
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler (("&Cascade").to_cil, create {EVENT_HANDLER}.make (Current, $window_cascade_clicked))
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler (("Tile &Horizontal").to_cil, create {EVENT_HANDLER}.make (Current, $window_tile_h_clicked))
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler (("Tile &Vertical").to_cil, create {EVENT_HANDLER}.make (Current, $window_tile_v_clicked))
|
||||
mi_window.set_mdi_list (True) -- Adds the MDI Window List to the bottom of the menu
|
||||
mi_window: WINFORMS_MENU_ITEM
|
||||
|
||||
...
|
||||
|
||||
mi_window := main_menu.get_menu_items.add ("&Window")
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler ("&Cascade", create {EVENT_HANDLER}.make (Current, $window_cascade_clicked))
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler ("Tile &Horizontal", create {EVENT_HANDLER}.make (Current, $window_tile_h_clicked))
|
||||
dummy := mi_window.get_menu_items.add_string_event_handler ("Tile &Vertical", create {EVENT_HANDLER}.make (Current, $window_tile_v_clicked))
|
||||
mi_window.set_mdi_list (True) -- Adds the MDI Window List to the bottom of the menu
|
||||
...
|
||||
</code>
|
||||
|
||||
|
||||
@@ -37,14 +43,18 @@ mi_window.set_mdi_list (True) -- Adds the MDI Window List to the bottom of the m
|
||||
|
||||
If you want your parent form to be notified when a child window is activated by the user, you can register an event-handling method for the '''MdiChildActivate''' event. You can determine which child window is active by using the '''ActiveMdiChild''' property of the '''Form''' class. For example, the following code updates a '''StatusBar''' control on the parent form with the name of the child window.
|
||||
<code>
|
||||
...
|
||||
add_mdi_child_activate (create {EVENT_HANDLER}.make (Current, $mdi_child_activated))
|
||||
...
|
||||
mdi_child_activated (sender: SYSTEM_OBJECT; e: EVENT_ARGS) is
|
||||
do
|
||||
status_bar.set_text (active_mdi_child.get_text)
|
||||
end
|
||||
...
|
||||
...
|
||||
|
||||
add_mdi_child_activate (create {EVENT_HANDLER}.make (Current, $mdi_child_activated))
|
||||
|
||||
...
|
||||
|
||||
mdi_child_activated (sender: SYSTEM_OBJECT; e: EVENT_ARGS)
|
||||
do
|
||||
status_bar.set_text (active_mdi_child.get_text)
|
||||
end
|
||||
|
||||
...
|
||||
</code>
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
After launching the application, you will see a window displayed with a similar appearance to the one above. The main window contains a main menu with two entries (File and Format).
|
||||
|
||||
The main window also has a blue <span>LABEL</span> that contains a context menu, that is the clone of "Format" in the main menu. Right click on the <span>LABEL</span> and a context menu will appear [[Image:menu-contextuel|context menu]] .
|
||||
The main window also has a blue <span>LABEL</span> that contains a context menu, that is the clone of "Format" in the main menu. Right click on the <span>LABEL</span> and a context menu will appear
|
||||
|
||||
[[Image:menu-contextuel|context menu]] .
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +24,7 @@ The main window also has a blue <span>LABEL</span> that contains a context menu,
|
||||
|
||||
This application shows how to create a main menu and how to associate a context menu to a control (here to a <span>LABEL)</span>. More information regarding the use of menus, is available [[Menu Details|here]] .
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following classes:
|
||||
* <span>FORM</span>
|
||||
* <span>CONTEXT_MENU</span>
|
||||
* <span>MAIN_MENU</span>
|
||||
|
||||
@@ -49,7 +49,7 @@ with the text contained in <eiffel>TEXT_BOX</eiffel>
|
||||
msg.append ("'")
|
||||
</code>
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
* <span><eiffel>BUTTON</eiffel></span>
|
||||
* <span><eiffel>TEXT_BOX</eiffel></span>
|
||||
|
||||
@@ -27,7 +27,7 @@ The application shows how to configure a <span><eiffel>PROGRESS_BAR</eiffel></sp
|
||||
|
||||
The feature <span>on_load</span> is redefined and launch a thread (<eiffel>THREAD_START</eiffel>) that simulates the progression of a process.
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>PROGRESS_BAR</eiffel></span>
|
||||
* <span><eiffel>GROUP_BOX</eiffel></span>
|
||||
* <span><eiffel>TRACK_BAR</eiffel></span>
|
||||
|
||||
@@ -39,7 +39,7 @@ Clicking on the right button (>|) will bring you on the last customer of the lis
|
||||
|
||||
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following class:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
|
||||
==Notes==
|
||||
|
||||
@@ -23,17 +23,17 @@ After launching the application, you will see a window displayed with a similar
|
||||
|
||||
==Under the Hood==
|
||||
|
||||
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>.
|
||||
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_text</eiffel></span>.
|
||||
<code>
|
||||
set_title (("Hello world").to_cil)
|
||||
set_text ("Hello world")
|
||||
</code>
|
||||
|
||||
The application is launched in a <eiffel>PROCESS</eiffel> with this command line:
|
||||
<code>
|
||||
feature {WINFORMS_APPLICATION}.run_form (Current).
|
||||
{WINFORMS_APPLICATION}.run_form (Current).
|
||||
</code>
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>FORM</eiffel></span>
|
||||
* <eiffel>WINFORMS_APPLICATION</eiffel>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ After launching the application, you will see a window displayed with a similar
|
||||
|
||||
The application shows how to use a <span><eiffel>TREE_VIEW</eiffel></span> and what are all its different configurations.
|
||||
|
||||
This sample contains the following classes:
|
||||
This sample uses the following classes:
|
||||
* <span><eiffel>TREE_VIEW</eiffel></span>
|
||||
* <span><eiffel>GROUP_BOX</eiffel></span>
|
||||
* <span><eiffel>CHECK_BOX</eiffel></span>
|
||||
|
||||
Reference in New Issue
Block a user