As a user is cursoring down the grid, other controls need to respond by refetching some data for the record the cursor is on.
Since this data fetch can be time-consuming, I would like the grid event to be fired only when the user rests on record for a certain amount of time (say 500ms). That way if the user is trying to cursor down rapidly, I do not end up doing wasteful data fetches and slow the user down.
Any way to delay the grid event firing? Other suggestions?
Thanks!
You can't delay the firing of events. But what I would do is use a timer.
Rather than updating your other controls inside the events of the grid, all the grid events would is start the timer. So let's say you are using AfterRowActivate in the grid. This event would check to see if the timer is already running. If not, it starts the timer. If it is already running, it would stop the timer and re-start it.
When the timer Tick event fires, you stop the timer and update your controls.
Hi Mike
Is it something like this? my app freezes after 1 minute or something.
Murat
Private Sub UltraGrid1_AfterRowActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraGrid1.AfterRowActivate
If Not IsNothing(UltraGrid1.ActiveRow) Then
If UltraGrid1.ActiveRow.IsGroupByRow Then
txtDetails.Text = "Select a row to see details..."
Else
If araTimer.Enabled Then
araTimer.Stop()
araTimer.Start()
End If
'DisplayEventDetails()
End Sub
Private Sub araTimer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles araTimer.Elapsed
araTimer.Enabled = False
Try
DisplayEventDetails()
Catch ex As Exception
End Try