Centering stack on current monitor
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Centering stack on current monitor
Hi,
I am using the following code to toggle fullscreen. I use Ctrl-F for the toggle. I had assumed that when I toggle from fullscreen that the stack would go back to it's original position, but alas it does not. Sometime the stack is positioned so that the top part is missing and thus interaction with the stack is problematic. The workaround I have implemented just centers the stack when the user toggles out of fullscreen mode. Works great on systems with a single monitor. If my stack is showing on a second monitor, the fullscreen mode works, but toggling back and centering puts it back on the main monitor.
Is there any way I can force my stack to be positioned to the center of the second monitor?
Thanks
Bergsy
on centerMe
set the loc of this stack to the screenLoc
end centerMe
on standardPreOpen
centerMe
set the fullscreen of this stack to false
--set the fullscreenmode of this stack to "exactFit"
set the fullscreenmode of this stack to "letterbox"
end standardPreOpen
on handleCommands theKey
--if theKey is not a number then beep
if theKey = "f" or theKey = "F" then
put the fullscreen of this stack into bFullScreen
set the fullscreen of this stack to not bFullScreen
centerMe
end if
end handleCommands
on preOpenStack
standardPreOpen
end preOpenStack
on commandkeyDown theKey
handleCommands theKey
end commandkeyDown
I am using the following code to toggle fullscreen. I use Ctrl-F for the toggle. I had assumed that when I toggle from fullscreen that the stack would go back to it's original position, but alas it does not. Sometime the stack is positioned so that the top part is missing and thus interaction with the stack is problematic. The workaround I have implemented just centers the stack when the user toggles out of fullscreen mode. Works great on systems with a single monitor. If my stack is showing on a second monitor, the fullscreen mode works, but toggling back and centering puts it back on the main monitor.
Is there any way I can force my stack to be positioned to the center of the second monitor?
Thanks
Bergsy
on centerMe
set the loc of this stack to the screenLoc
end centerMe
on standardPreOpen
centerMe
set the fullscreen of this stack to false
--set the fullscreenmode of this stack to "exactFit"
set the fullscreenmode of this stack to "letterbox"
end standardPreOpen
on handleCommands theKey
--if theKey is not a number then beep
if theKey = "f" or theKey = "F" then
put the fullscreen of this stack into bFullScreen
set the fullscreen of this stack to not bFullScreen
centerMe
end if
end handleCommands
on preOpenStack
standardPreOpen
end preOpenStack
on commandkeyDown theKey
handleCommands theKey
end commandkeyDown
Re: Centering stack on current monitor
Look at "screenRects" in the Dictionary. I've used that to determine which screen the user has put the stack.
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Centering stack on current monitor
Hi,
I ended up saving top, left, width, height and loc before going to full screen, and using those saved values when I toggle out of full screen
In case anyone else needs to know
Cheers
Bergsy
I ended up saving top, left, width, height and loc before going to full screen, and using those saved values when I toggle out of full screen
In case anyone else needs to know
Cheers
Bergsy
Re: Centering stack on current monitor
Code: Select all
on mouseUp -- this can be changed to handle cntrl+F
set itemDel to comma
if the width of this stack > (item 3 of the screenRect*50)/100 then
get setStack(50) -- set the stack to 50% of the screen
else
get setStack(100) -- set the stack to 100% of the screen
end if
end mouseUp
function setStack tMsg
set itemDel to comma
set the width of this stack to (item 3 of the screenRect*tMsg)/100
set the height of this stack to (item 4 of the working screenRect*tMsg)/100
set the loc of this stack to the screenLoc
end setStack
Knowledge is meant to be shared.
Re: Centering stack on current monitor
Here's a stack I use to find wayward stack windows in multi screen space - I sometimes park open stacks off screen. It may help.
Walt
Walt
- Attachments
-
- idShowScreen.zip
- (2.88 KiB) Downloaded 243 times
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
-
- Posts: 11
- Joined: Wed Aug 03, 2016 4:24 pm
Re: Centering stack on current monitor
That is brilliant, thank you!