Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Originally Posted by Krool
I decided to go to the MSFlexGrid behavior as this is more convenient to have SelChange always fired. I guess, no issue, or ?
The issue is that other components that need to access cell properties need to change the current cell to access them. And the client program can have code in the SelChange event. In the best case it causes only a performance issue, but in other cases it can make the program to behave wrongly, like it was a recent case where I had put in the event code this:
Code:
HandleSelChange GridName
Private Sub HandleSelChange(nGrd As VBFlexGrid)
Static s As Boolean
If (Not s) And (nGrd.Row > 0) And (nGrd.MouseRow > 0) Then
s = True
nGrd.Row = nGrd.RowSel
nGrd.Col = 0
nGrd.ColSel = nGrd.Cols - 1
s = False
End If
End Sub
I forgot about that code, and after using that component (that is a FlexGrid exporter to Excel that I'll soon post in the Codebank) I saw that the cell format that I saw in Excel for that particular grid report (unlike other ones that were OK) was always of column 0. I didn't realize why until with further debugging I found that code in the SelChange event procesure.
But it is already solved, not only in my client program where I've put a flag, but also in my exporter.
I attach the code that allows to suspend third party controls events here.
This was made by Claude AI with my help and assistance in testing things and copying to it the definitions it wanted from the VB6 Object Browser, and also pushing it a bit because at some point it had said "there is no way to do that" (it was to find some Event IDs from VB6 code). But I responded that "If TLBINF32.DLL can do that why we can't?". And it could...
About whether it is better to raise the events or not, I think both options have advantages and disadvantages, so I don't have an opinion.