Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Menu item in a Dialog Box

miguel_fonseca
Beginner
893 Views
Hi people,

I have build a dialog box which uses its own menu.
I can display the dialog box with the menu included, but I don't know how to
process any messages when a menu item is chosen. Like e.g exiting the dialog box or opening a new file.
Could you give me an example?

Thanks in advance for your help.
0 Kudos
5 Replies
Jugoslav_Dujic
Valued Contributor II
893 Views
http://www.xeffort.com/fortran/misc/other.htm

Although it's much more elegant if you'd use XFLOGM/Xeffort instead -- you can install any WM_COMMAND callback using XSetCommand routine.
0 Kudos
joerg_kuthe
Novice
893 Views

A good example is found in the program being set up by the Fortran Application Wizard when you choose "SDI Application" and let the "wizard" create source code for you. There you see how the menu item events are processed in the main window procedure.

Jrg Kuthe
www.qtsoftware.de

0 Kudos
miguel_fonseca
Beginner
893 Views
Guys,

Thanks for your replies. But I must say that now I am little bit confused with the examples you both gave. The Xeffort MenuDialog example is good but I do not understand it when I compare it to the SDI Application suggestion.
The MenuDialog has almost any code and still manage to do what I want and the other one has much more code to do the same.
I have tried to follow the code elements of the MenuDialog but still with the same problem, when I press a MenuItem there is no response.
Meanwhile, I will keep searching for the missing part or for my failure...

0 Kudos
Jugoslav_Dujic
Valued Contributor II
893 Views
MenuDialog is basically a hack... It's as if you purchased a car (DFLOGM) without an air-conditioner (menu) and without even an option to have it. If you take an air-conditioner from another car, and have a good grasp on how it works, you could probably fit it in and make it work (MenuDialog). However, that is still be a cludge, and if someone else (you) would like to fit it in his own car, he would have to have some knowledge on the technology and either 1) reverse-engineer how you did it or 2) ask you for advice how it works. smiley [:-)].

The third option is to purchase a car with built-in air-conditioner (xeffort) Smiley with tongue out [:-P]. If you download & install Xeffort, the only things you should change to your original application are:

1) Change "USE IFLOGM" with "USE XFLOGM" everywhere
2) Add "xeffort.lib" to the linker list
3) Add a menu to your dialog through resource editor,
4) Install the menu callback similar to button callback:

USE XEFFORT
ret = XSetCommand(Dlg, IDC_MENU1, onMenuClick)
...
SUBROUTINE OnMenuClick(Dlg, id, nCode)
...
END SUBROUTINE OnMenuClick



0 Kudos
miguel_fonseca
Beginner
893 Views
Your car and air-conditioner example is just perfect and clear. smiley [:-)]
But as I do not like to give up things easily, I will put some more effort in my reverse engineering ehehe before I consider your third option.
In any case, thanks for the suggestions.
0 Kudos
Reply