Detect selected line (row) changed in FormGridControl

I have a grid control on a form (not a list page but regular form).

How to detect if the user has changed the selected row in the grid?

The grid only allows single selection, no multi-line selection.

The question is only about selected (highlighted) line, not the marking of lines using the checkbox to the left of the line.

I’d like to get notified about the event that the selected row changed – in order to trigger appropriate actions in background.

I could use and override the control’s enter() or mouseDown() method which are fired when the user clicks anywhere in the grid.

But what when the user moves the highlighting bar by pressing arrow keys up/down. Neither enter() nor mouseDown() are called then.

Is there any event method available that is fired when another row of the grid gets selected (highlighted) by the user?

I mean, similar to the selectionChanged() method we have for ListPages?

(I thought there were plenty of forum posts discussing solutions for this issue but couldn’t find a single one so far…)

Any help appreciated, many thanks in advance.

– ruhr42

Unless you have a very specific requirement, forget about individual form controls (including a grid) and concentrate on form data sources.

Override active() method of the date source - it’s executed when a user switches to another record. The active record is in the automatic variable with same name as the data source.

Very good point! Your recommendation sounds like a fundamental best practice rule!

Many thanks for your quick response. The active() method provides exactly the functionality I need. Problem solved, question answered.