rxero
09-10-2003, 01:09 PM
i have an mshflexgrid with the standard editing format as shown in the help files witht the txtEdit text box however i wanted to show which cell was being focused on in greater detail as it is kind of hard with the background color i am using. like i want to change whatever the currently selected cell's background color is to yellow and when u leave the cell it would return back to the normal background color. thanks!
rxero
09-10-2003, 02:04 PM
i have an mshflexgrid with the standard editing format as shown in the help files witht the txtEdit text box however i wanted to show which cell was being focused on in greater detail as it is kind of hard with the background color i am using. like i want to change whatever the currently selected cell's background color is to yellow and when u leave the cell it would return back to the normal background color. thanks!
actually i think i found out a way how to do it so incase anyone ever needs to do this for themself what u should do is
1. in the delecrations of the form declare the following variables
Dim ourLastXPos, ourLastYPos As Integer
2. in a timer which i have declared as timer1 use the following code
If ourLastXPos <> MSHFlexGrid1.Row Or ourLastYPos <> MSHFlexGrid1.Col Then
If MSHFlexGrid1.Row <> 0 Or MSHFlexGrid1.Col <> 0 Then
EdFlexGrid1.CellBackColor = &HC0FFFF
Timer1.Enabled = False
End If
End If
ourLastXPos = EdFlexGrid1.Row
ourLastYPos = EdFlexGrid1.Col
3. in the leave cell event place the following code
If MSHFlexGrid1.Row <> 0 And MSHFlexGrid1.Col <> 0 Then
MSHFlexGrid1.CellBackColor = &HFFC0C0
Timer1.Enabled = True
End If
and that's it just change the cellback color you want for entering the new cell and leaving the old one to the proper values for your project.
Thanatos
09-10-2003, 02:18 PM
Or instead of using the timer to continuously check you can use the
MsFlexGrid1_Click() event.