www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to center dlangui on screen

reply greatsam4sure <greatsam4sure gmail.com> writes:
I am learning Dlang and Dlangui.

I encounter, a little problem on:

  how to center dlangui window on screen.

How to set the window width and height outside the constructor

How to maximize and minimize the window using code.

How to set global font for the application.  The font display is 
not too nice.

I have check online, the documentation  and available tutorial to 
no help

Thanks in advance
Nov 28 2018
parent reply Edgar Huckert <edgar.huckert huckert.com> writes:
On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure 
wrote:
 I am learning Dlang and Dlangui.

 I encounter, a little problem on:

  how to center dlangui window on screen.

 How to set the window width and height outside the constructor

 How to maximize and minimize the window using code.

 How to set global font for the application.  The font display 
 is not too nice.

 I have check online, the documentation  and available tutorial 
 to no help

 Thanks in advance
For a little bit of information look at: https://github.com/buggins/dlangui/pull/372 Without going into depth I have tested this under Linux/GTK with dlangui: WindowState state; Rect rect; rect.left = 800; rect.top = 10; rect.bottom = 600; rect.right = 1000; bool bRet= window.setWindowState(state, false, rect); window.show(); This changed the position and size of my initial window. Edgar Huckert
Nov 28 2018
next sibling parent reply greatsam4sure <greatsam4sure gmail.com> writes:
On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert 
wrote:
 On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure 
 wrote:
 I am learning Dlang and Dlangui.

 I encounter, a little problem on:

  how to center dlangui window on screen.

 How to set the window width and height outside the constructor

 How to maximize and minimize the window using code.

 How to set global font for the application.  The font display 
 is not too nice.

 I have check online, the documentation  and available tutorial 
 to no help

 Thanks in advance
For a little bit of information look at: https://github.com/buggins/dlangui/pull/372 Without going into depth I have tested this under Linux/GTK with dlangui: WindowState state; Rect rect; rect.left = 800; rect.top = 10; rect.bottom = 600; rect.right = 1000; bool bRet= window.setWindowState(state, false, rect); window.show(); This changed the position and size of my initial window. Edgar Huckert
This help a little but not what I am looking for. I want to calculate the width and window of the screen so as to center my window on screen I also notice that a window of 350 x 550 appear bigger compare to the same Widow dimension in Havana and adobe air. Why is it so? Plz help! Thanks in advance
Nov 28 2018
parent reply bauss <jj_1337 live.dk> writes:
On Wednesday, 28 November 2018 at 23:07:50 UTC, greatsam4sure 
wrote:
 On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert 
 wrote:
 On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure 
 wrote:
 I am learning Dlang and Dlangui.

 I encounter, a little problem on:

  how to center dlangui window on screen.

 How to set the window width and height outside the constructor

 How to maximize and minimize the window using code.

 How to set global font for the application.  The font display 
 is not too nice.

 I have check online, the documentation  and available 
 tutorial to no help

 Thanks in advance
For a little bit of information look at: https://github.com/buggins/dlangui/pull/372 Without going into depth I have tested this under Linux/GTK with dlangui: WindowState state; Rect rect; rect.left = 800; rect.top = 10; rect.bottom = 600; rect.right = 1000; bool bRet= window.setWindowState(state, false, rect); window.show(); This changed the position and size of my initial window. Edgar Huckert
This help a little but not what I am looking for. I want to calculate the width and window of the screen so as to center my window on screen I also notice that a window of 350 x 550 appear bigger compare to the same Widow dimension in Havana and adobe air. Why is it so? Plz help! Thanks in advance
To center horizontal: l = left s = screen width w = window width l = (s / 2) - (w / 2) To center vertical: t = top s = screen height h = window height t = (s / 2) - (h / 2) And about the window size. It has probably to do with the type of Window you're rendering, like whether it has borders or not. Borders are not calculated in the width / height, so they take up extra space. Adobe usually never uses the native GUI for borders etc. so the border size (if there is one) is included in their width / height.
Nov 28 2018
parent reply greatsam4sure <greatsam4sure gmail.com> writes:
On Thursday, 29 November 2018 at 05:54:37 UTC, bauss wrote:
 On Wednesday, 28 November 2018 at 23:07:50 UTC, greatsam4sure 
 wrote:
 On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert 
 wrote:
 On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure 
 wrote:
 [...]
