![]() |
Forum Index : Microcontroller and PC projects : CMM2: INPUT after INKEY$ problem
Author | Message | ||||
andreas![]() Senior Member ![]() Joined: 07/12/2020 Location: GermanyPosts: 226 |
Hi, I'm using the CMM2 Firmware Version 5.0702. I have a code to select an item from a menu: Function menu(items$) ... ' ask user Do k$ = Inkey$ Select Case k$ Case String$(1,128) ' Up ... End Select Loop Until Asc(k$) = 13 ' Return ' restore screen & return value ... menu = sel ' return value = user selection font aktfont input dummy$ '(!) End Function This code uses the Inkey$ function to get a value k$ from keyboard. After processing my "menu-function" returns the selection to the main program. The problem is that if an INPUT statement in the main program follows this menu-function the main program is not stopping to get the INPUT value. It is as if something else has put in the value into the INPUT variable. My solution to this problem is that I add a dummy-INPUT-statement within the menu-Function as last statement. See (!) - the funny thing is, that this "input dummy$" will not stop and aks for a value but continue to the end of the function and return to the calling main program. The ASC(dummy$) is 0. Now my question: Is it a bug or a feature? -andreas |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
to flush the input buffer DO : LOOP UNTIL INKEY$ = "" VK7JH MMedit |
||||
andreas![]() Senior Member ![]() Joined: 07/12/2020 Location: GermanyPosts: 226 |
Thank you Jim! The menu(Items$) function lives in an .inc file for a long time without any issues. Now I write a new program, use the good old menu.inc and discover that the INPUT is not working as expected. I didn't relate inkey$ function and input command to a common buffer. -andreas |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |