DAY 030: _CONTROLCHR
#5
_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
For i = 0 To 32
    Print Chr$(i);
Next
Print

If _ControlChr Then
    For i = 0 To 32
        Print Chr$(i);
    Next
    Print ; "It's ON.  Right??"
Else
    Print "Nope.  It's off"
End If


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?  Tongue



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.  Tongue
Reply


Messages In This Thread
DAY 030: _CONTROLCHR - by Pete - 12-11-2022, 02:13 AM
RE: DAY 030: _CONTROLCHR - by mnrvovrfc - 12-11-2022, 02:37 AM
RE: DAY 030: _CONTROLCHR - by Pete - 12-11-2022, 03:00 AM
RE: DAY 030: _CONTROLCHR - by mnrvovrfc - 12-11-2022, 03:07 AM
RE: DAY 030: _CONTROLCHR - by SMcNeill - 12-11-2022, 11:27 AM
RE: DAY 030: _CONTROLCHR - by vince - 12-11-2022, 12:49 PM



Users browsing this thread: 1 Guest(s)