For a little bit of information look at: https://github.com/buggins/dlangui/pull/372 Without going into depth I have tested this under Linux/GTK with dlangui: WindowState state; Rect rect; rect.left = 800; rect.top = 10; rect.bottom = 600; rect.right = 1000; bool bRet= window.setWindowState(state, false, rect); window.show(); This changed the position and size of my initial window. Edgar Huckert
This help a little but not what I am looking for. I want to calculate the width and window of the screen so as to center my window on screen I also notice that a window of 350 x 550 appear bigger compare to the same Widow dimension in Havana and adobe air. Why is it so? Plz help! Thanks in advance
To center horizontal: l = left s = screen width w = window width l = (s / 2) - (w / 2) To center vertical: t = top s = screen height h = window height t = (s / 2) - (h / 2) And about the window size. It has probably to do with the type of Window you're rendering, like whether it has borders or not. Borders are not calculated in the width / height, so they take up extra space. Adobe usually never uses the native GUI for borders etc. so the border size (if there is one) is included in their width / height.
Which class in dlangui is use to obtain the screen height and width? A Windom of dimension 280 x 445 in dlangui is the same as a Windom of 350 x 550 in Javafx and adobe air. What could be responsible for this wide difference? A window of 350 x 550 in adobe air is the same as a window of 350 x 550 in javafx. So why is dlangui window bigger? Note that I am using w x h for my window dimension and I am on windows 10
Nov 29 2018
parent John Chapman <johnch_atms hotmail.com> writes:
On Thursday, 29 November 2018 at 13:42:28 UTC, greatsam4sure 
wrote:
 Which class in dlangui is use to obtain the screen height and 
 width?
 A Windom of dimension 280 x 445 in dlangui is the same as a 
 Windom of 350 x 550 in Javafx and adobe air.

 What could be responsible for this wide difference?
 A window of 350 x 550 in adobe air is the same as a window of 
 350 x 550 in javafx. So why is dlangui window bigger?

 Note that I  am using  w x h for my window dimension and I am 
 on windows 10
That looks like DPI scaling is in effect: 280 pixels + 125% DPI = 350. There's an example of how to get the screen size here (look for getScreenDimensions): https://github.com/buggins/dlangui/blob/60159c61e27d86012fbf8f205c75d30196fc0e52/src/dlangui/platforms/windows/winapp.d
Nov 29 2018
prev sibling parent greatsam4sure <greatsam4sure gmail.com> writes:
On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert 
wrote:
 On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure 
 wrote:
 I am learning Dlang and Dlangui.

 I encounter, a little problem on:

  how to center dlangui window on screen.

 How to set the window width and height outside the constructor

 How to maximize and minimize the window using code.

 How to set global font for the application.  The font display 
 is not too nice.

 I have check online, the documentation  and available tutorial 
 to no help

 Thanks in advance
For a little bit of information look at: https://github.com/buggins/dlangui/pull/372 Without going into depth I have tested this under Linux/GTK with dlangui: WindowState state; Rect rect; rect.left = 800; rect.top = 10; rect.bottom = 600; rect.right = 1000; bool bRet= window.setWindowState(state, false, rect); window.show(); This changed the position and size of my initial window. Edgar Huckert
This help a little but not what I am looking for. I want to calculate the width and height of the screen so as to center my window on screen I also notice that a window of 350 x 550 appear bigger compare to the same Widow dimension in javafx and adobe air. Why is it so? Plz help! Thanks in advance
Nov 28 2018