Grid control and SelChange event

Grid control and SelChange event

Post by Chuck Chop » Thu, 06 Mar 2003 12:19:55



I have a grid control on a form in a eVB v3.0 program running on the
PocketPC 2002 emulator.  The grid control has the SelectionMode property set
to flexSelectionByRow.  I don't want the user to be able to select multiple
rows in the grid [e.g. press MB1 and drag mouse pointer up/down and then
release MB1].  Towards this goall, I inserted the following code in my form:

Private Sub GridCtrl1_SelChange()
   If GridCtrl1.Row <> GridCtrl1.RowSel Then
     GridCtrl1.RowSel = GridCtrl1.Row
   End If
End Sub

Modifying the RowSel property via code is supposed to fire the SelChange
event and I didn't want an endless set of this event being fired; I put in a
test to see if the current Row is the same as RowSel, and only change RowSel
if it is not the same as Row.

Unfortunately, there are some odd situations in which I can still get
multiple rows to be selected in the grid.  For example, if I have 4 rows
[0...3] and 3 columns [0..2], I can down-click on <1,0>, move the pointer to
<3,0> and then release the mouse button.  As expected, only row #1 stays
highlighted.  However, if I now down-click at <3,0> and move the mouse
pointer to <1,0>, I get rows 1..3 selected; this shouldn't happen.  It is
almost as if the SelChange event is not being fired for the grid control
even though the multiple row selection is being displayed in the grid control.

Any ideas on what I'm doing wrong?

TIA,

Chuck
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
                                   ICQ # 22321532
RTFM Consulting Services Inc.     864 801 2795 voice & voicemail
103 Autumn Hill Road              864 801 2774 fax
Greer, SC  29651                  800 774 0718 pager
                                   8007740718 (at) skytel (dot) com

Do not send me unsolicited commercial email.

 
 
 

1. CE grid control and Row-Selection property AND grid speed

        I have the selection style of a grid set to select an entire row. This
works fine for me except for one thing: Each time I select a row, the
previously selected row(s) will STAY selected. I just want a single row
highlighted and selected each time I click on one. Is there a property
to turn off "Multi-Select" and still have row-based selection? If not,
what's a (the?) proper method of clearing the highlighted rows?

- Tom

2. computers forsale

3. can't load controls for ppc 2002 emulator eg grid control

4. is there a FAQ on use of IDC punch down tools

5. Editable grid control

6. Modify existing resource without recompile project ???

7. questions about Grid control

8. csh savehist not working

9. Grid Control for Pocket PC

10. Newbie: use grid control

11. PPC 2002 Grid Control loses RowData when sorting

12. Can't get a grid control to work

13. Grid control