In have used this code in the mousedown event of a listbox to combine key ‘z’ with a drag and drop from cell to cell.
This works perfectly on windows xp and Windows7, but not on windows 8.
What has changed from windows 7 to windows 8?
[code]Dim row,column as Integer
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Dim d as DragItem
d=new DragItem(self,me.left,me.top,me.width,me.height)
d.text = me.cell(row,column)
//Single column copy (+ Z)
If Keyboard.AsynckeyDown(06) then
//For DragItem
gruppeliste = column
d.drag
End If[/code]
Help is much appreciated. Thanks.
As far as I see the keyboard is still detected fine. This works :
If Keyboard.AsynckeyDown(06) then
msgbox "z"
end if
Well here in Win8 it only works when I click with the Right Mouse + z.
It should work with the Left mouse button. Any idea?
The problem is that I use RIghtClick for a Constructcontextualmenu.
[quote=164713:@Vince Francia]Well here in Win8 it only works when I click with the Right Mouse + z.
It should work with the Left mouse button. Any idea?
The problem is that I use RIghtClick for a Constructcontextualmenu.[/quote]
I tested in Win 8.1 so if this is a Win 8 bug I cannot see it.
You could use KeyDown to set a boolean window property z to true when z is punched and false otherwise for any other key. The issue is that it sets z to true even if you type z in a cell. You would have to also set it in MouseMove, so it sets it back to false if the key has been released before the MouseDown occurs :
If Keyboard.AsynckeyDown(06) then
z = true
else
z = false
end if
Then when MouseDown occurs, you can read z instead of asynckeyDown. Don’t forget to set z back to False at the end of MouseDown.
Thanks. I use Win8.1 as well. Strange. I wil try your idea.
Also If I set ‘return true’ in mousedown event, why does that prevent the doubleclick event?
Vince, I confirm here, on Windows 8.1, if I place a msgbox "z"
within your test for key 6, it works perfectly. Maybe the issue you have is somewhere else.
I just copied the code you posted in the MouseDown event of a listbox I populate in the open event.
Return True does more than disabling doubleclick : it prevents selecting a row.
The only reason to return true is to enable the mouseUp event. If you need it, as a workaround, you can detect the end of System.MouseDown in a 100 ms multiple timer started at the end of MouseDown.
Michael. Thanks.
Just to retest I have created a fresh new project and added the mentioned code with MsgBox “z” in the MouseDown event.
But I only get a msgbox popup if I click the RIGHT Mouse button with the z key. The LEFT mouse button doesn’t do it here on Window 8.1. Tried last night on windows 7 and it work the way it’s supposed to with the Left mouse click and key z.
[code] Dim row,column as Integer
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Dim d as DragItem
d=new DragItem(self,me.left,me.top,me.width,me.height)
d.text = me.cell(row,column)
//Single column copy (+ Z)
If Keyboard.AsynckeyDown(06) then
//For DragItem
MsgBox “z”
d.drag
End If
[/code]
Thanks for your attention.
[quote=164844:@Vince Francia]Michael. Thanks.
Just to retest I have created a fresh new project and added the mentioned code with MsgBox “z” in the MouseDown event.
But I only get a msgbox popup if I click the RIGHT Mouse button with the z key. The LEFT mouse button doesn’t do it here on Window 8.1. Tried last night on windows 7 and it work the way it’s supposed to with the Left mouse click and key z.
[code] Dim row,column as Integer
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Dim d as DragItem
d=new DragItem(self,me.left,me.top,me.width,me.height)
d.text = me.cell(row,column)
//Single column copy (+ Z)
If Keyboard.AsynckeyDown(06) then
//For DragItem
MsgBox “z”
d.drag
End If
[/code]
[/quote]
This is the code that works here. One of these mysteries. You may want to apply the workarounds I suggested above.
Michael. I finally found a solution, which wasn’t in the code at all.
Just in case I tried to insert the mouse into another usb on my laptop and everything worked fined I have no idea why this caused the problem, both the mouse and the computer is completely new.
Thanks anyway.