![]() |
WAITKEY$ not in FreeBASIC - Printable Version +- PowerBASIC Users Meeting Point (http://pump.richheimer.de) +-- Forum: User to User Discussions (http://pump.richheimer.de/forumdisplay.php?fid=3) +--- Forum: Programming (http://pump.richheimer.de/forumdisplay.php?fid=7) +--- Thread: WAITKEY$ not in FreeBASIC (/showthread.php?tid=83) |
WAITKEY$ not in FreeBASIC - Dale Yarker - 23.09.2025 not posted in FreeBASIC forum because a PB user will know what I'm talking about. I'm having bad success compiling and running (from tiko). (before someone bitches - isn't helping coders only used to PB a good subject for PUMP? One problem is the FreeBASIC "appears" not to run because console never shows. They do run from Command Prompt because console does not close at end of code. I can not find an equivalent to WAITKEY$ in FreeBASIC. The problem presents with samples from FreeBASIC and tiko too. FreeBASIC INKEY in a loop should work. Is that the answer? GUI sample problems later. (repeat from elsewhere- I'm not really transitioning from PB to FreeBASIC. It is a 64 bit alternative even though what I do does not need that much horsepower) Cheers, RE: WAITKEY$ not in FreeBASIC - Paul Squires - 23.09.2025 Code: print "This is my console app" Another alternative if you are using tiko and always running console programs (without the Sleep or Inkey methods), you can change the Environment setting to always run your program in a command window. File / Preferences / Environment Options / Compiler Setup / "Run compiled programs using the command window" Use either the Sleep/Inkey -or- Command Window Setting, but not both together. RE: WAITKEY$ not in FreeBASIC - Dale Yarker - 23.09.2025 From FreeBASIC Help for SLEEP: "Waits until a specified time has elapsed, or a key is pressed." Aha, never would have looked there (PB bias). On relection, makes sense. If no key press give clock cycles back till next time slice for this app. Think I'll save INKEY in a loop for getting particular keys. "File / Preferences / Environment Options / Compiler Setup / "Run compiled programs using the command window"" Good to know. Isn't it specific to tiko, not general to FreeBASIC? big thanks (sure I'll run into something else) Interested in GUI too. If can't do a "Hello World" in console, figured no chance in GUI. RE: WAITKEY$ not in FreeBASIC - Stuart McLachlan - 24.09.2025 (23.09.2025, 03:16 PM)Dale Yarker Wrote: From FreeBASIC Help for SLEEP: "Waits until a specified time has elapsed, or a key is pressed." In addition to SLEEP, ChatGPT points to GETKEY: Option 2: Using Code: GetKey Print "Press any key to exit..." Dim k As Integer = GetKey() ' Waits for a key and stores it in k GetKey reads a keypress and returns its ASCII code (or scan code for special keys). This is useful if you want to know which key was pressed. |