Can someone give me some pointers on how to make the <ENTER> key act as the <TAB> key. What I am trying to do is allow the <ENTER> key advance to the next tabstop, just as if the <TAB> key was pressed.
I assume I need to add code to each Keydown or Keyup sub, but don't know how to proceed from there.
Thanks,
Gary
Hi Gary,
There is various ways to do this. The "cleanest" way to do it is to intercept the message in the message pump itself and then change that message from using a ENTER to a TAB character. Take a look at the following code for the FF_PumpHook function. You could easily modify the function to restrict it to certain Forms and even specific TextBoxes. As it is written now, it will apply to all TextBoxes in your application.
Function FF_PUMPHOOK(Msg As tagMsg) As Long
'If this function returns FALSE (zero) then the processing of the regular
'FireFly message pump will continue. Returning TRUE (non-zero) will bypass
'the regular message pump.
Function = %FALSE 'return %TRUE if you need to bypass the FireFly message pump
'If you are dealing with a 'normal' OCX control then the following code will
'allow the message to be forwarded to the OCX. Some OCX's have child windows
'so it may be necessary to modify the GetFocus() to properly reflect the correct window.
'If you are not using any OCX's then you can simply comment or delete this line.
Function = SendMessage( GetFocus(), &H37F, 0, VarPtr(Msg))
' Intercept the ENTER key and convert it to a TAB.
Local zClass As Asciiz * 50
GetClassName Msg.hWnd, zClass, 50
If UCase$(zClass) = "EDIT" Then
If Msg.Message = %WM_KEYDOWN Then
If Msg.wParam = %VK_RETURN Then
Msg.wParam = %VK_TAB
End If
End If
End If
End Function
Thanks Paul! I will do some experimenting.
Gary