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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Preventing texts to be inserted over a Custom Symbol

Thread ID:

Created:

Updated:

Platform:

Replies:

34812 Sep 16,2005 11:23 AM UTC Oct 6,2005 06:10 AM UTC WinForms 8
loading
Tags: Diagram
Vinod Raghupathy
Asked On September 16, 2005 11:23 AM UTC

I have a Custom Symbol in a Symbol Palette and a Insert Text Tool as a ToolBar button. In runtime, I shouldn''t allow users to insert text objects over a symbol drawn in a Diagram. When the user clicks on the Insert Text Tool, the Tool which is active should behave as Inactive when users try to draw over the Symbol. But when the mouse is taken off from the Symbol, the Text Tool once clicked should be active again. I tried to do this programatically by applying a logic, but that doesn''t seem to work the way I want. Any help on this would be great..! Regards, Vinod

Administrator [Syncfusion]
Replied On September 16, 2005 02:32 PM UTC

Hi Vinod, An easy way to do this would be by handling the Diagram.NodeMouseEnter event and temporarily deactivating the TextTool if the node is a Symbol. The Diagram.NodeMouseLeave event will let you know when the mouse leaves the symbol, and you can use this to reactivate the text tool. The following code should give you an idea, private bool toolDeactivated = false; private void diagramComponent_NodeMouseEnter(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { Tool txttool = this.diagramComponent.Controller.GetTool("TextTool"); if((txttool != null) && (txttool.Active == true) && (evtArgs.Node is Symbol)) { txttool.Deactivate(); this.toolDeactivated = true; } } private void diagramComponent_NodeMouseLeave(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { if(this.toolDeactivated == true) { Tool txttool = this.diagramComponent.Controller.GetTool("TextTool"); txttool.Activate(); this.toolDeactivated = false; } } Thanks, Prakash Surendra Syncfusion Inc.,

Vinod R
Replied On September 19, 2005 10:59 AM UTC

Hi Prakash, First of all thanks a lot for your time..! With the code you listed I am still able to Insert Text over the Symbols. With the code I was using it was not allowing to insert texts over the Symbol, but after drawing the Texts outside the Symbol in the Diagram Area I am still able to drag the Texts over the Symbols which should not be allowed. Also any symbol shouldn''t be allowed to be drawn over another Symbol. How will I prevent these ? My Implementation was almost same. Instead of diagram1_NodeMouseEnter I was using Model_MouseEnter and checking if (evtArgs.Node.GetType() == typeof(FunctionBlock)) and deactivating the TextTool there. And instead of the diagram1_NodeMouseLeave method I was using the Model_MouseLeave method to activate the Tool again. This implementation worked well except for the case where I was able to draw a Text outside the symbol and then when the TextTool is active (or not) I am able to drag the object over the Symbol which shouldn''t be permitted in my case. I feel the implementation should be uniform in such way that any objects shouldn''t be allowed over another symbol in my case. Pls let me know your suggestions..! Regards, Vinod >Hi Vinod, > >An easy way to do this would be by handling the Diagram.NodeMouseEnter event and temporarily deactivating the TextTool if the node is a Symbol. The Diagram.NodeMouseLeave event will let you know when the mouse leaves the symbol, and you can use this to reactivate the text tool. The following code should give you an idea, > >private bool toolDeactivated = false; > >private void diagramComponent_NodeMouseEnter(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) >{ > Tool txttool = this.diagramComponent.Controller.GetTool("TextTool"); > if((txttool != null) && (txttool.Active == true) && (evtArgs.Node is Symbol)) > { > txttool.Deactivate(); > this.toolDeactivated = true; > } >} > >private void diagramComponent_NodeMouseLeave(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) >{ > if(this.toolDeactivated == true) > { > Tool txttool = this.diagramComponent.Controller.GetTool("TextTool"); > txttool.Activate(); > this.toolDeactivated = false; > } >} > >Thanks, >Prakash Surendra >Syncfusion Inc.,

Vinod R
Replied On September 21, 2005 04:25 AM UTC

Hi, Any clues on what I had mentioned in my previous post ? Regards, Vinod >I have a Custom Symbol in a Symbol Palette and a Insert Text Tool as a ToolBar button. > >In runtime, I shouldn''t allow users to insert text objects over a symbol drawn in a Diagram. When the user clicks on the Insert Text Tool, the Tool which is active should behave as Inactive when users try to draw over the Symbol. But when the mouse is taken off from the Symbol, the Text Tool once clicked should be active again. > >I tried to do this programatically by applying a logic, but that doesn''t seem to work the way I want. Any help on this would be great..! > >Regards, > >Vinod

Administrator [Syncfusion]
Replied On September 21, 2005 10:08 PM UTC

Hi Vinod, If you want to prevent TextNodes (or for that matter any other node) from being dragged and dropped over a symbol, then the only way to do it would be by either disabling the textnode''s move style property or through the implementation of a custom MoveTool. Disabling the TextNode.EditStyle.AllowMove property would root that node to the spot and you will not be able to move it around. A custom MoveTool class will however let you determine whether the node being moved is a TextNode and if it is over a Symbol, and if so will give you the ability to disable it. Please refer to the following Essential Diagram KB article for additional information on how to go about customizing one of the diagram interactive tools - http://www.syncfusion.com/support/kb/diagram/Default.aspx?ToDo=view&questId=48. Thanks, Prakash Surendra Syncfusion Inc.,

Administrator [Syncfusion]
Replied On September 26, 2005 04:13 AM UTC

Hi, This still isn''t working. Can you provide me a sample where I prevent one custom symbol over another symbol. Regards, Vinod >Hi Vinod, > >If you want to prevent TextNodes (or for that matter any other node) from being dragged and dropped over a symbol, then the only way to do it would be by either disabling the textnode''s move style property or through the implementation of a custom MoveTool. Disabling the TextNode.EditStyle.AllowMove property would root that node to the spot and you will not be able to move it around. A custom MoveTool class will however let you determine whether the node being moved is a TextNode and if it is over a Symbol, and if so will give you the ability to disable it. Please refer to the following Essential Diagram KB article for additional information on how to go about customizing one of the diagram interactive tools - http://www.syncfusion.com/support/kb/diagram/Default.aspx?ToDo=view&questId=48. > >Thanks, >Prakash Surendra >Syncfusion Inc.,

Administrator [Syncfusion]
Replied On September 27, 2005 01:31 PM UTC

Hello Vinod, We will try to provide you with a sample demonstrating a custom MoveTool. Prakash Surendra Syncfusion Inc.,

Administrator [Syncfusion]
Replied On September 28, 2005 04:20 AM UTC

Pls provide me a sample where custom symbols and texts are not allowed to place over another symbol. When trying to insert a text or trying to drag and drop a text or a symbol over an already existing symbol in the Diagram, it should pop up a message box ["Cannot place a symbol or text over a symbol"] and we shouldn''t allow. Similarly a symbol shouldn''t be allowed to be inserted over a link as well over a text. If you can provide me a sample, that would be of great help. Regards, Vinod >Hello Vinod, > >We will try to provide you with a sample demonstrating a custom MoveTool. > >Prakash Surendra >Syncfusion Inc.,

Meera Fathima [Syncfusion]
Replied On October 6, 2005 06:10 AM UTC

Hello Vinod, Here with I attached the CustomMoveTool sample that shows how to prevent a textnode or symbol from being dropped over another symbol. CustomMoveTool_6059.zip Kindly take a look and get back to us if you have any further questions. Thanks and Regards, Meera.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;