FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour window:center() doesn´t work right
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Thu Oct 25, 2007 04:23 PM

Yes. The first mdichild is centered. How can I use it?

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
window:center() doesn´t work right
Posted: Thu Oct 25, 2007 06:19 PM

Do you want to center all of them ?

Please explain a little what you want to do, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Fri Oct 26, 2007 11:38 AM

Antonio,

I need that the ::center() method on mdichilds places them in the center of the main window.

Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Mon Nov 05, 2007 11:06 AM

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

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
window:center() doesn´t work right
Posted: Mon Nov 05, 2007 11:13 AM

Antonio,

We are going to review it again asap. Its on our todo list.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Mon Nov 05, 2007 11:18 AM

Antonio,

Thanks,

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
window:center() doesn´t work right
Posted: Tue Nov 06, 2007 09:24 AM
Antonio,

Have you tried to use this code:
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Tue Nov 13, 2007 10:08 PM

I´ve re writen the:center method and now works ok!.
Thanks.

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
window:center() doesn´t work right
Posted: Tue Nov 13, 2007 11:22 PM

Antonio,

> I´ve re writen the:center method and now works ok!.

Excellent! :-)

Will you mind to share the code with us ? thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Wed Nov 14, 2007 10:27 AM

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

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Tue Jan 22, 2008 12:23 AM

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

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
window:center() doesn´t work right
Posted: Tue Jan 22, 2008 12:53 AM

>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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
window:center() doesn´t work right
Posted: Tue Jan 22, 2008 09:35 AM

James,

It worked.

Thanks

Antonio

Regards

Antonio H Ferreira

Continue the discussion