Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Public
Document Table of Contents

Specifying Control Indexes

Where there is only one possibility for a particular dialog control's index type (integer, logical, character, or subroutine), you do not need to specify the control index name in an argument list. For example, you can set the Static text control IDC_TEXT_CELSIUS to a new value with either of the following statements:

  retlog = DLGSETCHAR (dlg, IDC_TEXT_CELSIUS, "New Celsius Title",  &
 &                     DLG_TITLE)
  retlog = DLGSET (dlg, IDC_TEXT_CELSIUS, "New Celsius Title")

You do not need the control index DLG_TITLE because there is only one character index for a Static text control. The generic function DLGSET chooses the control index to change based on the argument type, in this case CHARACTER.

For each type of index, you can use the generic DLGSET function or the specific DLGSET function for that type: DLGSETINT, DLGSETLOG, or DLGSETCHAR.

For example, you can disable the Static text control IDC_TEXT_CELSIUS by setting its logical value to .FALSE. with either DLGSET or DLGSETLOG:

  retlog = DLGSETLOG (dlg, IDC_TEXT_CELSIUS, .FALSE., DLG_ENABLE)
  retlog = DLGSET (dlg, IDC_TEXT_CELSIUS, .FALSE., DLG_ENABLE)

In both these cases, the control index DLG_ENABLE can be omitted because there is only one logical control index for Static text controls.

You can query the value of a particular control index with the DLGGET functions, DLGGET, DLGGETINT, DLGGETLOG, and DLGGETCHAR. For example:

  INTEGER current_val
  LOGICAL are_you_enabled
    retlog = DLGGET (dlg, IDC_SCROLLBAR_TEMPERATURE, current_val,      &
   &                 DLG_RANGEMAX)
    retlog = DLGGET (dlg, IDC_SCROLLBAR_TEMPERATURE, are_you_enabled,  &
   &                 DLG_ENABLE)

This code returns the maximum range and the enable state of the scroll bar. The arguments you declare (current_val and are_you_enabled in the preceding example) to hold the queried values must be of the same type as the values retrieved. If you use specific DLGGET functions such as DLGGETINT or DLGGETCHAR, the control index value retrieved must be the appropriate type. For example, you cannot use DLGGETCHAR to retrieve an integer or logical value. The DLGGET functions return .FALSE. for illegal type combinations. You cannot query for the name of an external callback routine.

In general, it is better to use the generic functions DLGSET and DLGGET rather than their type-specific variations because then you do not have to worry about matching the function to the type of value set or retrieved. DLGSET and DLGGET perform the correct operation automatically, based on the type of argument you pass to them.

More information on these routines is available in the Language Reference.

Did you find the information on this page useful?

Characters remaining:

Feedback Message