Disabling Flexgrid Header click...
How do I disable clicking on the header in a MSFlexGrid ?
I tried:
If fg1.row = 0 then Exit Sub
in the click event, which does nothing, it's like clicking the firrst row of data.
and I tried:
If fg1.row = 1 then Exit Sub
in the click event, which disables the header row and the first row of data.
Thanks
Rel
Re: Disabling Flexgrid Header click...
'a trick could be:
Code:
Option Explicit
Private Sub Form_Load()
Dim CounterCol As Long
With grdFlex
.GridLines = .GridLinesFixed
.Rows = 10
.Cols = 10
.FixedRows = 0
.Row = 0
For CounterCol = 0 To .Cols - 1
.Col = CounterCol
.CellBackColor = &H8000000F
Next
.Col = 0
.Row = 0
End With
End Sub
Else you will have to use Api to get mouse and decide if click happened on
header of grid...
for example, see:
http://www.codeguru.com/forum/showth...d+column+width
Re: Disabling Flexgrid Header click...
Thanks for the cool code, Cimperiali, it will come in handy.
This did the trick:
If fg1.MouseRow = 0 Then Exit Sub
Thanks
Rel
Re: Disabling Flexgrid Header click...
Never looked at that prop. Thanks for pointing me there!
---------------------------------------------------------------------------
From msdn
Code:
MouseCol, MouseRow Properties
Returns the current mouse position, in row and column
coordinates.
Syntax
object.MouseCol [=value]
object.MouseRow [=value]
Syntax for the MouseCol and MouseRow properties has these parts:
Part Description
object An object expression that evaluates to an object in the Applies To list.
value The row and column coordinates that specify the current mouse position.
Remarks
Use these properties programmatically to determine the mouse location.
These properties are useful in displaying context-sensitive help for individual
cells and testing whether the user has clicked on a fixed row or column.