Blog Post #77: Notebook, Part I

Ron Tarrant rontarrant at gmail.com
Tue Oct 15 12:40:40 UTC 2019


On Wednesday, 9 October 2019 at 03:13:48 UTC, GreatSam4sure wrote:

> Is there any way to detect the size of my screen using gtkd? So 
> that incan calculate the size of my screen and center my window 
> on the screen using move(x, y).

I was distracted last time I replied to this thread and so 
overlooked the obvious.

This is actually very simple to do. Add this to your Window or 
MainWindow constructor:

Window.setPosition(WindowPosition.CENTER);

That's it.

Here's a full example, so you can see it in its natural habitat: 
https://github.com/rontarrant/gtkDcoding/blob/master/001_window/window_001_11_centered.d


More information about the Digitalmars-d-learn mailing list