TomT
TomT

Reputation: 319

VirtualStringTree with a Default TButton

I have a form with a VirtualStringTree (VST) and a TButton with its default property set to true. The nodes of the VST contain inplace editors (TEdits). The problem is that the button always fires when editing the VST. How can I keep the button as default but have it ignore the enter key when the VST is being edited?

Upvotes: 1

Views: 251

Answers (1)

Val Marinov
Val Marinov

Reputation: 2755

As Rob says you may use VirtualTree events to temporary disable Button.Default property. For example :

In OnEditing event disable Default property

Button.Default := false;

In OnEdited and OnEditCancelled events restore Default property

Button.Default := true;

Upvotes: 1

Related Questions