View previous topic :: View next topic |
Author |
Message |
dave99 Newbie
Joined: 15 Jun 2001 Posts: 24 Location: Torquay, Devon, United Kingdom
|
Posted: Tue Mar 19, 2002 11:16 am Post subject: Centre Any Application Window? |
|
|
Hopefully a simple one...
What would be the standard way to centre, say an Excel window?
I know it would be a combination of obtaining the current screen resolution and current size of the named window.
Help?
Thanks
Dave 8O |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Mar 19, 2002 1:42 pm Post subject: |
|
|
Here is a quick fix
Code: |
%%win = #MyWindowClass
%%sh = @sysinfo(screenheight)
%%sw = @sysinfo(screenwidth)
parse "%w;%h",@winpos(%%win,WH)
%%nt = @div(@diff(%%sh,%h),2)
%%nl = @div(@diff(%%sw,%w),2)
rem %%nt has the new top position
rem %%nl has the new left position
window position,%%win,%%nt,%%nl
|
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
dave99 Newbie
Joined: 15 Jun 2001 Posts: 24 Location: Torquay, Devon, United Kingdom
|
Posted: Tue Mar 19, 2002 2:04 pm Post subject: |
|
|
Just what I was looking for...
Thanks for you efforts!
Best
Dave
LiquidCode wrote: | Here is a quick fix
Code: |
%%win = #MyWindowClass
%%sh = @sysinfo(screenheight)
%%sw = @sysinfo(screenwidth)
parse "%w;%h",@winpos(%%win,WH)
%%nt = @div(@diff(%%sh,%h),2)
%%nl = @div(@diff(%%sw,%w),2)
rem %%nt has the new top position
rem %%nl has the new left position
window position,%%win,%%nt,%%nl
|
|
|
|
Back to top |
|
|
dave99 Newbie
Joined: 15 Jun 2001 Posts: 24 Location: Torquay, Devon, United Kingdom
|
Posted: Tue Mar 19, 2002 4:35 pm Post subject: |
|
|
Ok...on a similar vein.
If I had, say four windows and I wanted them to cover the screen in equal sizes/quadrants?
Dave |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Mar 19, 2002 4:43 pm Post subject: |
|
|
Man, you just want the world don't you... Ok, Not a problem. Give me
a few and I'll post it.. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
dave99 Newbie
Joined: 15 Jun 2001 Posts: 24 Location: Torquay, Devon, United Kingdom
|
Posted: Tue Mar 19, 2002 4:48 pm Post subject: |
|
|
'course I do!
Hey, I really appreciate the time you are taking and it's teaching me a lot!
Thanks mate
Dave
LiquidCode wrote: | Man, you just want the world don't you... Ok, Not a problem. Give me
a few and I'll post it.. |
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Mar 19, 2002 4:57 pm Post subject: |
|
|
Ok, Here it is. The Variables [%%win#] are
set to window ID numbers that I just used to test the code. You
can replace thoes numbers with other ID #'s, Class names or
window titles. The best way to do it, is to use ither the ID # or
Class name.
Code: |
%%win1 = "%3904"
%%win2 = "%524"
%%win3 = "%3912"
%%win4 = "%1856"
%%sw = @sysinfo(screenwidth)
%%sh = @sysinfo(screenheight)
%%sw2 = @div(%%sw,2)
%%sh2 = @div(%%sh,2)
window position,%%win1,0,0,%%sw2,%%sh2
window position,%%win2,%%sh2,0,%%sw2,%%sh2
window position,%%win3,0,%%sw2,%%sw2,%%sh2
window position,%%win4,%%sh2,%%sw2,%%sw2,%%sh2
|
Take Care and have fun! _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
dave99 Newbie
Joined: 15 Jun 2001 Posts: 24 Location: Torquay, Devon, United Kingdom
|
Posted: Tue Mar 19, 2002 5:05 pm Post subject: |
|
|
When you said "give me a few", I expected hours, not minutes!
I think I have used up your generosity today...maybe tomorrow? <grin>
Thanks again
Dave |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|