Solved

Tab with KeyUp

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mixing C++ & C# in Vis Studio 2013 7 280
convert char array to number in c 5 93
How to convert MFC::CString to UTF8 wchar_t* 10 459
Which Linux flavors will this run on? 6 115
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

739 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