Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Want to know about Handler (Read 10249 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Want to know about Handler
Reply #15 - May 28th, 2009 at 7:10am
Print Post  
Hi stoyan,

I am agree with your point, diagram is adjusted to contain both node and popup but after adjustment if popup is not in the visible area of screen it should be moved some ward right or up to fit on the screen and node and popup both should be together.

I hope now you have clear idea what I want.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Want to know about Handler
Reply #16 - May 30th, 2009 at 6:44am
Print Post  
Hi Stoyan,
Please give some reply for the previous post.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Want to know about Handler
Reply #17 - Jun 1st, 2009 at 7:23am
Print Post  
Call the following method after showing the popup window.

Code
Select All
private void BringIntoScreen()
{
	Rect rcPop = new Rect(pop.Left, pop.Top, pop.ActualWidth, pop.ActualHeight);
	Rect rcScr = SystemParameters.WorkArea;

	if (rcPop.Right > rcScr.Width)
	{
		double dx = rcPop.Right - rcScr.Width;
		dx += 20;
		Point docDx = diagram.ClientToDoc(new Point(dx, 0));
		double newX = docDx.X + diagram.ScrollX - diagram.Bounds.X;

		diagram.ScrollX = newX;
		pop.Left += -dx;
	}
	if (rcPop.Bottom > rcScr.Height)
	{
		double dy = rcPop.Bottom - rcScr.Height;
		dy += 20;
		 Point docDy = diagram.ClientToDoc(new Point(0, dy));
		double newY = docDy.Y + diagram.ScrollY - diagram.Bounds.Y;

		diagram.ScrollY = newY;
		pop.Top += -dy;
	}
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Want to know about Handler
Reply #18 - Jun 1st, 2009 at 10:56am
Print Post  
Hi Stoyan,
Many thanks to you for your reply.

80% of problem is now solved.The only remaining thing is that Diagram should also move respectively, i.e if window is clipping from bottom :-

1. Window should move some Upward position to be in visible area.

2. Diagram should also move with respect to the window such that Window's TopLeft comes at the same position of ExpandButton.

Problem 1 is now solved.Please give your valuable suggestion for problem 2.I have tried to Scroll diagram using ScrollTo() but its not working.

Please help me on this too.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Want to know about Handler
Reply #19 - Jun 1st, 2009 at 12:58pm
Print Post  
It works fine in my test app, except when the related node is near the bottom or right sides of diagram.Bounds - is that the problem?
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Want to know about Handler
Reply #20 - Jun 1st, 2009 at 1:41pm
Print Post  
yes,this is the only problem.

If node is at bottom position both node and window should move upward simultanously and should be connected.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Want to know about Handler
Reply #21 - Jun 2nd, 2009 at 5:38am
Print Post  
For the case when the node is near diagram.Bounds.Bottom or diagram.Bounds.Right, you will have to set a bigger diagram.Bounds value, otherwise the ScrollViewer won't let you scroll far enough to free some space for the popup.

Stoyan
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Want to know about Handler
Reply #22 - Jun 2nd, 2009 at 6:22am
Print Post  
Hi Stoyan,

I have tried this code but not getting desired output.

Code
Select All
private void BringIntoScreen()
	 {
	     Rect rcPop = new Rect(pop.Left, pop.Top, pop.ActualWidth, pop.ActualHeight);
	     Rect rcScr = SystemParameters.WorkArea;
	     Rect r = diagram.Bounds;
	     double dx = 0;
	     double dy = 0;

	     if (rcPop.Right > rcScr.Width)
	     {
		  dx = rcPop.Right - rcScr.Width;
		   Point docDx = diagram.ClientToDoc(new Point(dx, 0));
		   double newX = docDx.X + diagram.ScrollX - diagram.Bounds.X;

		   diagram.ScrollX = newX;
		   pop.Left += -dx;
		   r.Width = rcPop.Right;
		   diagram.ScrollTo(new Point(r.Left + dx,0));
	     }
	     if (rcPop.Bottom > rcScr.Height)
	     {
		   dy= rcPop.Bottom - rcScr.Height;
		   //dy += 20;
		   Point docDy = diagram.ClientToDoc(new Point(0, dy));
		   double newY = docDy.Y + diagram.ScrollY - diagram.Bounds.Y;

		   diagram.ScrollY = newY;
		   pop.Top += -dy;
		   r.Height = rcPop.Bottom;
		   diagram.ScrollTo(new Point(0, r.Top + dy));
	     }
	 } 



Please help me to solve this and let me know where I am making mistake.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Want to know about Handler
Reply #23 - Jun 4th, 2009 at 7:03am
Print Post  
This will increase the diagram area to allow scrolling if the node is near the diagram right or bottom side.

Code
Select All
private void BringIntoScreen()
{
	Rect rcPop = new Rect(pop.Left, pop.Top, pop.ActualWidth, pop.ActualHeight);
	Rect rcScr = SystemParameters.WorkArea;

	if (rcPop.Right > rcScr.Width)
	{
		double dx = rcPop.Right - rcScr.Width;
		dx += 20;
		Point docDx = diagram.ClientToDoc(new Point(dx, 0));
		double newX = docDx.X + diagram.ScrollX - diagram.Bounds.X;

		if (diagram.Bounds.Right < rcPop.Right)
		{
			Rect r = diagram.Bounds;
			r.Width += rcPop.Width;
			diagram.Bounds = r;
		}

		diagram.ScrollX = newX;
		pop.Left += -dx;
	}
	if (rcPop.Bottom > rcScr.Height)
	{
		double dy = rcPop.Bottom - rcScr.Height;
		dy += 20;
		Point docDy = diagram.ClientToDoc(new Point(0, dy));
		double newY = docDy.Y + diagram.ScrollY - diagram.Bounds.Y;

		if (diagram.Bounds.Bottom < rcPop.Bottom)
		{
			Rect r = diagram.Bounds;
			r.Height += rcPop.Height;
			diagram.Bounds = r;
		}

		diagram.ScrollY = newY;
		pop.Top += -dy;
	}
}
 



You might want to save the original Bounds and scroll position and restore them when the popup is closed.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint