window:center() doesn´t work right

Postby AHF » Thu Oct 25, 2007 4:23 pm

Yes. The first mdichild is centered. How can I use it?
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Thu Oct 25, 2007 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

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

Postby AHF » Mon Nov 05, 2007 11:18 am

Antonio,

Thanks,

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

Postby Antonio Linares » Tue Nov 06, 2007 9:24 am

Antonio,

Have you tried to use this code:
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Tue Nov 13, 2007 10:08 pm

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

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

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

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby AHF » Tue Jan 22, 2008 9:35 am

James,

It worked.

Thanks

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

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 50 guests