Is there an 'expert' in the field of the MSHFLEXGRID-object available?
The problem I have for my project is that, whenever I click a cell in my MsHFlexGrid, the cell above the one I click gets selected.
However, if the flexgrid containes so many lines that the vertical scrollbar shows up -and- I scroll down, this gets fixed. I don't know why this might be...
I did not define a click-event for this flexgrid, so nothing in there should be messing stuff up... the rest of the relevant code is below:
--
There's no place like 127.0.0.1
The problem I have for my project is that, whenever I click a cell in my MsHFlexGrid, the cell above the one I click gets selected.
However, if the flexgrid containes so many lines that the vertical scrollbar shows up -and- I scroll down, this gets fixed. I don't know why this might be...
I did not define a click-event for this flexgrid, so nothing in there should be messing stuff up... the rest of the relevant code is below:
Code:
Public Sub FillHflexGrid(ByVal language As String)
'defining variables
Dim lStrSql As String
Dim lTeller As Variant
' ------------------------
' Composing the SQL-string
' (colLang is a translation-collection)
' ------------------------
lStrSql = "select "
lStrSql = lStrSql & "row_id, "
lStrSql = lStrSql & "datemaj as " & colLang("_DATEMAJ") & ", "
lStrSql = lStrSql & "code as " & colLang("_CODE") & ", "
lStrSql = lStrSql & "langue as " & colLang("_LANGUE") & ", "
lStrSql = lStrSql & "quantite as " & colLang("_QUANTITE") & ", "
lStrSql = lStrSql & "facture as " & colLang("_FACTURE") & ", "
lStrSql = lStrSql & "datefac as " & colLang("_DATEFAC") & ", "
lStrSql = lStrSql & "round(prixu, 2) as " & colLang("_PRIXU") & ", "
lStrSql = lStrSql & "round(prixt, 2) as " & colLang("_PRIXT") & ", "
lStrSql = lStrSql & "paye as " & colLang("_PAYE")
lStrSql = lStrSql & " from abocom where noabo = " & lngAboNumber
lStrSql = lStrSql & " order by datemaj"
' -----------------------------------------
' Composing and Showing the actual FlexGrid
' -----------------------------------------
With frmAbnMain
dbOpen = IIf(Not dbOpen, OpenAdoConnection(lStrSql), dbOpen)
Set .hfgDetails.Recordset = adoRecordset
.hfgDetails.ColWidth(0) = 400 'eerste kolom zijn enkel knopjes.
' adjusting the width of the columns based upon the header-text
For lTeller = 1 To .hfgDetails.Cols - 1
.hfgDetails.ColWidth(lTeller) = Len(.hfgDetails.ColHeaderCaption(0, lTeller)) * 100
Next lTeller
' enable resize
'.hfgDetails.ColAlignment
dbOpen = IIf(dbOpen, CloseAdoConnection, dbOpen)
' hide the row_id
frmAbnMain.hfgDetails.ColWidth(1) = 0
' hide the 'price per unit'
frmAbnMain.hfgDetails.ColWidth(8) = 0
' hide the 'total'
frmAbnMain.hfgDetails.ColWidth(9) = 0
'frmAbnMain.hfgDetails.Cols = frmAbnMain.hfgDetails.Cols - 1
End With
End Sub
Private Sub hfgDetails_RowColChange()
With frmAbnMain
If .hfgDetails.Rows > 1 Then
' place the row_id of the clicked command in the global variable
lngCurrentCommand = .hfgDetails.TextMatrix(.hfgDetails.Row, 1)
' fill the detail-screen of the command with details.
.txtComDateMaj.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 2)
.txtComCode.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 3)
.txtComLangue.Text = Short2Long("language", .hfgDetails.TextMatrix(.hfgDetails.Row, 4))
.txtComQuant.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 5)
.txtComFacture.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 6)
.txtComDateFac.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 7)
.txtComPrixu.Text = Round(Replace(.hfgDetails.TextMatrix(.hfgDetails.Row, 8), ".", ","), 2)
.txtComPrixt.Text = Round(Replace(.hfgDetails.TextMatrix(.hfgDetails.Row, 9), ".", ","), 2)
.txtComPaye.Text = .hfgDetails.TextMatrix(.hfgDetails.Row, 10)
' de focus naar het flexgrid toetrekken
.hfgDetails.SetFocus
' de eerste lijn van de flexgrid highlighten
.hfgDetails.Col = 0
.hfgDetails.ColSel = .hfgDetails.Cols - 1
' refresh the flexgrid to keep the screen up-to-date
.hfgDetails.Refresh
End If
End With
End Sub
--
There's no place like 127.0.0.1