Handling text changed events


#1

We are evaluating GoDiagram, and are very pleased with the results; however we have run into a glitch that I hope you can shed some light on. Our evaluation build on the BasicApp sample. We have overridden nodes, links, and text in order to drop down a combobox from which to pick the link label. This is fine. However once we add a Changed handler to the GoText derivative, in order to call back to the node to validate the selection, the application becomes sluggish and begins to frequently not respond to double click events on the form background. My gut feel is that the Changed event on the create of the initial link label default text is resulting in a conflict. Does this make sense? Is there a more direct way to hook the combobox? Ideally we’d like to get a direct callback on text changing and text changed, without going through a Changed handler for every text item? How would we do this? Thanks!


#2

If you just want the user to choose a text string value for a GoText object, you can just specify the GoText.EditorStyle to GoTextEditorStyle.ComboBox and specify the GoText.Choices list of strings. I don’t think you need to define a subclass of GoText (or any other classes) for this.
If you want to do validation, then adding such code to a subclass would be a reasonable way to go. You can override either GoText.ComputeEdit or GoText.DoEdit. ComputeEdit lets you normalize/canonicalize the string value; DoEdit lets you do something else besides setting the GoText.Text property.
But what you were doing with defining a GoDocument.Changed event handler should work fine, and shouldn’t be noticeably inefficient, assuming you are only doing your (possibly expensive) validation when the GoChangedEventArgs.Hint is GoLayer.ChangedObject and the GoChangedEventArgs.SubHint is GoText.ChangedText. There must be something else going on.