Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tab with KeyUp

Posted on 2001-07-14
4
Medium Priority
?
189 Views
Last Modified: 2010-05-18
Alex recently helped me with catching tab on a form. (See question 20147452) Now a related question has arisen. How do I detect when the tabkey is being RELEASED on the same form? Does anyone know?

Thanks
0
Comment
Question by:TropicalFish
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6282309
I think, code ~ same, only 1 difference: you must use
KeyUp messages:
h file:
void __fastcall KeyUp(Word &Key, Classes::TShiftState Shift);
The .cpp
void __fastcall TForm1::KeyUp(Word &Key, Classes::TShiftState Shift)
{
 ...
}

 
0
 

Author Comment

by:TropicalFish
ID: 6282463
No, I tried that and it doesn't work...
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 900 total points
ID: 6362729
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit1.h"
1. Sorry for delay, I was very busy.
2. Working code: tested with BCB4:
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
     : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift)
{
  if (Key == VK_TAB)
    MessageBeep(-1); //make something

}
Alex
0
 

Author Comment

by:TropicalFish
ID: 6363376
Hmm, I tried that code in a new blank project, and it works just like you say, BUT when I use it together with the the code you gave me in the previous question for catching tab with KeyDown,

void __fastcall TForm1::CMWantSpecialKey(TCMWantSpecialKey &Message)

...then it doesn't work anymore. So, when trying to respond to BOTH tab KeyDown and tab KeyUp using your code, only the KeyDown works. I guess something else is needed for the KeyUp in this case?

Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

972 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