window:center() doesn´t work right

AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

window:center() doesn´t work right

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Its working fine used this way:

Code: Select all

   ACTIVATE WINDOW oWnd ;
      ON INIT oWnd:Center()
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

I'm using build Marhc 2006. Is it ok ?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Please try it that way, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

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

Antonio
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

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


Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Antonio,

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

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

I want to center it regarding its parent window.

Regards
Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Hazlo así:

oWnd:Center( oWndParent )
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

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

Regards
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

It works with dialogs but not with mdichilds.

Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

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

Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Antonio,

Here it is working fine on 1280x1024.

Are you running the same test ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply