Centering a window
BlitzPlus Forums/BlitzPlus Programming/Centering a window| 
 | ||
| How would i go about this without having it end up 'between' two monitors on a dual monitor set up? (ie: i want to center it on the main monitor). Purebasic has the #PB_Window_ScreenCentered flag for this and that works great, but in B+, all i can get it to do is end up half way between the two monitors in my dual monitor setup :) Tracer | 
| 
 | ||
| Hard code it.  If the resolution width is twice the expected amount considering the vertical resolution, then divide the width by 4 instead of 2. | 
| 
 | ||
| The problem is Wolron, these days i could place the second monitor 'below' my main monitor, or even above and to the right, etc .. so that kind of hardcoding doesn't really work. for example:  Tracer | 
| 
 | ||
| I know, it was a simple solution... | 
| 
 | ||
| If you want to center it on one moniter then: 
width=1024     'Your SINGLE MONITER's resolution dimensions here
height=768
winw=640
winh=480
winx=(width/2)-(winw/2)
winy=(height/2)-(winh/2)
window=CreateWindow("Centered Window",winx,winy,winw,winh)
Also I think there is a center window sample in the samples directory. | 
| 
 | ||
| and use SetGadgetShape if any changes occur in Resolution, and GagdetWidth(Desktop()) (as weel as Height) to get the width and height in unknown cases......of course |