Solved

Tab with KeyUp

Posted on 2001-07-14
4
180 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 300 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

785 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