Page 1 of 1

Problems moving displays....

Posted: Tue Apr 03, 2012 12:08 am
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!

Re: Problems moving displays....

Posted: Tue Apr 03, 2012 8:15 am
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 ;)

Re: Problems moving displays....

Posted: Tue Apr 03, 2012 11:47 pm
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?

Re: Problems moving displays....

Posted: Wed Apr 04, 2012 7:23 am
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

Re: Problems moving displays....

Posted: Wed Apr 04, 2012 8:47 pm
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...

Re: Problems moving displays....

Posted: Tue Apr 10, 2012 11:53 am
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.

Re: Problems moving displays....

Posted: Tue Apr 10, 2012 1:35 pm
by Tuxedo
ok,
thank you for the reply.