Hi
I have tried the following small function to display simple messages and to take the response based on [Ok] & [Cancel] Button. This works fine for pressing [Ok] button, but for [Cancel] button, it does not call the call back function. I have tried with ^bt[Cancel] also, but it is not call the func()
Here is the code :
module test
contains
subroutine display_msg(title,message)
integer res, winio@
character(len=*):: title, message
common res
res = winio@('%ca['//title//']&')
res = winio@('%il&',1,2147483647)
res = winio@(message//'%ta%^bt[OK]%ta%bt[Cancel]',func)
!res = winio@('%ta%bt[OK]%ta%bt[Cancel]',func)
print*, res
end subroutine display_msg
integer function func()
func = (-1)
print*, 'I am in function'
print*, func
print*, 'control returns to main'
end function
end module test
winapp
program main
use test
!external display_msg
character (len=50) :: title, message
integer :: res
common res
title='Format Error'
message ='Bus Data is a problem..Program stopping'
call display_msg(title,message)
if (res == 1) print*, 'Ok is pressed'
if (res == 2 ) print*, 'Cancel is pressed'
end program
Can I request your help to fix this.
The idea is to have a generic routine to display the user defined messages. Suitable other alternatives are most welcome.
Thanks