Solved

How to change the mouse icon in col in a mshflexgrid

Posted on 2014-09-07
10
144 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now