Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic box is setting in he middle of mfc' view (Read 5173 times)
1900wn
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Dec 21st, 2009
box is setting in he middle of mfc' view
Jan 19th, 2010 at 7:16am
Print Post  
hi, i created a mfc  MDI project, in the view class, i will create three box,and use createview function link them, then i ues tl.SetType(tltCentralized); but the root box is in the middle of subnods,the subnodes is other boxes,i think root box is in the middle of view,how i do it ? thank you.
example:
ues tl.SetType(tltCentralized);
==========
  o                  |                        
o  o                |
                     |
                     |
==========
this is i want it .
==========
         o          |   
       o  o        |
                     |
                     |
==========
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: box is setting in he middle of mfc' view
Reply #1 - Jan 19th, 2010 at 8:34am
Print Post  
Hi,

Use the ClientToDocX method to find the position of the view's left and right sides in document coordinates, then move the root box to their middle point and run the layout with the KeepRootPos property enabled.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
1900wn
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Dec 21st, 2009
Re: box is setting in he middle of mfc' view
Reply #2 - Jan 20th, 2010 at 3:21am
Print Post  
when i use this function ClientToDocX ,the document said need two parameters,but when i use this in the code , but ithe clientToDocX need three parameters,the last parameter is long *pVal.
but the document not reference this variable,what is it? how i can use. thank you .Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: box is setting in he middle of mfc' view
Reply #3 - Jan 20th, 2010 at 8:08am
Print Post  
Apparently we haven't created correctly the MFC wrapper for this method, and it returns the value through a pointer argument rather than as a function result. So you should pass a pointer to a long docX variable to receive the document X coordinate.
  
Back to top
 
IP Logged
 
1900wn
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Dec 21st, 2009
Re: box is setting in he middle of mfc' view
Reply #4 - Jan 21st, 2010 at 2:28am
Print Post  
i'm very sorry , when i use this function ,ClientToDocX function,this function have two parameters ,
long x.
long y.
this is device coordinate,but how i get it;
my screen is 1024*768,or positon of box?
this is my sample code:

    root = m_FlowChart.CreateBox(100, 30, 75, 40);
   ScriptHelper sc ;
   long *i =NULL ;
   sc.ClientToDocX(1024,768,i) ;
   long x = (long)&i ;
   x = x/2;

  ScriptHelper sc1;
  long *j = NULL ;
  sc1.ClientToDocY(1024,768,j);
  long y = (long)&j ;

  root.MoveTo(x, y) ;
  //TreeLayout tl;
     //tl.CreateDispatch(_T("FlowChartPro.TreeLayout"))
   //tl.SetRoot(root);
   //tl.SetType(tltCentralized);
   //tl.SetDirection(dir);
   //tl.SetArrowStyle(tlaStraight);
   //tl.SetNodeSpacing(15);
   //tl.SetLevelSpacing(30);
  //tl.SetKeepRootPos(TRUE);
  //tl.SetReversedArrows(FALSE);
  //tl.SetKeepGroupLayout(FALSE);
  ////m_FlowChart.ArrangeDiagram(tl);

« Last Edit: Jan 21st, 2010 at 8:05am by 1900wn »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: box is setting in he middle of mfc' view
Reply #5 - Jan 21st, 2010 at 8:24am
Print Post  
Hi,

You could use the CWnd::GetClientRect method to get the device coordinates of your MFC view, which you could pass to the control. Getting the output value should look like this:

long docY = 0;
sc1.ClientToDocY(x,y,&docY);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
1900wn
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Dec 21st, 2009
Re: box is setting in he middle of mfc' view
Reply #6 - Jan 22nd, 2010 at 2:02am
Print Post  
thank you, i have not use that function ,but i do it , thank you very much.
« Last Edit: Jan 22nd, 2010 at 3:17am by 1900wn »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint