For JustinB

Posted on 1999-07-12
Medium Priority
Last Modified: 2010-05-02
In regards to Q.10180473.  Would give you more points for it, but I've already implemented Sheridan grids in place of the flexgrids, that and I'm low on points.  Curiousity got the better of me.
Question by:BeedleGuis
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

JustinB earned 80 total points
ID: 1524078
Yeah..I would have liked more points for it but this really made the Microsoft flex grid a far more attractive option to Sheridan. Given the distribution hassles I have had with sheridan the flex grid is better I think even though it does
not have as many features and does not really look as good.

Anyway here is the code:

Private Sub bgrdSearch_Click()
Dim pntGridPoint As POINTAPI
Dim pntClickPoint As POINTAPI
    If bgrdSearch.Rows > 1 Then
        pntGridPoint.x = 0
        pntGridPoint.y = 0
        GetCursorPos pntClickPoint
        ClientToScreen bgrdSearch.hWnd, pntGridPoint
        ' Determine if the user clicked on the fixed row
        If (pntClickPoint.y >= pntGridPoint.y) And (pntClickPoint.y <= pntGridPoint.y + 15) Then
            ' If the user has clicked on a column heading then sort
            ' the grid by that column
            prHeadClickSort pntClickPoint.x, pntGridPoint.x
            ' Allow selection of multiple rows if required
            If bMultiSelect Then
                If bgrdSearch.TextMatrix(bgrdSearch.Row, 0) <> "*" Then
                    bgrdSearch.TextMatrix(bgrdSearch.Row, 0) = "*"
                    nNumSelections = nNumSelections + 1
                    bgrdSearch.TextMatrix(bgrdSearch.Row,0) = ""
                    nNumSelections = nNumSelections - 1
                End If
            End If
        End If
    End If
End Sub

        POINTAPI is a type
        GetCursorPos and ClientToScreen are API calls

You can get info on these from the API text viewer that comes with VB

The scale mode of the form that the grid is on is important.

This code determines if the user has clicked anywhere
on the title part of the grid. You can then use the x value and the column widths to determine which of the actual columns the user clicked on. I have not included this code
as I have added substantially to it and it was a bit of a mess. This should give you all you need to know to do it anyway and for 20 points I do not think it is a bad deal.

Hope it helps.


Author Comment

ID: 1524079
Thanks JustinB, I probably won't use it though, I was just curious as to how it could be done.  I too thought about determining cursor postion on the click event if the row prop was 1, but decided it would be to much of a hassel.  Thanks for satisfing my curiousity . .

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question