|
-
Dec 21st, 2005, 06:43 PM
#1
Lively Member
Re: want to select a word from line using right click
VB Code:
If Button = 2 Then
'This code will be executed when the user clicks on the right mouse button.
End if
This should work, I hope.
-
Dec 21st, 2005, 06:53 PM
#2
Thread Starter
Member
Re: want to select a word from line using right click
If Button = 2 Then
n = InStrRev(txtSpellCheck.text, " ", txtSpellCheck.SelStart)
End if
when this code 'll be Exicuted then this statement "txtSpellCheck.SelStart"
'll return 0 because it will simply ignore the right click of mouse . the property only work with left click button
-
Dec 21st, 2005, 08:04 PM
#3
Re: want to select a word from line using right click
I've actually thought about this problem before so thanks for bringing it up so that I could think about it again. Here is some code that will move the cursor position to the spot where you right click
VB Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
Private Const EM_CHARFROMPOS = WM_USER + 39
Private Type POINTL
x As Long
y As Long
End Type
Private Sub RTB_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim mypoint As POINTL
Dim Index As Long
If Button = vbRightButton Then
mypoint.x = ScaleX(x, vbTwips, vbPixels)
mypoint.y = ScaleY(y, vbTwips, vbPixels)
Index = SendMessage(RTB.hwnd, EM_CHARFROMPOS, 0, mypoint)
RTB.SelStart = Index
End If
End Sub
Now it is just like the left mouse button
-
Dec 21st, 2005, 08:20 PM
#4
Addicted Member
Re: want to select a word from line using right click
Thanks moeur.
It work. 
Thanks again
-
Dec 22nd, 2005, 03:16 AM
#5
Re: want to select a word from line using right click
sorry moeur, but it's not working for me!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|