Problems moving displays....

Find quick help here to get you started with Hollywood
Post Reply
User avatar
Tuxedo
Posts: 355
Joined: Sun Feb 14, 2010 12:41 pm

Problems moving displays....

Post by Tuxedo »

Hi!
I've areally weird problem on that example code:

Code: Select all

@DISPLAY 1, {Title = "Display 1", Width = 640, Height = 512, X = 300, Y = 300}
@DISPLAY 2, {Title = "Display 2",Width = 200, Height = 100, X = 0, Y = 0}
@DISPLAY 3, {Title = "Display 3",Width = 300, Height = 50, X = 305, Y = 0}
@DISPLAY 4, {Title = "Display 4",Width = 200, Height = 200, X = 0, Y = 250}


Function p_MoveWindow(msg)

			SelectDisplay(2, TRUE)
				MoveDisplay(msg.x - 100, msg.y - 100)
			SelectDisplay(1, TRUE)

			SelectDisplay(3, TRUE)
				SetDisplayAttributes({X = msg.x - 100, Y = msg.y + 100})
			SelectDisplay(1, TRUE)

			SelectDisplay(4, TRUE)
				ChangeDisplaySize(200, 200, {X = msg.x -200, Y = msg.y + 300})
			SelectDisplay(1, TRUE)

	DebugPrint(msg.x, msg.y)
EndFunction

InstallEventHandler({MoveWindow = p_MoveWindow})

Repeat
	WaitEvent
Forever
The problems was:

- Why the DebugPrin() function was triggered imediately but the move functions that moves windows not? Maybe the system(AmigaOS4.x here) cant move more than one window at a time?

- Whty the only function that works as expected was he ChangeDisplaySize() function? That was the uglyest and less appropriate for doing was I want to do since every time it moves/chanche also the size and so the display flashes...

Have I made some weird mistake?

Also...Why when we have to move/change a display we have to call such ugly looking for code reading SelectDisplay() function avery time? Wasnt easyest and more clean to have a function like:

SetDisplayAttributes(id , talbe)

Any problem doing that?

Probably I miss somthing...

That's all, thank you for reading!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
Allanon
Posts: 742
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Problems moving displays....

Post by Allanon »

HI Tuxedo,
the routine you have done is fine, but you don't need to use the SelectDisplay function, instead you have to activate the display you want to move, SelectDisplay is only usefull for drawing operations ;)
----------------------------
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | All my links
User avatar
Tuxedo
Posts: 355
Joined: Sun Feb 14, 2010 12:41 pm

Re: Problems moving displays....

Post by Tuxedo »

Hi and thank you for relpy!
I changed the code in:

Code: Select all

@DISPLAY 1, {Title = "Display 1", Width = 640, Height = 512, X = 300, Y = 300}
@DISPLAY 2, {Title = "Display 2",Width = 200, Height = 100, X = 0, Y = 0}
@DISPLAY 3, {Title = "Display 3",Width = 300, Height = 50, X = 305, Y = 0}
@DISPLAY 4, {Title = "Display 4",Width = 200, Height = 200, X = 0, Y = 250}


Function p_MoveWindow(msg)

IF msg.id  = 1
			ActivateDisplay(2, TRUE)
				MoveDisplay(msg.x - 100, msg.y - 100)

			ActivateDisplay(3, TRUE)
				SetDisplayAttributes({X = msg.x - 100, Y = msg.y + 100})

			ActivateDisplay(4, TRUE)
				ChangeDisplaySize(200, 200, {X = msg.x -200, Y = msg.y + 300})
			ActivateDisplay(1)
EndIF

;	DebugPrint(msg.x, msg.y)
EndFunction

InstallEventHandler({MoveWindow = p_MoveWindow})

Repeat
	WaitEvent
Forever
But weirdness was increased...
now the main window(number 1) after move flashes arounf the workbench as mad...

Where I'm wrong?

And why was moved the window 1 since no command moves it?
Simone"Tuxedo"Monsignori, Perugia, ITALY.
jalih
Posts: 280
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Problems moving displays....

Post by jalih »

Allanon wrote:HI Tuxedo,
the routine you have done is fine, but you don't need to use the SelectDisplay function, instead you have to activate the display you want to move, SelectDisplay is only usefull for drawing operations ;)
Actually SelectDisplay() seems to be required for handling the moving of multiple windows on event callback (Seems to be, at least on Hollywood 4.7).

Something like this works for me:

Code: Select all

    @DISPLAY 1, {Title = "Display 1", Width = 640, Height = 512, X = 205, Y = 0}
    @DISPLAY 2, {Title = "Display 2",Width = 200, Height = 100, X = 5, Y = 0}
    @DISPLAY 3, {Title = "Display 3",Width = 200, Height = 150, X = 5, Y = 205}


Function p_MoveWindow(msg)
	If msg.id  = 1
		SelectDisplay(2, True)
		MoveDisplay(msg.x - 205, msg.y)
		SelectDisplay(3, True)
		SetDisplayAttributes({X = msg.x - 205, Y = msg.y + 125 })
		SelectDisplay(1)
		Cls()
		TextOut(#CENTER, #CENTER, "x:" ..msg.x .." y:" ..msg.y)
	EndIf
EndFunction

InstallEventHandler({MoveWindow = p_MoveWindow})

Repeat
	WaitEvent
Forever
User avatar
Tuxedo
Posts: 355
Joined: Sun Feb 14, 2010 12:41 pm

Re: Problems moving displays....

Post by Tuxedo »

the code wasnt working as expected neither in that way...

It works randomly and with weird displays glitches...
Sometime the displays appear(aftert release left mouse button) sometimes flash around for the screen sometime simply disappears...

Or its an OS4.x problem or an Hollywood problem...
And however they wont move toghter the dragged window but only when it was "placed"...

I need that the "child" displays moves toghter the parent...
I've to change my idea since it wasnt working...

Hope that Andreas will solve that rebus...
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Problems moving displays....

Post by airsoftsoftwair »

I think it's not possible what you want to achieve. It's not guaranteed that you get the "MoveWindow" event while the move is in progress. It might also be just sent when the user has finished moving the window.
User avatar
Tuxedo
Posts: 355
Joined: Sun Feb 14, 2010 12:41 pm

Re: Problems moving displays....

Post by Tuxedo »

ok,
thank you for the reply.
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Post Reply