0

I have a FireMonkey application and I need to change what is selected in Edit1 while the user is typing in Edit2. To be exact, Edit1 has some sample text and Edit2 has a regular expression that the user is editing. I want the user to be able to see if the regular expression is valid and what the matched text would be for the given sample text.

I'm using the OnChangeTracking event of Edit2 to set the SelStart and SelLength of Edit1.

The problem is, unlike VCL's TEdit, FireMonkey's TEdit does not have a HideSelection property, and always hides the selected text if the control does not have the input focus.

Is there a way to change this behavior and force the selection highlight to show no matter which control has input focus?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Sam
  • 2,473
  • 3
  • 18
  • 29
  • 1
    Unfortunately, no. This is hard-coded behavior, `TEdit` checks its `IsFocused` property before painting a selection. So, you will have to re-think how your UI shows the result of applying the regular expression to the sample text. – Remy Lebeau Nov 27 '18 at 20:31
  • 3
    @RemyLebeau Thanks. I replaced the sample `TEdit` with a `TMemo` which does have a `HideSelectionOnExit` property and that took care of the problem. – Sam Nov 28 '18 at 13:02

0 Answers0