05-05-2022, 06:13 PM
@admin and @bplus
To chime in on a similar issue. If a user goofs the math on a _NEWIMAGE screen size, and uses the SCREEN function to get the screen color at a row and column, the system will return an illegal function call at the bottom of the screen. That's because let's say at a screen height of 630, the 40th row is shown by the mouse, on the screen, but beyond the 630 height limit. Fix the screen size to height 640, a multiple of the default 16 pixel font height, and problem solved. So I'd call this a user bug, but I'm thinking about documenting it for wiki help.
Oh, if you guys want a sample... I can whip one up with the 630 instead of 640 height goof, here:
Note if you change...
hp = SCREEN(my \ _FONTHEIGHT + 1, mx \ _FONTWIDTH + 1, 1)
to
hp = SCREEN(my \ _FONTHEIGHT, mx \ _FONTWIDTH, 1)
it will just error out when the mouse is moved to the very top of the screen, instead of the bottom. The screen function count starts at 1, while mouse row starts at 0, but the point is unless the height of _NEWIMAGE is a multiple of the _FONTHEIGHT, a user is going to experience this error. Again, just something I thought I'd stick in the wik.
Pete
To chime in on a similar issue. If a user goofs the math on a _NEWIMAGE screen size, and uses the SCREEN function to get the screen color at a row and column, the system will return an illegal function call at the bottom of the screen. That's because let's say at a screen height of 630, the 40th row is shown by the mouse, on the screen, but beyond the 630 height limit. Fix the screen size to height 640, a multiple of the default 16 pixel font height, and problem solved. So I'd call this a user bug, but I'm thinking about documenting it for wiki help.
Oh, if you guys want a sample... I can whip one up with the 630 instead of 640 height goof, here:
Code: (Select All)
' Mouse down to row 40 and it throws error 5 because the screen height is 10 pixels too short.
SCREEN _NEWIMAGE(1120, 630, 256) ' Should be 640, not 630.
_DELAY 1
_SCREENMOVE 0, 0
bkgdcolor = 3
PAINT (0, 0), bkgdcolor
GOSUB kybrd
kybrd:
DO
_LIMIT 30
WHILE _MOUSEINPUT: WEND
mx = _MOUSEX
my = _MOUSEY
LOCATE 1, 1: PRINT my; mx; " "; my \ _FONTHEIGHT + 1; mx \ _FONTWIDTH + 1; " ";
hp = SCREEN(my \ _FONTHEIGHT + 1, mx \ _FONTWIDTH + 1, 1) ' Screen read function for color.
b$ = INKEY$
IF b$ = CHR$(27) THEN SYSTEM
LOOP
RETURN
Note if you change...
hp = SCREEN(my \ _FONTHEIGHT + 1, mx \ _FONTWIDTH + 1, 1)
to
hp = SCREEN(my \ _FONTHEIGHT, mx \ _FONTWIDTH, 1)
it will just error out when the mouse is moved to the very top of the screen, instead of the bottom. The screen function count starts at 1, while mouse row starts at 0, but the point is unless the height of _NEWIMAGE is a multiple of the _FONTHEIGHT, a user is going to experience this error. Again, just something I thought I'd stick in the wik.
Pete
If eggs are brain food, Biden takes his scrambled.