主题:照抄桂良进的FORTRAN POWERSTATION4.0使用与编程第15章最后的例题,始终编译不了
program temperature
use msflib
use dialogm
implicit none
include 'resource.fd'
external dodialog
call dodialog()
do while(.true.)
end do
end program
subroutine dodialog
use dialogm
implicit none
include 'resource.fd'
integer retint
logical retlog
type(dialog) dlg
external updatetemp,setmax,setmin
!
if(.not. dlginit(idd_temp,dlg)) then
write(*,*) "error:dialog not found"
else
!
retlog=dlgset(dlg,idc_scrollbar_temperature,200,dlg_range)
retlog=dlgset(dlg,idc_edit_celsius,"100")
!
call updatetemp(dlg,idc_edit_celsius,dlg_change)
retlog=dlgsetsub(dlg,idc_edit_celsius,updatetemp)
retlog=dlgsetsub(dlg,idc_edit_fahrenheit,updatetemp)
retlog=dlgsetsub(dlg,idc_scrollbar_temperature,updatetemp)
retlog=dlgsetsub(dlg,idm_max,setmax)
retlog=dlgsetsub(dlg,idm_min,setmin)
!
retint=dlgmodal(dlg)
call dlguninit(dlg)
end if
end subroutine dodialog
subroutine setmax(dlg,control_name,callbacktype)
use dialogm
implicit none
type(dialog) dlg
integer control_name
integer callbacktype
character(256) text
logical retlog
include 'resource.fd'
write(text,*) 391
retlog=dlgset(dlg,idc_edit_fahrenheit,trim(adjustL(text)))
retlog=dlgset(dlg,idc_scrollbar_temperature,200,dlg_position)
write(text,*) 200
retlog=dlgset(dlg,idc_edit_celsius,trim(adjustl(text)))
end subroutine setMax
subroutine setmin(dlg,control_name,callbacktype)
use dialogm
implicit none
type(dialog) dlg
integer control_name
integer callbacktype
character(256) text
logical retlog
include 'resource.fd'
write(text,*) 0
retlog=dlgset(dlg,idc_edit_fahrenheit,trim(adjustl(text)))
retlog=dlgset(dlg,idc_scrollbar_temperature,0,dlg_position)
write(text,*) 0
retlog=dlgset(dlg,idc_edit_celsius,trim(adjustl(text)))
end subroutine setmin
subroutine updatetemp(dlg,control_name,callbacktype)
use dialogm
implicit none
type(dialog) dlg
integer control_name
integer callbacktype
include 'resource.fd'
character(256) text
integer cel,far,retint
logical retlog
integer local_callbacktype
local_callbacktype=callbacktype
select case(control_name)
case(idc_edit_celsius)
!
retlog=dlgget(dlg,idc_edit_celsius,text)
read(text,*,iostat=retint) cel
!
if(retint.eq.0) then
far=(cel-0.0)*((212.0-32.0)/100.0)+32.0
write(text,*) far
retlog=dlgset(dlg,idc_edit_fahrenheit,trim(adjustl(text)))
retlog=dlgset(dlg,idc_scrollbar_temperature,cel,dlg_position)
end if
!
case(idc_edit_fahrenheit)
retlog=dlgget(dlg,idc_edit_fahrenheit,text)
read(text,*,iostat=retint) far
!
if(retint.eq.0) then
cel=(far-32.0)*(100.0/(212.0-32.0))+0.0
write(text,*) cel
retlog=dlgset(dlg,idc_edit_celsius,trim(adjustl(text)))
retlog=dlgset(dlg,idc_scrollbar_temperature,cel,dlg_position)
end if
!
case(idc_scrollbar_temperature)
retlog=dlgget(dlg,idc_scrollbar_temperature,cel,dlg_position)
far=(cel-0.0)*((212.0-32.0)/100.0)+32.0
!
write(text,*) far
retlog=dlgset(dlg,idc_edit_fahrenheit,trim(adjustl(text)))
!
write(text,*) cel
retlog=dlgset(dlg,idc_edit_celsius,trim(adjustl(text)))
end select
end subroutine updatetemp