window:center() doesn´t work right
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio,
Have you tried to use this code:
Have you tried to use this code:
Code: Select all
function BuildChild( oWnd )
local oChild
DEFINE WINDOW oChild TITLE "Test" MDICHILD
WndTop( oChild:hWnd, 30 ) // change 30 for your own needs
WndLeft( oChild:hWnd, 30 ) // "
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio,
Right! Here it is :
METHOD Center() CLASS TDMdiChild //own class redefinition
LOCAL nLargura,nAltura,ntop,nleft
LOCAL nlrgmain,naltmain
LOCAL meioljan, meiolmain,meioajan,meioamain
nlargura := ::nwidth() //dialog width
naltura := ::nheight() //dialog height
nlrgmain := Wmain():owndclient:nwidth() //container width
naltmain := Wmain():owndclient:nheight()//container height
//middle of each dialog and container
meioljan := nlargura /2
meioajan := naltura /2
meiolmain := nlrgmain /2
meioamain := naltmain/2
//coordinates to place the mdichild
ntop := meioamain-meioajan
nleft := meiolmain-meioljan
WndTop( ::hWnd, ntop )
WndLeft( ::hWnd, nleft )
RETURN nil
Antonio
Right! Here it is :
METHOD Center() CLASS TDMdiChild //own class redefinition
LOCAL nLargura,nAltura,ntop,nleft
LOCAL nlrgmain,naltmain
LOCAL meioljan, meiolmain,meioajan,meioamain
nlargura := ::nwidth() //dialog width
naltura := ::nheight() //dialog height
nlrgmain := Wmain():owndclient:nwidth() //container width
naltmain := Wmain():owndclient:nheight()//container height
//middle of each dialog and container
meioljan := nlargura /2
meioajan := naltura /2
meiolmain := nlrgmain /2
meioamain := naltmain/2
//coordinates to place the mdichild
ntop := meioamain-meioajan
nleft := meiolmain-meioljan
WndTop( ::hWnd, ntop )
WndLeft( ::hWnd, nleft )
RETURN nil
Antonio
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact: