Client Co-ordinates

BlitzPlus Forums/BlitzPlus Programming/Client Co-ordinates

thalamus(Posted 2006) [#1]
I'm trying to create a resizeable window which always stays in the centre of the screen (the user can expand/contract the window with keypresses, not by dragging the mouse).

I've had a hard time working out why the window isn't being centred properly, and I think it may be down to client co-ordinates being used.

I know that ClientWidth/Height return the value without borders, but what's the relevance of setting up a window with client co-ordinates int he style flag?


Petron(Posted 2006) [#2]
I have no idea, but I think it sounds cool. You might want to try something like: If varible equals this then graphics is this. Along with that you could have the program constantly moving the window to the center of the screen so it appears to be sentered at all times.


Petron(Posted 2006) [#3]
sorry about my horrid spelling


Nicstt(Posted 2006) [#4]
CreateWindow("test", 5, 5, 800, 600)

WaitKey

coords 5,5 position it at 5,5 on wondows desktop.

only way i can see is to destroy a window when resized and create it again - that will be noticable though

obtain ms windows screen size by using desktop() gadget:
desk_W = ClientWidth(Desktop())
desk_H = ClientHeight(Desktop())


Arem(Posted 2006) [#5]
Try gadgetwidth(), gadgetheight(), clientwidth(desktop()), clientheight(desktop()) and setgadgetshape().

Find the size of the window with gadgetwidth() and gadgetheight(), then find the screensize with clientwidth(desktop()) and clientheight(desktop()), then calculate where the top left pixel should be and use setgadgetshape() to put the window there.


Petron(Posted 2006) [#6]
Instead of making a new window why don't you have the location a variable that is adjusted as the window is resized.