Is it possible to call your own callback routine in the QuickWin command `APPENDMENUQQ`
Is it possible to call your own callback routine in the QuickWin command `APPENDMENUQQ`
I am building a simple database interface with QuickWin commands in Fortran. The command APPENDMENUQQ
and INSERTMENUQQ
provide to call a callback routine. There is a list of pre-defined routines in the documentation.
APPENDMENUQQ
INSERTMENUQQ
Question: Is it possible to call a routine created by yourself?
I use Fortran with Intel compiler v14.
See: https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-appendmenuqq-w-s
Hi Vladimir, I have not enough Reputation to add more than one tag. Regards, Jan
– Jan S.
Sep 4 '18 at 13:59
There is no such reputation requirement. Please do take the tour to find out how to use this site. It is important.
– Vladimir F
Sep 4 '18 at 14:08
2 Answers
2
Yes, it is possible. Instead of one of the predefined names, specify the name of an external subroutinethat has one input argument of type default LOGICAL, that specifies whether the particular menu item is checked or not. [Edit: it's a subroutine, not a function.]
This is documented in the Intel Fortran Language Reference for APPENDMENUQQ. You can also see Using Intel® Visual Fortran to Create and Build Windows*-Based Applications for detailed information on using QuickWin and modifying menus, though I note the text here doesn't show an example of a user callback.
In APPENDMENUQQ, specify the callback in the 4th parameter. I don't know if the Intel Compiler supplies the same examples as its ancestor MS PowerFortran or whether these got lost on its journey to DEC, Compaq and Intel.
In MS PowerFortran, the examples are in the Projects directory - for example, ProjectsSamplesFPSGeneralPoker. If you have this, have a look at scoring.f90 - quite a few examples of callbacks there. Alternatively, if you can get hold of old MSDN subscription (around 2005-2006) disks, you might find them there.
The callback takes one logical variable. This tells you whether the menu item is checked. Most of the examples of callbacks look like
subroutine xxx(unused)
logical unused
...
return
call unusedqq(unused)
end subroutine xxx
This is different from what Steve has described - the interface may have changed in the transition from MS to Intel.
MS to Digital to Intel, you mean. But I don't think the documented interface changed. The Poker sample is still provided by Intel, and I see the callbacks are subroutines rather than functions. It makes me think that the documentation is incorrect and that there is no function value used.
– Steve Lionel
Sep 5 '18 at 14:36
Link on given by the op says Callback subroutine ... single LOGICAL parameter. If nothing has changed, the documentation is probably correct if it is just online documentation. When it was DVF, it came with a book which just said refer to online documentation. There were no more books by the time it became CVF.
– cup
Sep 5 '18 at 16:38
Ah, I see. I misread. It is indeed a subroutine, not a function. As for "no more books by the time it became CVF", that's not true. I even have a copy of the printed Compaq Visual Fortran Language Reference Manual. It was sold, not included with the product, and not too many people bought it.
– Steve Lionel
Sep 5 '18 at 23:30
But the subroutine or function (AboutJSK) doesn't work in my case. I call the function/subroutine in the prescribed way (res4 = APPENDMENUQQ (6, $MENUENABLED, "&About - JSK"//C_NULL_CHAR, AboutJSK). The programm finds the external subroutine or function at compiling (with or without the logical parameter!). The button appears in the QW-menu on the right place but is disabled. I tried the subroutine from the POKER example. Some commands are not availible in Intel Fortran like the command ‘unusedqq’. But the programm behaves in the same way. Other workarounds?
– Jan S.
Sep 10 '18 at 7:40
Could you post your code in your question? UnusedQQ is to get round warning 14 - unused variables. You need to add *USE IFQWIN.MOD" in the subroutine that uses it. Failing that, just remove the call and ignore warning 14 (it used to be 14 on CVF)
– cup
Sep 15 '18 at 4:54
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Welcome, please take the tour. It is good to add more tags to better specify the topic of your question, because your question is not about the Fortran language. Tags are extremely important here on Stack Overflow.
– Vladimir F
Sep 4 '18 at 11:25