Page 1 of 1

On a small screen, the window is not displayed in the center

Posted: Sat Nov 03, 2018 11:51 am
by Eugene Lutsenko
On a low-resolution screen (for example: 1366x768) the window is not displayed in the center. On the 1920 by 1080 display, everything works correctly. What to do? It may be possible to determine the maximum possible size of a window (without taskbar) automatically? How do I modify this command?

Code: Select all

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP CAPTION mFileName OBJECT oStatic1 ;
      PREEVAL {|o|o:autoSize := .t.} EVAL {|o|hDC1 := GetWindowDC(o:getHWnd()), o:motion := {|a,b,o|ShowColorTr( hDC1, a, oSay, o )},;
      aPixel := Array(o:caption:xSize,o:caption:ySize), o:paint := {|a,b,o|Gratest(o)}}
[/size]

Re: On a small screen, the window is not displayed in the ce

Posted: Sun Nov 04, 2018 11:30 pm
by Eugene Lutsenko
This is how it looks

Re: On a small screen, the window is not displayed in the ce

Posted: Mon Nov 05, 2018 7:22 am
by rdonnay

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0]

FOR i := 1 TO 10
   @ i,1 DCSAY 'This is line ' + Alltrim(Str(i)) SAYSIZE 100
NEXT

DCREAD GUI FIT EVAL {|o|AlignWindow(o)}

RETURN nil

* ---------

FUNCTION AlignWindow( oDlg )

LOCAL aCoords := DC_GetWorkArea(), nBottom, nLeft

nBottom := AppDeskTop():currentSize()[2] - aCoords[4]
nLeft := AppDeskTop():currentSize()[1]/2 - oDlg:currentSize()[1]/2

oDlg:setPos({nLeft,nBottom})

RETURN nil

* ---------

PROC appsys

Re: On a small screen, the window is not displayed in the ce

Posted: Tue Nov 06, 2018 4:41 am
by Eugene Lutsenko
Hey, Roger!

I couldn't use your clue in my case.:

Code: Select all

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP CAPTION mFileName OBJECT oStatic1 ;
      PREEVAL {|o|o:autoSize := .t.} EVAL {|o|hDC1 := GetWindowDC(o:getHWnd()), o:motion := {|a,b,o|ShowColorTr( hDC1, a, oSay, o )},;
      aPixel := Array(o:caption:xSize,o:caption:ySize), o:paint := {|a,b,o|Gratest(o)}}
[/size]