?
Solved

Tab with KeyUp

Posted on 2001-07-14
4
Medium Priority
?
187 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
[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
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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…
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 how to clear a vector as well as how to detect empty vectors in C++.

719 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