Page 1 of 1

SetDisplayAtrributes x & y don't work except for positional constants

Posted: Sun Nov 17, 2019 1:22 am
by NathanH
Hi,

I'm running Hollywood 8 on both WinUAE OS3.9 and AROS i-386. I would expect the following code to keep the changing display at coordinates (150, 150). It doesn't, it shifts to the center of the screen instead. If you use position constants (e.g., horizontal=#CENTER and vertical=#TOP) things work as expected. The display stays at the top of the screen. I thought that I could remedy this problem by using MoveDisplay() at the end of the function to place the display where I want it. Try uncommenting this line and the display appears to jump to random positions with each click. Seems like a bug to me and I haven't been able to find a work-around for my project. Thanks.

NathanH

@DISPLAY {width=60, height=60, borderless=True, DragRegion={{Type=#BOX, X=0, Y=0, Width=60, Height=60}}}

horizontal=150
vertical=150
dwidth=60
dheight=60
dcolor=#BLACK
gtype=#CONICAL
color1=#TEAL
color2=#BLUE
gangle=15

Function p_ChangeSize()
dwidth=10+Rnd(100)
dheight=10+Rnd(100)

SetDisplayAttributes({x=horizontal, y=vertical, width=dwidth, height=dheight, color=dcolor})
SetFillStyle(#FILLGRADIENT,gtype, color1, color2, gangle)
SetDisplayAttributes({DragRegion={{Type=#BOX, X=0, Y=0, Width=dwidth, Height=9}}})
Box(0, 9, dwidth, dheight-9)
Line(0, 0, 0, dheight, #WHITE)

;MoveDisplay(horizontal, vertical)
EndFunction

InstallEventHandler({OnMouseUp=p_ChangeSize})
p_ChangeSize()

Repeat
WaitEvent
Forever

Re: SetDisplayAtrributes x & y don't work except for positional constants

Posted: Sun Nov 17, 2019 7:03 am
by emeck
Tested under MOS3.12 and same behaviour.

But this works as a quick fix:

horizontal=#LEFT + 150
vertical=#TOP + 150

Re: SetDisplayAtrributes x & y don't work except for positional constants

Posted: Sun Nov 17, 2019 1:27 pm
by airsoftsoftwair
Yes, looks like a bug. Will be fixed.

Re: SetDisplayAtrributes x & y don't work except for positional constants

Posted: Sun Nov 17, 2019 11:30 pm
by NathanH
Thanks very much to both of you!

NathanH

Re: SetDisplayAtrributes x & y don't work except for positional constants

Posted: Sat Dec 14, 2019 1:07 pm
by airsoftsoftwair

Code: Select all

- Fix: When changing display size and position in one SetDisplayAttributes() call, SetDisplayAttributes()
  automatically centered the display in case the coordinates passed in "X" and "Y" were identical to the
  current display position