Inactive Displays
Inactive Displays
Hi,
With MUI you can specify that a window will not become the active window when opened. You can change text, etc. on the window and it remains inactive. Is it possible to add an option for @DISPLAY and OpenDisplay() to open without ever becoming the active window in this sense of the word? This would prevent redraws by the OS (flickering) when a display is opened or closed. Thanks.
NathanH
With MUI you can specify that a window will not become the active window when opened. You can change text, etc. on the window and it remains inactive. Is it possible to add an option for @DISPLAY and OpenDisplay() to open without ever becoming the active window in this sense of the word? This would prevent redraws by the OS (flickering) when a display is opened or closed. Thanks.
NathanH
Re: Inactive Displays
... and remains inactive until clicked by user or activated programmatically.
NathanH
NathanH
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Inactive Displays
This is possible already. Just set the "Active" tag to FALSE in CreateDisplay() or @DISPLAY, e.g.
Code: Select all
CreateDisplay(2, {Active = False})
OpenDisplay(2)
Re: Inactive Displays
Thanks!
NathanH
NathanH
Re: Inactive Displays
Hi,
I tried that setting but it still becomes active. I've written an animation of a lemming that walks across the screen using CloseDisplay(), MoveDisplay(), and OpenDisplay() which works great. It's smooth, fast, no flicker, and the background isn't distorted at all as he walks. I tried a whole bunch of different ways to do it but this way works best.
When I tell the program to keep him on the Workbench Screen rather than the frontmost screen, however, it locks the Workbench Screen. I can't send it behind to work on another screen because it keeps jumping back to the Workbench Screen with every OpenDisplay(). I've tried not using OpenDisplay() and CloseDisplay() but the MoveDisplay() then distorts the background as he walks.
That's why my wishlist includes a display which remains inactive when being opened and used; so that the screen the display is using doesn't come forward while the display is opened or updated. That way I can be using another screen while the display is being opened, updated, etc. I can see why it works the way it does as it is counterintuitive that you would _not_ want to see the display as it is used.
NathanH
I tried that setting but it still becomes active. I've written an animation of a lemming that walks across the screen using CloseDisplay(), MoveDisplay(), and OpenDisplay() which works great. It's smooth, fast, no flicker, and the background isn't distorted at all as he walks. I tried a whole bunch of different ways to do it but this way works best.
When I tell the program to keep him on the Workbench Screen rather than the frontmost screen, however, it locks the Workbench Screen. I can't send it behind to work on another screen because it keeps jumping back to the Workbench Screen with every OpenDisplay(). I've tried not using OpenDisplay() and CloseDisplay() but the MoveDisplay() then distorts the background as he walks.
That's why my wishlist includes a display which remains inactive when being opened and used; so that the screen the display is using doesn't come forward while the display is opened or updated. That way I can be using another screen while the display is being opened, updated, etc. I can see why it works the way it does as it is counterintuitive that you would _not_ want to see the display as it is used.
NathanH
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Inactive Displays
Please provide an MCVE which shows the problem.
Re: Inactive Displays
Hi,
If you want the gif image please let me know and I can e-mail it to you. Thanks.
NathanH
If you want the gif image please let me know and I can e-mail it to you. Thanks.
NathanH
Code: Select all
@DISPLAY 1, {Hidden=True}
@FILE 1, "walkr.gif"
@ANIM 1, "walkr.gif", {Transparency=0, Width=32, Height=32, Frames=8}
;some contants; they are set during compilation while GetAttribute happens at run-time
#FWIDTH=32 ;frame width
#FHEIGHT=32 ;frame height
#FRAMES=8
SWIDTH=GetAttribute(#DISPLAY, 1, #ATTRMAXWIDTH) ;screen width
SHEIGHT=GetAttribute(#DISPLAY, 1, #ATTRMAXHEIGHT) ;screen height
SFLOOR=SHEIGHT-#FHEIGHT ;screen floor
SPUBLIC=GetAttribute(#DISPLAY, 1, #ATTRPUBSCREEN) ;public screen
cnt=0 ;pixels moved
move=0 ;moves for current background grab
frame=1 ;current frame to display
blag=0 ;brush id with background lagging behind as display moves
blead=0 ;brush id with background leading as display moves
bback=0 ;background brush
Function p_Walk()
move=move+1
cnt=cnt+1
If cnt+#FWIDTH>SWIDTH Then End()
frame=frame+1
If frame>#FRAMES Then frame=1
;after we've moved a frame
If move=#FWIDTH
move=0
FreeBrush(blag)
blag=blead
blead=GrabDesktop(Nil, {X=cnt+#FWIDTH, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
SelectBrush(bback)
DisplayBrush(blag, #LEFT, #TOP)
DisplayBrush(blead, #FWIDTH, #TOP)
EndSelect()
EndIf
CloseDisplay(2)
DisplayBrushPart(bback, move, #TOP, #CENTER, #CENTER, #FWIDTH, #FHEIGHT)
DisplayAnimFrame(1, #CENTER, #CENTER, frame)
MoveDisplay(cnt, SFLOOR)
OpenDisplay(2, {Active=False})
EndFunction
CreateDisplay(2, {X=#LEFT, Y=#BOTTOM, Width=#FWIDTH, Height=#FHEIGHT, Borderless=True, Active=False, PubScreen=SPUBLIC})
;grab lagging and leading background frames
blag=GrabDesktop(Nil, {X=0, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
blead=GrabDesktop(Nil, {X=#FWIDTH, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
SelectDisplay(2)
;create background brush
bback=CreateBrush(Nil, #FWIDTH*2, #FHEIGHT)
SelectBrush(bback)
DisplayBrush(blag, #LEFT, #TOP)
DisplayBrush(blead, #FWIDTH, #TOP)
EndSelect()
;initial display includes only the lagging background frame
ChangeDisplaySize(32, 32)
MoveDisplay(#LEFT, SFLOOR)
DisplayBrushPart(bback, #LEFT, #TOP, #CENTER, #CENTER, #FWIDTH, #FHEIGHT)
DisplayAnimFrame(1, #CENTER, #CENTER, frame)
OpenDisplay(2, {Active=False})
Repeat
Wait(5, #TICKS)
p_Walk()
Forever
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Inactive Displays
Aaah, that's not really an MCVE. There's a lot of code in that example and there are even external file dependencies... please try to make that shorter
Re: Inactive Displays
Hi,
Sorry, here's a code snippet that shows that OpenDisplay with Active=False still brings the Workbench screen forward so that you cannot work on another screen while the animation is occurring. Please also note how the display does not appear in the bottom-left of the screen as requested in the CreateDisplay() command which is likely a bug. Thanks for your help.
NathanH
Sorry, here's a code snippet that shows that OpenDisplay with Active=False still brings the Workbench screen forward so that you cannot work on another screen while the animation is occurring. Please also note how the display does not appear in the bottom-left of the screen as requested in the CreateDisplay() command which is likely a bug. Thanks for your help.
NathanH
Code: Select all
@DISPLAY 1, {Hidden=True}
SPUBLIC=GetAttribute(#DISPLAY, 1, #ATTRPUBSCREEN) ;public screen
Function p_Walk()
CloseDisplay(2) ;commenting these lines out allows user to work on another screen
OpenDisplay(2, {Active=False}) ;commenting these lines out allows user to work on another screen
EndFunction
CreateDisplay(2, {X=#LEFT, Y=#BOTTOM, Width=100, Height=100, Borderless=True, Active=False, PubScreen=SPUBLIC})
SelectDisplay(2)
ChangeDisplaySize(32, 32)
OpenDisplay(2, {Active=False})
Repeat
Wait(5, #TICKS)
p_Walk()
Forever
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Inactive Displays
Still can't reproduce this. When I start your script from a console, the console window remains active, i.e. no display opened by the script is ever made active which, AFAICS, is the expected behaviour because you set Active=False.