Page 1 of 1

Receiving the current editor from TAction.OnUpdate

Posted: Sat Dec 15, 2012 6:53 am
by vit
I need to get current editor either TRichViewEdit or TSRichViewEdit from TrvAction.OnUpdate event handler. As I understood http://www.trichview.com/help-actions/t ... ontrol.htm I should check in the next sequence:

1. TRVAControlPanel.DefaultControl
2. TrvAction.Control
3. focused control
4. first found editor component

What does mean ‘first found editor component’? Is this the first controls either TRichViewEdit or TSRichViewEdit which found by recursive iteration of all control of the form?
Is this algorithm correct? Does the implementation of this algorithm already exist, which I could use instead of writing my own?

Posted: Sat Dec 15, 2012 11:44 am
by Sergey Tkachenko
TrvAction.Control has a higher priority than TRVAControlPanel.DefaultControl

A target for the action (if Control and DefaultControl are not assigned) is chosen by VCL itself; actually, I do not know myself which control will be chosen if an action does not support a focused control.
In a real application, this situation will confuse users, so I strongly recommend to avoid it either by assigning DefaultControl/Control, or by disabling actions in this case.