本帖最后由 kyra 于 2020-3-7 09:05 编辑
这几天在学习IVF,请教各位高手前辈,本人想把对话框输入的数据,其计算结果赋值到主程序中,作为主程序的输入参数,折腾了几天还是没搞定,主要问题是:主程序能获取计算结果参数,但均为给定初始值下的结果,对话框数据有变化时,输出总是未改变,请大家帮忙,那地方不妥,或如何实现,下面是原代码
[Fortran] 纯文本查看 复制代码 Program TEMP
USE CONSTANT_MODULE
Implicit None
Call DoDialog()
WRITE(*,*) N1
End Program TEMP
Subroutine DoDialog()
USE CONSTANT_MODULE
Use IFLogM
Implicit None
Include 'Resource.FD'
Integer retInt,cel
Integer( kind=4 ) :: results
Logical retLog
Character(256) text
Type(Dialog) dlg
External UpdateTemp
If (.Not.DlgInit(IDD_TEMP,dlg)) then
Write(*,*) "Error:dialog not found"
Else
retLog = DlgSet( dlg , IDC_EDIT_CELSIUS , "100" )
Call UpdateTemp( dlg , IDOK , DLG_CLICKED )
retLog = DlgSetSub( dlg , IDOK , UpdateTemp )
retLog = DlgSetSub( dlg , IDC_EDIT_FAHRENHEIT , UpdateTemp )
retLog = DlgGet( dlg , IDC_EDIT_FAHRENHEIT ,text) ! 这行是我添加的,想获取对话框结果并赋值
Read(text,*) cel
WRITE(*,*) cel
N1=cel
END IF
retInt = DlgModal( dlg )
Call DlgUnInit( dlg )
End Subroutine DoDialog
Subroutine UpdateTemp(dlg,control_Name,callBackType)
!DEC$ ATTRIBUTES DEFAULT::UpdateTemp
Use IFLogM
!USE IFQWIN
Implicit None
Type(dialog) dlg
Integer control_Name
Integer callBackType
Include 'Resource.FD'
Character(256) text
Integer cel,far,retInt
Logical retLog
!Suppress compiler warnings for unreferenced arguments.
Integer local_callBackType
retLog = DlgGet( dlg , IDC_EDIT_CELSIUS , text )
Read(text,*) cel
far = cel + 32.0
Write(text,*) far
retLog = DlgSet( dlg , IDC_EDIT_FAHRENHEIT , Trim(AdjustL(text)) )
Call DlgExit( dlg )
End Subroutine UpdateTemp
|