Machaira
Junior Contributor
Ok, hopefully this will make sense.
I have a number of forms which call a Public procedure to display a form with a grid on it. The grid is populated with a dataset created in the procedure (via a function called from the procedure). What I want to do is pass a function pointer to a function on the form calling the procedure which will be called when the user double-clicks a row on the grid (confused yet ). Normally, an event handler would be set up to handle the double-click on the grid. What I can't quite figure out is passing a pointer to this event handler to the procedure and setting up the event handler in the procedure. Here's the procedure that shows the form:
The last parameter in the declaration would be the function pointer to the event handler. It's declared as a Long as I don't quite know how to declare it. I've looked at Delegates and don't think they quite fit the bill here. I could be wrong however.
Any advice would be appreciated.
I have a number of forms which call a Public procedure to display a form with a grid on it. The grid is populated with a dataset created in the procedure (via a function called from the procedure). What I want to do is pass a function pointer to a function on the form calling the procedure which will be called when the user double-clicks a row on the grid (confused yet ). Normally, an event handler would be set up to handle the double-click on the grid. What I can't quite figure out is passing a pointer to this event handler to the procedure and setting up the event handler in the procedure. Here's the procedure that shows the form:
Visual Basic:
Public Sub ShowDataBrowser(ByVal sSQL As String, ByVal bNavigateToClickedRecord As Boolean, ByRef lClickEventHandle As Long)
Dim oDataset As New DataSet()
If GetDataset(sSQL, oDataset) > 0 Then
Dim oBrowseForm As New DataBrowseForm(oDataset)
If bNavigateToClickedRecord Then
'Add event handler for grid double-click event on DataBrowseForm
End If
oBrowseForm.ShowDialog()
End If
End Sub
Any advice would be appreciated.