?
Solved

How to change the mouse icon in col in a mshflexgrid

Posted on 2014-09-07
10
Medium Priority
?
150 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
[X]
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
  • 5
  • 4
10 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 1000 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 1000 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 49

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 49

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 49

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 49

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: 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.

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 designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

764 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