Page 1 of 1
Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 12:41 am
by emeck
ATTRHEIGHT for #DISPLAY seems to return the ATTRWIDTH value. In this example
Code: Select all
@DISPLAY 1, {Mode = "Windowed", Width = 800, Height = 600, FillStyle = #FILLCOLOR, Color = #GRAY, NoModeSwitch = TRUE, Layers = TRUE}
DebugPrint(GetAttribute(#DISPLAY, 1, ATTRWIDTH))
DebugPrint(GetAttribute(#DISPLAY, 1, ATTRHEIGHT))
the debug output is:
800
800
This is with HW9 on MOS 3.15 and Linux arm.
Re: Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 12:59 am
by PEB
Your code is a bit wrong.
Try this instead:
Code: Select all
DebugPrint(GetAttribute(#DISPLAY, 1, #ATTRWIDTH))
DebugPrint(GetAttribute(#DISPLAY, 1, #ATTRHEIGHT))
Re: Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 1:56 am
by emeck
@PEB
Ah! Silly me, there was something odd but couldn't spot it. Guess it is bed time for me.
Thanks for the tip.
@Andreas
Shouldn't that throw some error or warning? Where are those values coming from? Seems always to be the width value from the several retries I did.
Re: Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 4:38 am
by PEB
Constants such as #ATTRWIDTH and #ATTRHEIGHT have number values assigned to them (0 and 1 respectively).
Code: Select all
DebugPrint(#ATTRWIDTH, #ATTRHEIGHT)
But when you weren't using the constants, ATTRWIDTH and ATTRHEIGHT were taken as variables that had not yet been assigned a value, so they were equal to zero (same as the constant #ATTRWIDTH).
Re: Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 9:24 am
by emeck
PEB wrote: ↑Sun Sep 19, 2021 4:38 am
Constants such as #ATTRWIDTH and #ATTRHEIGHT have number values assigned to them (0 and 1 respectively).
Code: Select all
DebugPrint(#ATTRWIDTH, #ATTRHEIGHT)
But when you weren't using the constants, ATTRWIDTH and ATTRHEIGHT were taken as variables that had not yet been assigned a value, so they were equal to zero (same as the constant #ATTRWIDTH).
Yes, that is the theory and what I expected, but no matter what display size is opened, if I forget the "#" both undeclared "variables" get assigned the display's width value, not 0.
Re: Wrong value for ATTRHEIGHT
Posted: Sun Sep 19, 2021 11:54 am
by airsoftsoftwair
emeck wrote: ↑Sun Sep 19, 2021 9:24 am
Yes, that is the theory and what I expected, but no matter what display size is opened, if I forget the "#" both undeclared "variables" get assigned the display's width value, not 0.
No, they will be 0, the return value will be the display's width value because, as PEB has explained, 0 is the same as #ATTRWIDTH.