Yes. The first mdichild is centered. How can I use it?
Antonio H Ferreira
Yes. The first mdichild is centered. How can I use it?
Do you want to center all of them ?
Please explain a little what you want to do, thanks
Antonio,
I need that the ::center() method on mdichilds places them in the center of the main window.
Antonio
Antonio,
I need that windows are centered in order that all the mdichild is automacticly visible otherwise the user will have to center the window by hand to begin toi work. The Mdichilds can't be maximized or chanhed in size.
Antonio
Antonio,
We are going to review it again asap. Its on our todo list.
Antonio,
Thanks,
Antonio
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 nilI´ve re writen the:center method and now works ok!.
Thanks.
Antonio
Antonio,
> I´ve re writen the:center method and now works ok!.
Excellent! ![]()
Will you mind to share the code with us ? thanks!
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
Again problem.
If I modify the size of the main window the mdichilds opened after are disapering.
That is caused by my modify center() method posted before.
Ntop or Nleft are returning a negative value and when this happens the child window disapears.
Any ideas ?
Antonio
>Ntop or Nleft are returning a negative value and when this happens the child window disapears.
>Any ideas ?
Try using the main window's bResize codeblock to call the center function then maybe the mdichild Move() method (to redisplay it).
James
James,
It worked.
Thanks
Antonio