Page 1 of 2

window:center() doesn´t work right

Posted: Wed Oct 17, 2007 4:46 pm
by AHF
Hello,

Issuing a window:center method it doesn't center the window correctly. It seems to work only correct with dialogs.

Is is a bug, anyone has some work around ?

Antonio

Posted: Wed Oct 17, 2007 5:00 pm
by Antonio Linares
Its working fine used this way:

Code: Select all

   ACTIVATE WINDOW oWnd ;
      ON INIT oWnd:Center()

Posted: Wed Oct 17, 2007 5:07 pm
by AHF
I'm using build Marhc 2006. Is it ok ?

Posted: Wed Oct 17, 2007 5:08 pm
by Antonio Linares
Please try it that way, thanks

Posted: Thu Oct 18, 2007 2:35 pm
by AHF
Antonio,

This is not working the center() is not caculated right.

Antonio

Posted: Mon Oct 22, 2007 4:44 pm
by AHF
Antonio,

I've tried it but it doesn't centers the window.


Antonio

Posted: Mon Oct 22, 2007 6:31 pm
by Antonio Linares
Antonio,

Do you want to center it in the main screen, or regarding its parent window (or dialog) ?

Posted: Tue Oct 23, 2007 9:17 am
by AHF
Antonio,

I want to center it regarding its parent window.

Regards
Antonio

Posted: Tue Oct 23, 2007 9:26 am
by Antonio Linares
Hazlo así:

oWnd:Center( oWndParent )

Posted: Tue Oct 23, 2007 9:45 am
by AHF
Antonio,

It doesn't work result it's the same, not centered.

Regards

Posted: Tue Oct 23, 2007 9:51 am
by Antonio Linares
Antonio,

Please try this test:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "Center test"

   ACTIVATE WINDOW oWnd ;
      ON INIT BuildDlg( oWnd )

return nil

function BuildDlg( oWnd )

   local oDlg

   DEFINE DIALOG oDlg TITLE "Test"

   ACTIVATE DIALOG oDlg ;
      ON INIT oDlg:Center( oWnd )

return nil
Image

Posted: Wed Oct 24, 2007 4:16 pm
by AHF
It works with dialogs but not with mdichilds.

Antonio

Posted: Wed Oct 24, 2007 6:28 pm
by Antonio Linares
Antonio,

Please try this:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "Center test" MDI

   ACTIVATE WINDOW oWnd ;
      ON INIT BuildChild( oWnd )

return nil

function BuildChild( oWnd )

   local oChild

   DEFINE WINDOW oChild TITLE "Test" MDICHILD

   WndTop( oChild:hWnd, oWnd:nHeight / 7 )
   WndLeft( oChild:hWnd, oWnd:nWidth / 10 )

return nil

Posted: Thu Oct 25, 2007 9:17 am
by AHF
Antonio,

It doesn't center it. My resolution is 1400x1050.

Antonio

Posted: Thu Oct 25, 2007 9:27 am
by Antonio Linares
Antonio,

Here it is working fine on 1280x1024.

Are you running the same test ?