|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Wed Aug 06, 2014 12:48 pm Post subject: winio@: Call back function response |
|
|
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
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 quick help to debug this. I have tried all possibilities using EXTERNAL.. But not helping out for Cancel button. I may be doing something wrong. If you can help, that will be great.
The idea here is to have a generic routine to display the messages. So that I can call it as subroutine in my program. Suitable other ways of coding this are most welcome.
Thanks _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Wed Aug 06, 2014 12:54 pm Post subject: |
|
|
I have one more query as well. I like to display small icon showing the "information" or "error' symbol in the message display window. How do I do it
Pls. help
Thanks _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed Aug 06, 2014 7:22 pm Post subject: |
|
|
Here is your program suitably modified:
Code: | module test
contains
subroutine display_msg(title,message)
integer res, winio@
character(len=*):: title, message
common res
res = winio@('%ca['//title//']&')
res = winio@('%si!'//message//'%ta%^bt[OK]%ta%^bt[Cancel]',func,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
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
RESOURCES
1 24 default.manifest |
The standard info icon is generated with %si!. Both %bt buttons need the ^ modifier if you want a callback function and because there are two of them you need to specify 'func' twice. The RESOURCES section gives you a more modern looking style to your windows and buttons.
Read the appropriate sections in the online help There are dozens of format codes. There is also the 'enhancements' file that you will find in the DOC folder within FTN95.
Eddie |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Thu Aug 07, 2014 1:28 am Post subject: |
|
|
Thank you Eddie for your suggestions here and to my other post in ClearWin+. I get the details. THanks a lot. _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Thu Aug 07, 2014 1:31 am Post subject: |
|
|
Hi Eddie
But how to make the reference in the project for RESOURCES section
Code: |
RESOURCES
1 24 default.manifest
|
Thanks _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Aug 07, 2014 10:35 am Post subject: |
|
|
There is no reference: this is a special feature of FTN95.
You can list all your resources in a resources section, OR you can put them in a separate file, typically with the extension .rc and compile that separately with SRC to resource compiler which generates an object file (type .obj) which you can link to the .obj files generated from Fortran, using SLINK.
However, for short resources lists, you can just put a RESOURCES section at the end of your Fortran code like I did.
Most of the resources things are straightforward, for example, some of mine (out of lists of sometimes hundreds!)
Code: | PRINTER ICON "Printer.ICO"
HOLMES CURSOR "Magnify.cur"
ACCEPTB BITMAP "ACCEPT_BUTTON.BMP"
CANCELB BITMAP "CANCEL_BUTTON.BMP" |
This makes PRINTER the local name for an icon file named Printer.ico in my computer, and so on.
As for 1 24 default.manifest, this is to this day a bit of a mystery. However, a 'manifest' is a description of the style or theme of windows, and as far as I am aware, from Windows XP onwards the look of WIndows has been differentiated from the standard Windows 05 appearance by a manifest - this means that you can get the 'classic' appearance very simply if you want to.
Until you are ready to change cursors in your program, there is no point in having cursor resources, and so on for icons and bitmaps. But there is always some point in the manifest setting as it makes your program look modern.
Eddie
Last edited by LitusSaxonicum on Thu Aug 07, 2014 6:56 pm; edited 1 time in total |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Thu Aug 07, 2014 6:37 pm Post subject: |
|
|
Hi Edie
Many thanks for your detailed explanation on the RESOURCES. I am sure you have been a Master in this. Thanks a lot.
Let me try all these Resources. Can I not use the FTN95 Express Visual studio to compile the RC files. Or should I have to go only with Command line compilers.. ?
Best Regards _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Aug 07, 2014 7:02 pm Post subject: |
|
|
Hi Moorthy,
If I were you, I would stick to the simplest form of FTN95, which is to edit and compile your Fortran code in the integrated development environment called Plato.
Someone who has used FTN95 for a long time like me uses the strict command line form of FTN95, using my own editor, the MS DOS command prompt etc.
This can build you a Win-32 executable, with the full Windows interface called Clearwin+. Using Visual Studio (any version) gives you the facilities of .NET, but the chances are you don't need them at your stage.
Using Plato (which automatically invokes FTN95 and SRC and SLINK etc) is the method of use that conforms most closely to what is in the Help files, and should make it easier for you to find your own solutions in the documentation.
As for using Visual Studio to compile resources, then probably you need a different guru!
Eddie |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Thu Aug 07, 2014 7:20 pm Post subject: |
|
|
Hi Eddie
You are right. I had started with Plato only, it is simple and superb. I used my own editor, just compiled using Plato. It is excellent. But I could not do the single step debugging and viewing individual values while debugging at each step. This is the only reason which I moved to FTN95 Express VS. Otherwise, I am a big fan of Plato. Great
I have been using fortran since FortranIV from way back 1986 onwards. But the way how Silverfrost is repacked and given, is simply superb. the Big Salute to Silverfrost team. I am still exploring all of them. _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|