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

OnEnter and OnLeave events for a SymbolLabel

I am using a class derived from SymbolLabel. These new labels are being added to a Symbol on my Diagram at run time. I wish to update a grid when the user updates the text of the label. I can override the OnPropertyChanged event of the SymbolLabel but this causes the grid to be updated each time the label text is changed, ie. for each keystroke. It would be much more useful for me to have an OnLeave or OnExit event that I could use when the user has finished updating the text and focuses elsewhere. Is this something that will be implemented in a future release of SyncFusion.Diagram or will I have to implement it myself? Jimski

6 Replies

AD Administrator Syncfusion Team September 27, 2004 02:28 PM UTC

Hi Jimski, You can examine the Model''s PropertyChanged event''s evtArgs to get the necessary information. Here is a code snippet that demonstrates what you are looking for. A MessageBox with the new value for the text of the Label in the Symbol is shown after you change the text of the label: private void diagram1_Model_PropertyChanged(object sender, Syncfusion.Windows.Forms.Diagram.PropertyEventArgs evtArgs) { //Check for the type SymbolLabel if(evtArgs.Node.GetType()== typeof(Syncfusion.Windows.Forms.Diagram.SymbolLabel)) { //Check for the Text property if (evtArgs.PropertyName == "Text") { MessageBox.Show(evtArgs.NewValue.ToString()); } } } Regards Arun


JB James Brock September 28, 2004 07:36 AM UTC

Hi Arun, Thanks for getting back to me so quick. I have tried what you have suggested and put a break within the method. When I update the label text the code never gets called, and hence doesn''t break. Having said that, none of my "Diagram_Model_ events" seem to be working either. Could this be to do with the fact that I am using a Custom SymbolLabel or that I am using a Custom Model? Thanks Jimski


AD Administrator Syncfusion Team September 28, 2004 04:25 PM UTC

Hi Jimski In your custom Model''s PropertyChanged event you need to check for your Custom SymbolLabel type to do what you are seeking. Regards Arun


JB James Brock September 29, 2004 04:44 AM UTC

Hi Arun, After some work on this yesterday, it would appear that the method you used in the first place works when dealing with a brand new diagram. However, when working with one that I have saved it doesn''t. I suspect that there may be an issue with my events not being wired up when I load the saved version. Will investigate further and also try adding them to MyModel class. Thanks again Jimski


AD Administrator Syncfusion Team September 29, 2004 06:36 PM UTC

Hi Jimski Yes, you are correct. Use the Diagram''s PropertyChanged event instead of the Diagram''s Model''s PropertyChanged event. Regards Arun


JB James Brock September 30, 2004 07:38 AM UTC

I have now used the Diagram_PropertyChanged event and it works a treat. Thanks Jimski

Loader.
Up arrow icon