Prevent TAB in a Textbox

Started by Petrus Vorster, January 11, 2016, 01:28:23 PM

Previous topic - Next topic

Petrus Vorster

Hi All

I re-wrote a little bulk barcode-item tracking app I used for years.
This time I used Tab-Controls for the entire project to make it easier.
I let it scan to a normal textbox and when it reaches 13 characters it validates the barcode and add it to a listbox.
No other control on the form can receive focus by using tab, but the company scanners are all configured to add a TAB character after the barcode scan.
Since i have it on a tab control, it doesn't set the focus back to the textbox control as instructed, but passes the Tab to the Tabcontrol.
Very annoying.
We had it here previously, but i cant find it now.
How do you disable the TAB or an ENTER in a normal textbox again?
-Regards
Peter

Petrus Vorster

For now it appears as the fastest way around this would be just to disable the Tabcontrol from receiving any focus.
Making it an all-click and command app.
Other than that, I have not yet located the method for directly disabling the Tab press.
(Somewhere in the WM_keydown, but still eluding me for now.)
-Regards
Peter

David Kenny

Peter,

Did you remember that at WM_Keydown it is not a tab character yet, but a Virtual-Key Code you are looking for?  (%VK_CONTROL)
Also, you might not be able to intercept that in the FF WM_Keydown function, but in the FF_PUMPHOOK instead.  Not sure about that one, but you can test it rather easily.
If you posted test code, it would be easier to help. :)

David