forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Centre Any Application Window?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dave99
Newbie


Joined: 15 Jun 2001
Posts: 24
Location: Torquay, Devon, United Kingdom

PostPosted: Tue Mar 19, 2002 11:16 am    Post subject: Centre Any Application Window? Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Mar 19, 2002 1:42 pm    Post subject: Reply with quote

Here is a quick fix Smile

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
View user's profile Send private message Send e-mail Visit poster's website
dave99
Newbie


Joined: 15 Jun 2001
Posts: 24
Location: Torquay, Devon, United Kingdom

PostPosted: Tue Mar 19, 2002 2:04 pm    Post subject: Reply with quote

Just what I was looking for...

Thanks for you efforts!

Best

Dave


LiquidCode wrote:
Here is a quick fix Smile

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
View user's profile Send private message Send e-mail MSN Messenger
dave99
Newbie


Joined: 15 Jun 2001
Posts: 24
Location: Torquay, Devon, United Kingdom

PostPosted: Tue Mar 19, 2002 4:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Mar 19, 2002 4:43 pm    Post subject: Reply with quote

Man, you just want the world don't you... Ok, Not a problem. Give me
a few and I'll post it.. Very Happy

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dave99
Newbie


Joined: 15 Jun 2001
Posts: 24
Location: Torquay, Devon, United Kingdom

PostPosted: Tue Mar 19, 2002 4:48 pm    Post subject: Reply with quote

'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.. Very Happy
Back to top
View user's profile Send private message Send e-mail MSN Messenger
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Mar 19, 2002 4:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
dave99
Newbie


Joined: 15 Jun 2001
Posts: 24
Location: Torquay, Devon, United Kingdom

PostPosted: Tue Mar 19, 2002 5:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Mar 19, 2002 5:22 pm    Post subject: Reply with quote

Sure, tomorrow it is. Wink
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group