|
-
Apr 21st, 2003, 08:43 PM
#1
Thread Starter
Lively Member
File1 problem
hi guys,
i have a problem, i have made drive, dir, and file boxes all link together - thats fine, but i have also included a listbox wich receives the file names, and a rightclickable menu. when i right click the menu and select one of the options with the mouse it runs the code perfect, but if i use the keyboard eg ctrl + a, the file1 box doesent listen to the code.
what have or havent i done?
is there another way of doing this, eg using code within the file1 box to use shortcut keys?
thanks
aiden,
[email protected]
__________________
The human race is a smart one, but we still don’t yet understand that if there is no food in the fridge the first time, there wont be food in the fridge the 2nd 3rd or hundredth time you check -- (…always hoping)
-
Apr 21st, 2003, 08:57 PM
#2
I assume you have Ctrl+A as a shortcut for one of the menu items and the main menu is set to be invisible, right? In that case VB will not react to the shortcuts you have assigned to the menu.
The work around is to set the KeyPreview of the Form to True and check for all the shortcuts in the Form_KeyDown event.
-
Apr 21st, 2003, 09:13 PM
#3
Thread Starter
Lively Member
so what code would i need to put in the keydown?
aiden,
[email protected]
__________________
The human race is a smart one, but we still don’t yet understand that if there is no food in the fridge the first time, there wont be food in the fridge the 2nd 3rd or hundredth time you check -- (…always hoping)
-
Apr 21st, 2003, 09:38 PM
#4
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = vbCtrlMask Then
'Shift can also have the values vbShiftMask or vbAltMask
'or a combination of them
Select Case KeyCode
Case vbKeyA
'Code for Ctrl+A
Case vbKeyX 'change this to a key you use
'cod for Ctrl+X
'add more case statements here
End Select
End If
End Sub
-
Apr 21st, 2003, 09:59 PM
#5
Thread Starter
Lively Member
thanks for that, thats exactly what i was looking for.
aiden,
[email protected]
__________________
The human race is a smart one, but we still don’t yet understand that if there is no food in the fridge the first time, there wont be food in the fridge the 2nd 3rd or hundredth time you check -- (…always hoping)
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
|