Solved

How to change the mouse icon in col in a mshflexgrid

Posted on 2014-09-07
10
145 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

786 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