Re: NewEra 2.2 - How can I center a Window?
Posted in 1997
Topics: General Discussion
Tim Simpson wrote: } } NewEra 2.2 } } In Visual Basic I was able to position a form at run-time so that it was } centered on the screen. This was done with something like:- } } let form.Left = (Screen.width - form.width)/2 } let form.top = (screen.height - form.height)/2 } } I can't think of a way to do it, in NewEra. } } Can it be done? } } It is useful so that regardless of what screen resolution a PC may be } running the VGA 640-480 designed window will always start in the center } of the screen. A user can then re-position if he likes. } } It keeps it neat and tidy. } } -- } Tim Simpson You can get the width and height of the NewEra window with the getsize() function. Call it in this way CALL win.getsize() RETURNING x,y (x and y's are INTEGER values) However, getting the screen width is a bit tricky... I dont think NewEra has any functions that return the resolution, so you'll have to use C++ / SDK. If you find a way to get the screen resolution, contact me... David