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

Escape key in CVF Standard graphics

paulgerard
Beginner
1,058 Views
In re-writing old F77 programs with many graphic routines to Fortran Standard Graphic applications I am not able to detect an Escape press. It always toggles with Alt-Screen between full window and windowed screen.
My programs heavily depend on Esc to quit from certain routines. Besides, changing screen window is not desirable in my programs. They have to stay always full-screen. I can live with Alt-Screen which is typical user desired but Esc is just a simple key, always available. How to detect and suppress Esc in Standard Graphics applications?

Paul
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
1,058 Views
You will have to subclass the frame window and override WM_KEYDOWN/VK_ESCAPE. It's not so scary as it sounds -- take a look at POKER CVF sample, or, simpler, QWToolbar sample on my home page.

Jugoslav
0 Kudos
paulgerard
Beginner
1,058 Views
Dear Jugoslav,

I don't understand your reply or my question was not clear. Both POKER CVF and QWToolbarsample show a main window which can be changed to full-screen with Alt+Enter and back using Esc.
I want to write graphic programs, without Window menus, running from start full-screen without allowing the Escape key to bring it back to a Window.

Paul
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,058 Views
They illustrate how to subclass the QuickWin window in order to get hold of events that would otherwise be directed to QuickWin library for handling. Subclassing provides means to extend or override QuickWin functionality.

What you need to do is to replace the window procedure contents with something like:
CASE(WM_KEYDOWN) !A key is pressed
   SELECT CASE (wParam)
   CASE(VK_ESCAPE)
      !Do something appropriate, e.g. set a global flag.
      !Do NOT CallWindowProc in this branch because that
      !will toggle full screen.
   CASE(VK_RETURN)
      !Catch return here if you need. Take care to 
      !Test the value of Alt via DFWIN::GetKeyState, because
      !you don't want to override Alt+Return.
   CASE DEFAULT
      !Pass all other keys to QuickWin
      ThisProc = CallWindowProc(...
   END SELECT
CASE DEFAULT
   !Pass everything else to QuickWin
   ThisProc = CallWindowProc(...
I'm not sure whether you need to subclass GETHWNDQQ(0) or QWIN$FRAMEWINDOW in context of Standard Graphics -- experiment.

Jugoslav

0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,058 Views
P.S. I missed your last sentence -- if you want simply to "disable" Escape key, just do nothing in VK_ESCAPE branch.
0 Kudos
Reply