Wrong value for ATTRHEIGHT

Report any Hollywood bugs here
Post Reply
User avatar
emeck
Posts: 113
Joined: Fri Apr 03, 2015 3:17 pm

Wrong value for ATTRHEIGHT

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE

PEB
Posts: 556
Joined: Sun Feb 21, 2010 1:28 am

Re: Wrong value for ATTRHEIGHT

Post by PEB »

Your code is a bit wrong.
Try this instead:

Code: Select all

DebugPrint(GetAttribute(#DISPLAY, 1, #ATTRWIDTH))
DebugPrint(GetAttribute(#DISPLAY, 1, #ATTRHEIGHT))

User avatar
emeck
Posts: 113
Joined: Fri Apr 03, 2015 3:17 pm

Re: Wrong value for ATTRHEIGHT

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE

PEB
Posts: 556
Joined: Sun Feb 21, 2010 1:28 am

Re: Wrong value for ATTRHEIGHT

Post 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).

User avatar
emeck
Posts: 113
Joined: Fri Apr 03, 2015 3:17 pm

Re: Wrong value for ATTRHEIGHT

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE

User avatar
airsoftsoftwair
Posts: 4767
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Wrong value for ATTRHEIGHT

Post 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.

Post Reply