インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
Dialog Function: Assigns your own callback subroutines to dialog controls and to the dialog box.
USE IFLOGM
result = DLGSETSUB (dlg,controlid,value[,index])
dlg |
(Input) Derived type dialog. Contains dialog box parameters. The components of the type dialog are defined with the PRIVATE attribute, and cannot be changed or individually accessed by the user. |
controlid |
(Input) Integer. Specifies the identifier of a control within the dialog box. Can be the symbolic name for the control or the identifier number, both listed in the include (with extension .FD) file, or it can be the identifier of the dialog box. |
value |
(Input) EXTERNAL. Name of the routine to be called when the callback event occurs. |
index |
(Input; optional) Integer. Specifies which callback routine is executed when the callback event occurs. Necessary if the control has more than one callback routine. |
The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..
When a callback event occurs (for example, when you select a check box), the callback routine associated with that callback event is called. You use DLGSETSUB to specify the subroutine to be called. All callback routines should have the following interface:
SUBROUTINE callbackname( dlg, control_id, callbacktype)
!DIR$ ATTRIBUTES DEFAULT :: callbackname
callbackname |
Is the name of the callback routine. |
dlg |
Refers to the dialog box and allows the callback to change values of the dialog controls. |
control_id |
Is the name of the control that caused the callback. |
callbacktype |
(Input; optional) Integer. Specifies which callback routine is executed when the callback event occurs. Necessary if the control has more than one callback routine. |
The control_id and callbacktype parameters let you write a single subroutine that can be used with multiple callbacks from more than one control. Typically, you do this for controls comprising a logical group. You can also associate more than one callback routine with the same control, but you must use then use index parameter to indicate which callback routine to use.
The control_id can also be the identifier of the dialog box. The dialog box supports two callbacktypes, DLG_INIT and DLG_SIZECHANGE. The DLG_INIT callback is executed immediately after the dialog box is created with callbacktype DLG_INIT, and immediately before the dialog box is destroyed with callbacktype DLG_DESTROY. DLG_SIZECHANGE is called when the size of a dialog is changed.
Callback routines for a control are called after the value of the control has been updated based on the user's action.
If two or more controls have the same controlid, you cannot use these controls in a DLGSETSUB operation. In this case, the function returns .FALSE..
USE IFLOGM
INCLUDE "MYDLG.FD"
TYPE (dialog) mydialog
LOGICAL retlog
INTEGER return
EXTERNAL RADIOSUB
retlog = DLGINIT(IDD_mydlg, mydialog)
retlog = DLGSETSUB (mydialog, IDC_RADIO_BUTTON1, RADIOSUB)
retlog = DLGSETSUB (mydialog, IDC_RADIO_BUTTON2, RADIOSUB)
return = DLGMODAL(mydialog)
END
SUBROUTINE RADIOSUB( dlg, id, callbacktype )
!DIR$ ATTRIBUTES DEFAULT :: radiosub
USE IFLOGM
TYPE (dialog) dlg
INTEGER id, callbacktype
INCLUDE 'MYDLG.FD'
CHARACTER(256) text
LOGICAL retlog
SELECT CASE (id)
CASE (IDC_RADIO_BUTTON1)
! Radio button 1 selected by user so
! change text accordingly
text = 'Statistics Package A'
retlog = DLGSET( dlg, IDC_STATICTEXT1, text )
CASE (IDC_RADIO_BUTTON2)
! Radio button 2 selected by user so
! change text accordingly
text = 'Statistics Package B'
retlog = DLGSET( dlg, IDC_STATICTEXT1, text )
END SELECT
END SUBROUTINE RADIOSUB