Solved

Tab with KeyUp

Posted on 2001-07-14
4
179 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
Comment Utility
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
Comment Utility
No, I tried that and it doesn't work...
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 300 total points
Comment Utility
//---------------------------------------------------------------------------
#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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now