Silverfrost Forums

Welcome to our forums

Call back functions for winio@

6 Aug 2014 4:34 #14406

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

6 Aug 2014 6:30 #14412

All information messages should only have [OK]. The caption shouldn't contain the information - it should contain the name of your application because otherwise the user doesn't know which application triggered the message if they have multiple applications open.

You should read the Microsoft User Experience guidelines, otherwise your application won't be intuitive to experienced Windows users.

I answered your query regarding the standard icon in your other post - but you can also draw your own icons and place them - you can use %gi to place GIFs (which can be animated), %ic to place windows icons, %bm to place bitmaps (various types) etc. You can make such icons clickable.

E

7 Aug 2014 4:22 #14416

Thanks a lot Eddie.

Please login to reply.