Message Box

Hello world form
Hello world form


Compiling

To compile the example:

  1. Launch EiffelStudio.
  2. Click Add project
  3. Browse to $ISE_EIFFEL\examples\dotnet\winforms\hello_world_dlg\
  4. Choose hello_world_dlg.ecf
  5. Choose the location where the project will be compiled, by default the same directory containing the configuration file.
  6. Click Open.

Running

After launching the application, you will see a window displayed with a similar appearance to the one above.

Click on the BUTTON "Click Me!" and a message box will appear with the text that you have entered in the TEXT_BOX.

Under the Hood

The application shows how to use the very useful MESSAGE_BOX control.

An event ( EVENT_HANDLER) is associated to a control (here to the BUTTON). So the line my_button.add_click (create {EVENT_HANDLER}.make (Current, $on_my_button_clicked ))associates a click to my_button to the feature on_my_button_clicked. So every time the BUTTON my_button is clicked, the feature on_my_button_clicked is executed.

The feature my_button_clicked displays a MESSAGE_BOX {WINFORMS_MESSAGE_BOX}.show (msg) with the text contained in TEXT_BOX msg := "Text is : '" msg.append (my_text_box.text) msg.append ("'")

This sample uses the following classes:

  • FORM
  • BUTTON
  • TEXT_BOX
  • EVENT_HANDLER

Notes

This sample is translated from the example located in the QuickStart\winforms\samples\accessible subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio.NET.

cached: 12/20/2024 11:55:15.000 PM