Program access to LastKey function?

Posted by Admin on 12-Nov-2009 13:39

I have much code that tests against LASTKEY and I am trying to impliment more use of buttons in the application - but I need to have the button - convey the result that a function key was pushed so that LASTKEY will have the result as if the function key was used even though we clicked on the button.

I am on 9.1E and everything I read seems to say - "no can do" - any ideas on how to accomplish this?

Jim

All Replies

Posted by ksv on 13-Nov-2009 01:36

Well, you can partly do that. The following snippet will allow you to that if you put some ASCII chars into the test.inp file. But I couldn't push into LASTKEY any functional key such as F1, F2 and so on.

DEFINE STREAM sInp.
INPUT STREAM sInp FROM VALUE(  "test.inp" ).

READKEY STREAM sInp .
INPUT STREAM sInp CLOSE.

MESSAGE LASTKEY
   VIEW-AS ALERT-BOX INFO BUTTONS OK.

Posted by Admin on 13-Nov-2009 08:48

I am using simular code for the "esc" key successfully - however there is no ascii code for "F5" in the "normal" code page.  It would take constructing a double-byte character - but the readkey function while reading from a file specifically says it can not do that with function keys - or any double-byte characters for that matter.

I was thinking that maybe someone had a "C" program that could stick the character into the keyboard buffer.  It would seem that an external way to access the keyboard buffer might work.

Not sure why Progress does not just allow "Apply event to LASTKEY" - but it does not - or at least my rev does not.

Jim

Posted by ksv on 14-Nov-2009 04:19

jmeidl wrote:

I was thinking that maybe someone had a "C" program that could stick the character into the keyboard buffer. 

You didn't specify your OS although this sort of things is OS dependent. And I'm afraid it'll be much tougher to implement for UNIX than for Win.

Anyway I solved my problem with LASTKEY replaced globally all LASTKEYs in my code with a variable.

This thread is closed