How to higlight a Row in MSFLEXGRID 
Author Message
 How to higlight a Row in MSFLEXGRID

I have put the following code in the document/form show event

grd.row = 1
grd.rowsel = 1
grd.setfocus

why the first row doesn't turn to blue ?
when i click the first row manually , it did turn to blue but the 1st col
didn't. why ?

Thanks for your help and hint.

 - Alex  -



Tue, 02 Jan 2001 03:00:00 GMT  
 How to higlight a Row in MSFLEXGRID
Hi Alex;

the way I used in a former project is not nice, but maybe it's a little
help. It follwos a global procedure that I placed into a .BAS file of my
project ot call it from every form. Call the procedure in the click-event of
yor MSFlexGrid and simply pass the name of your MSFlexGrid to the procedure.

Sub glbMarkRowToBeEdited(TargetGrid As MSFlexGrid)
    Dim intCurrentCol As Integer
    Dimt intRowToBeEdited As Integer

    With TargetGrid
        '
        ' keep the current column of the grid
        '
        intCurrentCol = TargetGrid.Col
        .Redraw = False
        '
        ' keep the row that was clicked and selected
        '
        intRowToBeEdited = .Row
        '
        ' set the wholes grids background color to white and deselect all
rows
        '
        If .FixedRows > 0 Then
            .Row = .FixedRows
        Else
            .Row = 0
        End If
        If .FixedCols > 0 Then
            .Col = .FixedCols
        Else
            .Col = 0
        End If
        .RowSel = .Rows - 1
        .ColSel = .Cols - 1
        .CellBackColor = vbWhite
        '
        ' set the color of the currently selected row to yellow or what ever
you want
        '
        ' remember the row that was clicked
        '
        .Row = intRowToBeEdited
        If .FixedCols > 0 Then
            .Col = .FixedCols
        Else
            .Col = 0
        End If
        .ColSel = .Cols - 1
        .CellBackColor = &H80FFFF
        .ColSel = 0
        '
        ' remember the column that was clicked
        '
        If CurrentCol < .FixedCols Then
            .Col = .FixedCols
        Else
            .Col = intCurrentCol
        End If
        .Redraw = True
    End With
End Sub

Hope it works.

See ya.

Heiko


Quote:
>I have put the following code in the document/form show event

>grd.row = 1
>grd.rowsel = 1
>grd.setfocus

>why the first row doesn't turn to blue ?
>when i click the first row manually , it did turn to blue but the 1st col
>didn't. why ?

>Thanks for your help and hint.

> - Alex  -




Tue, 02 Jan 2001 03:00:00 GMT  
 How to higlight a Row in MSFLEXGRID
Alex,
Check the custom properties of the grid and select "Highlight always'. The
first column never highlights. Also I notice that no highlight appears when
grid first loaded. You might try setting the ROWSEL to 2 then back to 1.

Kind Regards Mike Davies

Quote:

>I have put the following code in the document/form show event

>grd.row = 1
>grd.rowsel = 1
>grd.setfocus

>why the first row doesn't turn to blue ?
>when i click the first row manually , it did turn to blue but the 1st col
>didn't. why ?

>Thanks for your help and hint.

> - Alex  -




Tue, 02 Jan 2001 03:00:00 GMT  
 How to higlight a Row in MSFLEXGRID
Didn't I answer this one the other day ?

oh well,

 If you set the following properties on your FlexGrid :

 With mFlexGrid
    .HighLight = 1 ' -Always
    .FocusRect = 0 ' - None
    .SelectionMode = 1 ' - By Row
 End With

It will do just what you want.

(Unless of course you want to implement single select only, or multiple
selection of groups of rows, which can be done but is a bit of a headache :
Hint - You need to set the cellbackground color to achieve it)

Regards

Chris Eastwood
Software Engineer
ACNielsen Ltd

Quote:

>I have put the following code in the document/form show event

>grd.row = 1
>grd.rowsel = 1
>grd.setfocus

>why the first row doesn't turn to blue ?
>when i click the first row manually , it did turn to blue but the 1st col
>didn't. why ?

>Thanks for your help and hint.

> - Alex  -




Tue, 02 Jan 2001 03:00:00 GMT  
 How to higlight a Row in MSFLEXGRID
problem solved !
Thanks guys....

--
- Alex  -

Quote:

>Didn't I answer this one the other day ?

>oh well,

> If you set the following properties on your FlexGrid :

> With mFlexGrid
>    .HighLight = 1 ' -Always
>    .FocusRect = 0 ' - None
>    .SelectionMode = 1 ' - By Row
> End With

>It will do just what you want.

>(Unless of course you want to implement single select only, or multiple
>selection of groups of rows, which can be done but is a bit of a headache :
>Hint - You need to set the cellbackground color to achieve it)

>Regards

>Chris Eastwood
>Software Engineer
>ACNielsen Ltd



Fri, 05 Jan 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to higlight a Row in MSFLEXGRID

2. How to higlight a Row in MSFLEXGRID

3. need to preselect and highlight row 20 in 6 row unbound msFlexgrid

4. MsFlexGrid Control - Highlighting a row

5. How to highlight row in MSFlexgrid

6. MSFLexGrid (VB6), Hilighting an entire row.

7. Please help:sum values in msflexgrid rows

8. Sum the values in MSFlexgrid row

9. checkbox in msflexgrid row

10. Columns on a fixed row with MSFlexgrid

11. MsFlexGrid:Color of the fixed row and column

12. MsFlexGrid: color of the fixed row

 

 
Powered by phpBB® Forum Software