We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Diagram removing controls when mouse enter pallete

I have a diagram that users can drag windows controls items from the pallete. The items can be textboxes, labels, etc. (standard windows controls)

A very strange thing is happening where a user drags a control onto the diagram
then clicks on the diagram (taking away focus from the control we just placed on the diagram) then moves the mouse back over to the pallete to get another control to add, the control we just placed (and lost focus on) get deleted from the diagram! we have checked and don't see any events, messages, errors, nothing being generated when this happens. If we keep a control on the diagram with focus then move the mouse over to the pallete then everything is fine.

Can you please give some information as to why this could be happening as it clearly linked between the pallete and the diagram.


4 Replies

AM Ajeet M Syncfusion Team January 16, 2009 11:36 AM UTC

Hi Binary,

The Syncfusion diagram control does not allow any drag and drop of Windows Controls such as "TextBoxes" and "Labels" or any "standard .NET controls".

To use any such standard controls please use the Control Node to host the standard control into it and then have it placed in the Syncfusion's PaletteGroupView palette or your custom SymbolPalette.

Also, you can view samples that allow to use the Standard controls into the Syncfusion diagram at the following location:

------

MyDocuments\Syncfusion\EssentialStudio\7.1.0.20\Windows\Diagram.Windows\Samples\2.0\User Interaction\ControlsGalore

------

Let me know if you shall need any further clarifications in this regard.

Thanks and Regards,
Ajeet




SB Steven Britton January 16, 2009 05:03 PM UTC

In our pallete we have images that represent the controls. Once the drop is done, we evaluate what image they dropped on the diagram then replace it with the correct windows control. This part works just fine. The problem is when we have one or more controls on the form and none are selected and we move the mouse over the pallete it deletes (visually) the last control placed on the diagram. If we mouse over to where the control was on the diagram and click, it make a highlight box for where the control was but then throughs some kind of internal error (diagram error). It is almost like the control is there but not visible and the diagram does not like it.

I am less worried (for now) about the error and more concearned about why it is removing the control from the form (which I think) is causing the following error).


The exception is:
Object reference not set to an instance of an object.

StackTrace:

at Syncfusion.Windows.Forms.Diagram.Tool.MakeControlNodeSnapshot(ControlNode nodeCtrl)
at Syncfusion.Windows.Forms.Diagram.MoveTool.GetAllowedNodes(NodeCollection nodesIn, ICompositeNode parent)
at Syncfusion.Windows.Forms.Diagram.MoveTool.GetAllowedNodes(NodeCollection nodesIn)
at Syncfusion.Windows.Forms.Diagram.MoveTool.ProcessMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.UITool.PerformMove(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.UITool.ProcessMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.DiagramController.OnMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.Controls.Diagram.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.Windows.Forms.ScrollControl.WmMouseDown(Message& msg)
at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Diagram.Controls.Diagram.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at aXsInfo.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81




SB Steven Britton January 16, 2009 09:29 PM UTC

Here is another message I captured based on the above error:

System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Windows.Forms.Diagram.Tool.MakeControlNodeSnapshot(ControlNode nodeCtrl)
at Syncfusion.Windows.Forms.Diagram.MoveTool.GetAllowedNodes(NodeCollection nodesIn, ICompositeNode parent)
at Syncfusion.Windows.Forms.Diagram.MoveTool.ProcessMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.UITool.PerformMove(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.UITool.ProcessMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.DiagramController.OnMouseDown(MouseEventArgs evtArgs)
at Syncfusion.Windows.Forms.Diagram.Controls.Diagram.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Diagram.Controls.Diagram.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)




AM Ajeet M Syncfusion Team January 19, 2009 09:09 AM UTC

Hi Binary,

I am afraid I was not able to reproduce any such issue.

I am attaching my sample file that has palette bar, with some ellipses. When you drag and drop them to diagram, depending on the name of the node dropped from palette, corresponding "Control" is added to the Syncfusion's diagram control.

Also, upon successful addition and deletion of the controls to the diagram, the corresponding menthods are triggered perfectly.

Let me know if this helps resolve this query.

Happy Coding!

-Ajeet




Diagram_WF_DiagramCtrlAddition_da50f7ce.zip

Loader.
Live Chat Icon For mobile
Up arrow icon