[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Tab Capture

Posted on 1998-10-03
5
Medium Priority
?
206 Views
Last Modified: 2010-04-06
Hi,

How can i trap the tab-key like a normal key instead of switching to the next control ? (TCustomEdit)

Kind regards,
Arijan
0
Comment
Question by:aluiken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1341618
It's already doing that.... It's alwayus as a tab, and you can change it so it goes to the next control...
0
 
LVL 1

Author Comment

by:aluiken
ID: 1341619
No, i want to use the tab key, if i write a proc for keypress or keydown then i can not trap this key. I want to use the tab key for a function in the control..
0
 
LVL 2

Accepted Solution

by:
rene100 earned 100 total points
ID: 1341620
hi

I think you have to set a keyboard-hook, because the
key-down event isn't send when tab is pressed.
you can do this as follow:
set the hook with
myhook:=setwindowshookex(wh_keyboard, @hook_event, system.hInstance, 0);

hook event his a function declared as follow:
function hook-event(code: Integer; wparam: Word; lparam: Longint): longint; stdcall;

wparam contains the key-code (9 for the tab-key)

regards
rene
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341621
How about in OnKeyDown() I think it accepts it....like

if key = VK_TAB then
  caption := 'The was just pressed ;->';

or OnKeyPress()

if key = #9 then
  caption := 'The was just pressed ;->';

Regards,
Viktor Ivanov
0
 

Expert Comment

by:steinonline
ID: 13663015
Rene, I have been struggling with this problem for some time.  I have converted a complex DOS based accounting system to Windows and have been able to mimic every single aspect of DOS behavior, procedurely moving a user through an extremely complicated agricultural accounting entry,  I have done everything, shut off the mouse, used the ENTER key to set focus to predetermined  controls, and on press of the ENTER key I need to update variables, which dictate the twists and turns the entry procedure will take.  When the user presses the TAB key however, Windows responds by sending focus on,  What I need to do is intercept the actual message, at the WndProc level, modify the keycode of 9 to 13, thus tricking the system into thinking that the ENTER key had been pressed instead.  

For the sake of code maintenance I don't want to update variables in the lost focus handlers because I don't want any reverse flows updating my flow flag variables.  which SHIFT+TAB provides.  I don't doubt that I could build a huge "mousetrap" to accomplish this, but I think that using your solution technique sounds a whole lot more appealing to me.

I tried your solution, with great anticipation, but found that the wparam that gets sent from the hook to my callback procedure is always 40, not 9 for TAB, 13 for ENTER, 27 for Escape etc... as I had expected, no matter which key is pressed.  

I used your code example verbatim.  Any ideas?  I really appreciate your concise, elegant solution,  It just didn't work for me.... I haven't done a lot of message hooking and am not really up to speed on the technique.

I am familiar with writing specific message handlers and I understand how to crack a message into wparam and lparam
I also am comfortable with function pointers.

Thanks,
Paul Steinbrueck
Windows Development Leader
FarmFact Accounting System
http://www.farmfact.com
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question