dbGrid HeadClick and row click

I'm coding a dbGrid (VB6, SP3) to do a sort based upon the column field when the user clicks on the column header.  Is there any way I can supress the column highlighting?  It is distracting.  In stead, is there any way of adding an icon to the header to indicate it is the sort column?

Also, is there any way to detect that the user has clicked a row selector button?
john_priceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

john_priceAuthor Commented:
Edited text of question.
0
adityauCommented:
I don't think it can be done. Why don't you use a list vies control?
0
TimCotteeHead of Software ServicesCommented:
adityau, whilst using a listview may be suitable in some circumstances, I would guess that it would require significant changes to john_price's code especially seeing as you cannot use a listview to edit the contents of the cells in place as you can with the DBGrid.

I would suggest that you use the following:

Private Sub DBGrid1_HeadClick(ByVal ColIndex As Integer)
    DBGrid1.ClearSelCols
End Sub

It doesn't completely remove the highlighting, it still occurs for a fraction of a second, but then disappears.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

TimCotteeHead of Software ServicesCommented:
Didn't read the second half of the question. Here is a way to test whether the user clicks a row selector:

Private Sub DBGrid1_SelChange(Cancel As Integer)
    If DBGrid1.SelBookmarks.Count = 1 Then
        MsgBox ("Row Selector Clicked")
        DBGrid1.SelBookmarks.Remove 0
    End If
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
john_priceAuthor Commented:
adityau, I like the listview; think it's classy, but agree with TimCottee about the required shift in existing code.  I'm not using the grid for edits, preferring to display a dialog instead, since the row is built from several tables, however, TimCottee's change did the trick.  The brief highlighting that is left is actually positive, since it provides feed back that a column has been clicked.  It (usually) disappears as soon as the mouse up occurs.  I say "usually", because for some reason, the headclick occassionally does not happen, particularly when the user is moving the mouse quickly between columns.  In that event, the column is not sorted and remains highlighted.  This also provides feedback, prompting the user to click it again.

Thanks to both of you.  adityau, I thank you for the suggestion, but have to give the points to TimCottee for this one.
0
john_priceAuthor Commented:
Thanks again guys.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.