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

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

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

#1 Post 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]

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

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

#2 Post by Eugene Lutsenko »

This is how it looks
Attachments
Error.jpg
Error.jpg (50.44 KiB) Viewed 7620 times
Correctly.jpg
Correctly.jpg (41.96 KiB) Viewed 7620 times

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

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

#3 Post 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
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

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

#4 Post 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]

Post Reply