Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem with Diagram and MouseDown event (Read 1448 times)
bagoggans
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Sep 9th, 2008
Problem with Diagram and MouseDown event
Sep 11th, 2008 at 7:20pm
Print Post  
I have what appears to be a unique problem. 

The following three DLLs are included in our project:
MindFusion.Common.dll - 1.0.3119.21886
MindFusion.Diagramming.dll - 5.0.1.19946
MindFusion.Diagramming.WinForms.dll - 5.0.1.19947

We have a single workspace form that is divided into three parts - the Diagram, the Property Panel (PP), and a treeview.

The problem?  I can select a specific node in the Diagram (or treeview).   An event fires that loads the PP with the various data elements describing that node.    This PP is built on the fly and changes depending on the node selected.

In this case, I pick a specific item in the PP list called "Priority" (valid integer values are 1 - 99).  I change the value but DO NOT press ANY keys OR click any mouse button/wheel at this time. The Priority value field in the PP still has the focus (highlighted and cursor blinking in the field).   I then move the mouse over to the diagram window and perform a MouseDown event in a whitespace area (not on any object).   But before anything can be done,  an event fires in the PP code called PropertyPanelValueChanged which causes a MessageBox to appear.  This changes the focus to the MessageBox and when I answer the question asked by poking the Yes or No button, the MessageBox closes and control then returns to the PP Priority field item and of course Windows then  allows other stored events to process.  The last event not-processed was the MouseDown event in the Diagram window, so now whenever I move the mouse around in the Diagram view, I get the rubber-band allowing me to select items as though I was still holding down the mouse button.  If instead I click on an object in the Diagram window, instead of the rubber-band, I am in the draw link mode.  I can of course click and cancel it,  but it looks very ugly while it is going on.

Because the Diagram window does not have focus, thanks to the Messagebox pop up,  none of the other Mouse events fire (MouseUp, MouseMove, MouseLeave, etc.) for the Diagram view to clear out the stored event, and while I tried some of these same Mouse events (especially MouseMove and MouseLeave) in the PP code, it does not always work - if I move the mouse too fast - OR -have already moved the mouse out of the PP area.   

Since the focus is returned to the PP panel, Priority field, I tried using the SendKeys.SendWait("{TAB}") with the Mouse event functions  to force the PropertyPanelValueChanged event to fire everytime, but as I explained above, it depends on how the mouse moves and where it is when moved.  I really do not want to use the MouseMove event in the Diagram window as there are enough events getting fired without adding that one - even if it does nothing.

What I want to accomplish is to either cancel the MouseDown event in the Diagram, or have the PP code handle this senario, but so far, I am unable to find a solution.  Has anyone else seen this and have something I can try?  I have been though MSDN forums, and tried just about everything I saw there and so far - zilch.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Diagram and MouseDown event
Reply #1 - Sep 12th, 2008 at 8:39am
Print Post  
Hi,

Call Diagram.Interaction.Cancel() before displaying the message box.

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


I love YaBB 1G - SP1!

Posts: 2
Joined: Sep 9th, 2008
Re: Problem with Diagram and MouseDown event
Reply #2 - Sep 25th, 2008 at 5:35pm
Print Post  
Grin Thanks Stoyan! That did indeed put me on to the final solution!

private void diagramView_Paint(object sender, PaintEventArgs e)
{
if (diagram.Interaction != null)
{
if (StopInteraction)
{
diagram.Interaction.CancelNow();
Invalidate();
}
}
StopInteraction = false;
}

There is a flash in the diagram view, but it does clear the user inputs! Yea!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint