Silverfrost Forums

Welcome to our forums

Keyboard monitoring/polling

5 Apr 2010 4:03 #6256

**G'day, folks **:)

Does FTN95 offer Fortran-callable routines peekcharqq and getcharqq for monitoring/polling the keyboard? If so, some example code of their, or their equivalent, usage would be much appreciated. As I understand things, peekcharqq checks the keyboard buffer for input and returns immediately with an indication of whether or not a character is waiting. If one is waiting, getcharqq can be invoked to retrieve the character. The two routines in combination seem to offer a way to interrupt a looping procedure without terminating the program.

P.S. I've been able to successfully call C/C++ functions from a Fortran mainline, using ftn95 and scc. See previous posts.

Eric Carwardine, in Perth, Western Australia

5 Apr 2010 8:02 #6257

Eric,

Take a look at:-

get_wkey1@

which is probably the closest equivalent to what you want, otherwise the help file states you should be using ADD_KEYBOARD_MONITOR@

hope this helps,

John

5 Apr 2010 10:50 #6258

Eric,

Are you programming a console application or a windows application? And if the latter, are you planning to use Clearwin or .NET? The answers you will get rather depend on what you are trying to do.

FTN95 evolved from a Fortran-77 system (FTN77 obviously) that was based around a text screen, DOS (extended by a 32-bit extender) and graphics of the VGA or not much better type. All the text mode functions are still there in FTN95, but you won't find much about them in the FTN95.chm on-line help file. Instead, you'll need to download the FTN77 Library Reference from the Documentation page on the Silverfrost site and read it. There are many more functions available than were provided in MS Fortran (such as the routines ending in 'qq'). When I've tried them, they all worked.

If you are programming for Windows, you very rarely need to poll the keyboard - I never do - as the input methods and philosophy are rather different. However, they are different between Clearwin and .NET as well!

My particular preference is for Clearwin.

Eddie

5 Apr 2010 12:03 #6261

Many thanks, John and Eddie, for your responses; they are much appreciated.

What I want to do is 'modernise' Fortran programs that were written before Windows was invented. For a while I was content with running those same programs in a DOS window via the DOS prompt command.com Now I want to produce a program that displays, for example, like http://www.kurrattan.net/exhibits/something_like_this.jpg when run from a Windows platform. My interest centres around the tabular part of the display, not any of the buttons at the top of the display (Although one button would be nice, which the user could mouse-click to interrupt the temperature-measuring loop without terminating the program).

In essence, the compiled ( .exe ) program would be a Fortran main calling C/C++ routines that gather thermocouple data via one of the serial COM ports. Using ftn95 and scc I've successfully 'mixed' the Fortran and C/C++ Now it's time to present an attractive 'shop-front' to the world 😉

Is ClearWin the way to go? I've already posted a similar query in the ClearWin forum.

Thanks again for your responses 😮

Eric

5 Apr 2010 1:51 #6263

Eric,

Your ambitions are modest compared to what Clearwin can do for you - you'll need a different respondent to sing the praises of .NET

Clearwin would enable you to program the window style, menus, toolbar buttons and the other features.

If you want to send me a private message with an e-mail address I'll send you my 'get you started' notes on Clearwin programming.

Eddie

Please login to reply.