DAY 030: _CONTROLCHR - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Official Links (https://staging.qb64phoenix.com/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://staging.qb64phoenix.com/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://staging.qb64phoenix.com/forumdisplay.php?fid=49) +---- Thread: DAY 030: _CONTROLCHR (/showthread.php?tid=1260) |
DAY 030: _CONTROLCHR - Pete - 12-11-2022 Ever want to be able to see the ASCII characters that do things like eject the printer paper, CHR$(12)? Well with the keyword _CONTROLCHR OFF, you can! And if you act now, because we can't do this all day, we'll throw in _CONTROLCHR$ ON at no extra charge. Just pay separate shipping and handling. SYNTAX _CONTROLCHR {OFF|ON} Code: (Select All) WIDTH 127, 20 So now we have some nice symbols we can print to the screen for our text programs, which without this KEYWORD, would be used for the following... Code: (Select All) CTRL + A = CHR$(1) ? StartHeader (SOH) CTRL + B = CHR$(2) ? StartText (STX) Note that PRINT CHR$(7) used t sound a BEEP in QuickBasic and older QB64 versions, but not any longer. I wonder who the dev was who decided to get the BEEP out of QB64? Pete RE: DAY 030: _CONTROLCHR - mnrvovrfc - 12-11-2022 Doesn't always work. I've completely given up on it and pretend it doesn't exist. RE: DAY 030: _CONTROLCHR - Pete - 12-11-2022 And it's a bitch to format, too. Finally got that table to show properly. Seriously, is it inconsistent on Linux for the code as posted? I've never had any problems with it. It should return this... RE: DAY 030: _CONTROLCHR - mnrvovrfc - 12-11-2022 It was a long time ago I tried to use this keyword on Windows. Haven't even tried on Linux because, as I've already said, I've given up on it. I wish I could offer something far more useful than that. BTW shocked that you put a screenshot of Firefox, I was almost fooled it was Edge or some other browser. :O Prefer that look over the child's play I have on my side. But it's also because I'm using AppImage "Nightly" build. EDIT: In order to see the whole screenshot, with the context menu at the top-right, have to zoom to 80%. (facepalm) RE: DAY 030: _CONTROLCHR - SMcNeill - 12-11-2022 _CONTROLCHR works just fine -- whether that's on Windows, Linux, or Mac. IF there's a problem with it, it's with how people interact with the FUNCTION and the SUB versions of the two. Code: (Select All) _ControlChr Off Run the above and you'll quickly see what can toss most folks for a loop. _CONTROLCHR, as a sub, you toggle OFF to print the extended ASCII characters, toggle ON to... basically do nothing anymore. OpenGL doesn't have the same support for the control characters that the old SDL version did -- thus why Pete remembers CHR$(7) as BEEP, but it doesn't do so anymore. _CONTROLCHR, as a function, is basically reversed. ON, it says you're printing those extended ASCII characters. OFF, you're basically doing nothing. How the values got inverted between the two, I dunno, but it's been that way forever, and swapping them would break a lot of user's existing code, so we're stuck living with what we have. Turn it OFF via the SUB, and the FUNCTION will tell you you're ON for printing to the screen. Turn it ON via the SUB, and the FUNCTION will tell you you're OFF for printing to the screen. I suppose a better name for the function would be something like _CONTROLCHRDISPLAY... But who wants all that extra typing? Honestly, since _CONTROLCHR ON doesn't do *anything* anymore -- no BEEP, backspace, enter, ect, ect -- I'm of the opinion that we should just obsolete the two commands, make _CONTROLCHR OFF the default and unchangeable setting, and leave it at that. Why offer an option that basically does nothing? Either someday, we need to reimplement those control actions to the keys, or else we need to seriously rethink a toggle which switches between "do something" and "do squat". At least, that's my personal opinion on the situation as it currently exists. RE: DAY 030: _CONTROLCHR - vince - 12-11-2022 interesting keyword and thanks for the much needed chime in, Steve |