Solved

How to change the mouse icon in col in a mshflexgrid

Posted on 2014-09-07
10
147 Views
Last Modified: 2014-09-07
I have a column of links that can be clicked and want the mouse pointer to turn to a finger
Private Sub FlxGrd_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
 If Index = 2 Then
   With FlxGrd(2)
    If .Row > 0 And .Col = 0 Then
      'change Mouse Icon here
      Else
      'default MouseIcon for other cols rows
    End If
  End With
 End If
End Sub
how to do this?
0
Comment
Question by:isnoend2001
  • 5
  • 4
10 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 250 total points
ID: 40308563
Private Sub FlxGrd_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
 If Index = 2 Then
   With FlxGrd(2)
    If .Row > 0 And .Col = 0 Then
      Set.MouseIcon = LoadPicture("C:\Windows\Cursors\hmove.cur")
.MousePointer = vbCustom
      Else
      .MousePointer = vbDefault
    End If
  End With
 End If
End Sub

Open in new window

0
 
LVL 17

Assisted Solution

by:vb_elmar
vb_elmar earned 250 total points
ID: 40308585
Private Sub FlxGrd_MouseMove(index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
If index = 2 Then

With FlxGrd(2)
    kb1 = .CellWidth * (2)               ' (2) means second column
    kb2 = .CellWidth * (2) + .CellWidth  ' (2) means second column
End With
    
If x > kb1 And x < kb2 Then
    FlxGrd(2).MousePointer = 7
Else
    FlxGrd(2).MousePointer = 0
End If
End If
End Sub

Open in new window

0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40308620
I've attached a bettor cursor for my example. You'll need to rename it to Hand.cur
HAND.txt
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Closing Comment

by:isnoend2001
ID: 40308640
Thanks that works
0
 

Author Comment

by:isnoend2001
ID: 40308686
Didn't realize it at the time, but i have the cursor in a resource file
thanks martinliss
this works
Set .MouseIcon = LoadResPicture(101, vbResCursor), however it is not limited to the first column col(0)
Thanks vb_elmar
I am trying to tweak your code to work, so far no luck
if push comes to shove i will leave the finger and just get the data from first column based on the row clicked
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40308689
however it is not limited to the first column col(0)
IIf you change line 5 in my code to

Set.MouseIcon = LoadResPicture(101, vbResCursor)

doesn't it work?
0
 

Author Comment

by:isnoend2001
ID: 40308699
Yes it works good, Thank you
But  the whole grid is the finger, not just the first column(0)
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40308976
Here is working code. (Substitute your resource cursor)

Private Sub FlxGrd_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)

If Index = 2 Then

    With FlxGrd(Index)
        If x < .CellWidth Then
        Set .MouseIcon = LoadPicture("C:\temp\hand.cur")
        .MousePointer = vbCustom
    Else
        .MousePointer = vbNormal
    End If
    
    End With

End If

End Sub

Open in new window

0
 

Author Comment

by:isnoend2001
ID: 40308998
thanks martinliss

That works i could not get it to work so i had decided put it on the back burner until later
But now i don't have to
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40309000
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written (some of them updated recently) that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel - Save a copy of work book 13 89
passing a value with stream reader AFTER a ";" 3 74
How to Add / Edit Windows Menu 4 68
Problem to With line 4 63
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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