Reference Manual

  • 15.0
  • 07/23/2021
  • Public Content
Contents

Using the Resource Editor to Design a Dialog Box

You design the appearance of the dialog box, choose and name the dialog controls within it, and set other control properties with the Dialog Editor. The Dialog Editor is one of the Resource Editors provided by the Microsoft Visual Studio* integrated development environment (IDE).
The Dialog Editor is not available from the Visual Studio Shell.
A program's resources are defined in a resource file (typically with an .rc extension). A Microsoft Visual Studio project typically contains a single resource file. The contents of the resource file are displayed in the Resource Editor by double-clicking on the .RC file. The resource file can be created by one of the following:
  • When you create a project and use one of the Fortran AppWizards (for example, when using the Fortran Windows Application AppWizard).
  • When you save the resources that you define using one of the Resource Editors.
If you create the resource file from the Resource Editors, be sure to add the resource file to your project. It is possible to include additional resource files in a project (see Including Resources Using Multiple Resource Files).
This section describes the steps needed to design a dialog box, and uses as an example a dialog box that converts temperatures between Celsius and Fahrenheit. The code in the example is explained as you read through this section.
In this section, there is an example of how to include the dialog box in a Fortran Console project.
To create a Fortran Console application:
  1. From the
    File
    menu, select
    New>Project..
    .
  2. Select the Intel(R) Fortran Projects item.
  3. From the list of project types, select Console Application.
  4. Enter
    Temp
    as the name for the project, verify where the project will be created, and click OK.
  5. In the Fortran Console Application Wizard, click Finish.
  6. The Solution View displays the solution.
  7. Click the plus sign (+) next to the project name to display the categories of source files, if necessary .
To open the Dialog Editor:
  1. From the
    File
    menu, select
    Add New Item...
  2. Select
    Resource
    and change the name to
    Temp.rc
    . Click
    Open
    .
  3. Right-click on the .rc file in the Solution View, select
    Open With>Resource Editor
    .
  4. From the
    Edit
    >menu, select
    Add Resource..
    . From the list of possible resources, select
    Dialog
    .
  5. Click the New button. The Dialog Editor (one of the resource editors) appears on the screen as shown below.
Dialog Editor Sample 1
A blank dialog box appears along with a toolbox of available controls. If the toolbox does not appear, select
View>Toolbox
.
The controls that are supported by Intel Visual Fortran follow:
Button
Check box
Combo box
(such as a drop-down list box)
Edit box
Group box
List box
Picture
Progress bar
Radio button
Scroll bar, horizontal
Scroll bar, vertical
Slider
Spin control
Static text
Tab control
You can also add ActiveX* controls to your dialog box (see Using ActiveX* Controls Overview).
To add controls to the dialog box:
  1. Point at one of the available controls in the Toolbox, then hold down the left mouse button and drag the control to the dialog box.
  2. Place the dialog control where you want it on the dialog box and release the mouse button. You can delete controls by selecting them with the mouse, then pressing the Delete (or DEL) key.
The following figure shows the dialog box after adding two Static text lines (which currently say "Static"), two Edit boxes (which currently say "Sample edit"), a Horizontal Scroll bar, and a Group box. The Group box is the outlined rectangular area in the dialog box that encloses the other related controls.
The OK and CANCEL buttons were added for you by the Resource Editor. You can delete (select the control and press DEL key), move (drag the control), resize (drag one of the anchor points), or rename the OK and CANCEL buttons or any of the controls that you add.
Dialog Editor Sample 2
To specify the names and properties of the added controls:
  1. Click on one of the controls in your dialog box and select
    Properties
    from the pop-up (right-click) menu. A Properties window appears showing the default name and properties for that control.
    The following figure shows the Properties box for the Horizontal Scroll bar.
    Dialog Editor Sample 3
  2. Change the control name by modifying the ID property (currently,
    IDC_SCROLLBAR1
    ) to another name (for example,
    IDC_SCROLLBAR_TEMPERATURE)
    .
  3. Select the available options in the left column to change the control's properties.
Repeat the same process for each control and for the dialog box itself.
To use the controls from within a program, you need symbolic names for each of them. In the previous series of steps, the Horizontal Scroll bar symbolic name has been changed in the Properties box to
IDC_SCROLLBAR_TEMPERATURE
. Use this name to refer to the control; for example:
INTEGER slide_position retlog = DLGGET (dlg, IDC_SCROLLBAR_TEMPERATURE, & slide_position, DLG_POSITION)
To save the dialog box as a resource file:
  1. Select
    File>Save All
    .
    Typically, only one resource file is used with each Intel Visual Fortran project (see Including Resources Using Multiple Resource Files).
  2. When you save your resource file for the first time, the resource editor also creates a Resource.h file. This file is included by the .RC file. To create the Fortran equivalent of this file (resource.fd), do the following:
    1. Add Resource.h to your project using
      File>Add Existing Item...
      .
    2. Select the Resource.h file in the Solution View and the select
      View>Property Pages
      from the main menu bar.
    3. Set the Command Line option to use the deftofd tool by entering:
      deftofd resource.h resource.fd
      (For more information on the deftofd tool, see The Include (.FD and .H) Files.)
    4. Set the Description option to
      Generating Fortran include file...
    5. Set the Outputs option to
      resource.fd
      .
    6. Click
      OK
      .
To open an existing dialog box in the Resource Editor:
  1. From the
    File
    menu, open the project .
  2. Double-click the RC file.
  3. Click the plus sign (+) next to Dialog.
  4. Double-click the appropriate dialog name, such as IDD_DIALOG1.
  5. Use the Resource Editor to add a new control or modify an existing control. To modify an existing control, use the Tab key to select the appropriate control. Now select
    View>Properties Window
    (or, on the pop-up menu, click
    Properties
    ) to view or modify its properties.
At this point, the appearance of the dialog box is finished and the controls are named, but the box cannot function on its own. An application must be created to run it.
Not all the controls on the Resource Editor Controls toolbar are supported by Intel Visual Fortran dialog routines. The supported dialog controls are:
You can also add ActiveX controls to your dialog box. For information, see Using ActiveX* Controls Overview.
For information on creating an application for your dialog box, see Writing a Dialog Application Overview.
This section also discusses other resources and control properties.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.