Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

menu programming

VVit
New Contributor I
823 Views

Hi,

I am trying to work on menu of a fortran program that I've created in VS. How do I program what actions when a menu item is selected?

I searched "Reference Manual" and found that "Fortran Windowing AppWizard" is mentioned but no details on how to get/utilize this AppWizard.

 

I am a beginner on this Intel Fortran VS and found that it's very slow to make any progress. 

YouTube post doesn't really have much regarding how-to on Intel Fortran with VS.

Are there any short courses that I can take as a beginner?

Thanks,

VVit

0 Kudos
14 Replies
Stephen_Sutcliffe
New Contributor I
792 Views

I'd recommend you try to get a copy of this book. You might get it from Amazon or Ebay for less than £15 (used). It was published in 2002.

Stephen_Sutcliffe_0-1635287597686.png

 

You will have to change Windows handle declarations to integer(HANDLE) if you are writing 64-bit applications. 

 

Hope this helps.

VVit
New Contributor I
746 Views

After some searches on the issue, I found a probable solution by using C#, .Net for GUI parts and combining them with the Fortran code. This is not my preferred method because I have zero background on C#/.Net and am afraid that I'd have additional problems along the way. 

Therefore, I'd like to make sure that it is not possible to do this with Intel fortran alone (in VS). I'd appreciate input on this.

Also, I'd welcome suggestions on how to develop programs using both C# and Fortran, eg. how to choose appropriate settings for this type of projects, do I choose "All language" when creating a new project?, what project templates do I need for this?, etc.

JohnNichols
Valued Contributor II
740 Views

Actually, you would be better of not mixing C# and Fortran.  It turns into a nightmare if you want to exchange a lot of data and C# is a steepish learning curve.  C# has a tendency to update frequently and you are always fixing broken code if you update. 

The suggested book, has samples that work quite quickly and it is well set out.  

Either way will work, the first is the Eiger to climb and the second one is the Old Man. PS a lot of people die on the Eiger. 

 

VVit
New Contributor I
733 Views

Thank you John and Stephen.

The option of sticking with just fortran sounds very good to me. However, the only concern I have on the suggested book is that it was published in 2002. Will the contents still applicable to Intel Fortran in VS 2019?

If yes, I'll definitely take your advice.

Best Regards,

VVit 

Stephen_Sutcliffe
New Contributor I
724 Views

VVit,

I believe the book is still applicable as most of the Windows features have not changed much. As I mentioned in the first reply the main thing to be aware of is that the book was published before 64bit programming became readily available for general use and you have to ensure the handles are defined correctly.  I wasted about a year trying to update a program from QuickWin to W32 API back in 2000 when I had to rely on books aimed at C programmers and the online SDK documentation. The Norman Lawrence book would have saved me a lot of grief and also provided good examples of how to integrate more windows GUI features as well as OpenGL that I found really useful after I acquired it soon after publication.

Chapter 6 covers the menu development you are asking about.

The basic program framework is established when you create the solution by selecting a Windows Application in VS2019. The top level files are created as well as resource files that define the GUI structures and constants. This part of the process remains the same though I have to manually create the resource.fd file from the resource.h file using the deftofd utility whenever I add new controls or GUI dialog boxes etc.  A simple menu structure will be set up initially which you can add to in the resource editor and then you put in the relevant code into the select case structure in the windows procedure file where you call the subroutines you write to perform the tasks you add.

The ifwin module defines all the interfaces and constants which are now better (more complete) than they were when I was "climbing the Old Man". Look at ifwin.f90, ifwinty & iflogm.f90 files for variable definitions and function interface definitions.

I am surprised that Intel have not acquired the rights to this book and updated it as it would fill a big hole in their current documentation. 

Try searching this forum for Norman Lawrence and you might mind further information.

Good luck

andrew_4619
Honored Contributor I
720 Views

@Stephen you can have the deftofd as an automatic custom build step is VS  then it does that automatically on build if the resouces have changed.

@VVit If you find and download the intel samples you will find some windows examples that you can build and modify as a starting point for your own application.

 

 

jimdempseyatthecove
Black Belt
712 Views

IIF the menu is only presented at the start of the program it may be easiest to:

a) Use MS BATCH (CMD) to produce command line arguments and/or environment variables prior to launching the application (which either reads the command line variables and/or environment variables for initial conditions).

b) Write a menu in the language of your choice, and then using the C-interoperational feature of Fortran, call the menu code.

Jim Dempsey

VVit
New Contributor I
707 Views

Thank you all for the advice. I will try them out.

I'm also ordering the book Stephen and John have recommended.

MWind2
New Contributor II
692 Views

I like the unmanaged part of VC++ interfacing with native and its managed winforms for gui, but I'm lazy and deprecated.

mfinnis
Novice
648 Views

Another option - not that I've ever used it myself - is to go the QuickWin route. In any case, if you haven't already seen it, the Intel documentation for creating and building Windows based applications is here: https://www.intel.com/content/www/us/en/develop/documentation/using-visual-fortran-windows-applicati...

There is also a pdf version here: https://community.intel.com/legacyfs/online/drupal_files/Creating_Fortran_Win_Apps_0.pdf

JohnNichols
Valued Contributor II
615 Views

I have the Compaq Fortran book, the good thing about Fortran is the bad thing it does not change very quickly.  The book is quite good.  The samples are excellent.  

Quickwin is one way to do it, it is actually quite easy, it is just a bit limited in what you can do with creating a "modern" feel. 

C# it will take you about a month of hard work to learn to create a Windows program in this language from scratch.  The books are not that great, they are usually not written for engineers.   I have a working C# interface, the users love it because it centralizes a lot of analysis that used to be in several console programs, and you can hide a lot of stuff best not seen, but your users will - or may be using Screens that are larger and then they turn on the inflate the Text size and it does not work well with C# and Windows.  Buttons disappear etc.... 

Plus with C# once you create the screens and the code, it is really hard to add stuff to the screens, make sure you have them the end way first time.  And C# windows programs can get locked in the analysis process and not update the screen as often as you like, make sure something pops up or scrolls as people start hitting buttons after about 30 seconds.  

It does not matter which way you choose, in the end as long as it makes people's work faster and you life easier it is worth it.  

If you end users are "noisy" then they will dislike something and complain, find your "noisiest" user and let them try out an "early" version.  

If you create the program in C# then it will run half as fast as Fortran,  I have measured it a few times, with FFT and inversion.  And it the user uses a slow computer, then they may see a slow old turtle.  Think about the user first as they will be in your ear a lot.  

VVit
New Contributor I
586 Views

Thank you John for your valuable input/guidance.

This will save me a lot of time from blindly trying wrong choice(s).

Exactly the advice I need.

VVit

JohnNichols
Valued Contributor II
579 Views

There are no bad choices, merely interesting choices.  

cean
New Contributor I
598 Views
Reply