I have two TEdit boxes that I am using to specify file paths, one is for UNC paths, the other is for a local path. However, I would like it so if the user can only enter text in one box. If they enter text in one box, it should clear the other one. How should I go about doing this? Also, not sure if I should use an OnEnter, OnChange, or some other method.
Share
You can do it pretty simply. Create one OnChange handler, and assign it to both TEdits using the Object Inspector’s Events tab. Then you can use something like the following:
This can be streamlined slightly, but it’s not quite as readable to others. It can also be protected with a try..finally, although for simply clearing an edit’s text content it’s not really needed.