Board index » cppbuilder » How is it possible to catch the keys: VK_CONTROL && 41

How is it possible to catch the keys: VK_CONTROL && 41


2005-07-29 04:41:47 AM
cppbuilder103
dear builders,
i'm confused again and again...i want to make a *select-all* functionality
for the useres, i've searched in googl.groups for earlier postings about
this but what i've found wasn't working properly....
how can i catch the keys: CONTROL + A in a ListBox ?
i've choosed: the KeyPress() event because KeyDown()
didn't recognized nothing NOT EVEN one key...
here's what i've got so far...
/************************************************************/
void __fastcall TfrmMainUnit::FileBoxKeyPress(TObject *Sender, char &Key)
{
// if( (Key == VK_CONTROL) & (Key == 41) )
// if( (Key == VK_CONTROL) && (Key == 41) )
// if( (GetKeyState(VK_CONTROL)) & (GetKeyState(41)) )
// if( (GetKeyState(VK_CONTROL)) && (GetKeyState(41)) )
// if( (GetKeyState(VK_LCONTROL)) & (GetKeyState(41)) )
// if( (GetKeyState(VK_LCONTROL)) && (GetKeyState(41)) )
// if( (GetKeyState(11)) & (GetKeyState(41)) )
// if( (GetKeyState(11)) && (GetKeyState(41)) )
if( (GetKeyState(A2)) && (GetKeyState(41)) )
{
FileBox->Selected[-1] = true; // select all items..
}
}
/************************************************************/
what is the solution....? by the way i mean with CONTROL both
(the left and the right CONTROL keys...)
Oren
 
 

Re:How is it possible to catch the keys: VK_CONTROL && 41

Quote
how can i catch the keys: CONTROL + A in a ListBox ?
i've choosed: the KeyPress() event because KeyDown()
didn't recognized nothing NOT EVEN one key...
Why not?
void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if ( Shift.Contains( ssCtrl ) )
{
if ( Key == 'A' )
ShowMessage("Ctrl+A");
}
}
--
Best regards,
Vladimir Stefanovic
 

Re:How is it possible to catch the keys: VK_CONTROL && 41

"Vladimir Stefanovic" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Why not?

void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if ( Shift.Contains( ssCtrl ) )
{
if ( Key == 'A' )
ShowMessage("Ctrl+A");
}
}

--
Best regards,
Vladimir Stefanovic
hi Vlad,
it's really strange - it still doesn't work....
/***************************************************/
void __fastcall TfrmMainUnit::FileBoxKeyDown(TObject *Sender, WORD
&Key,TShiftState Shift)
{
if(Key == VK_DELETE) cmdRemoveFileClick(0); Key = 0; // Delete item..
if(Shift.Contains(ssCtrl))
{
if(Key == 'A') FileBox->Selected[-1] = true; // Select all items..
}
}
/***************************************************/
i have no idea....why GetKeyState() cannot recognize when 2 keys
have been pressed...?
Oren
 

{smallsort}

Re:How is it possible to catch the keys: VK_CONTROL && 41

Quote
if(Key == VK_DELETE) cmdRemoveFileClick(0); Key = 0; // Delete item..
Key = 0; <---- Get rid of this, place it at the end of the routine!!!
--
Best regards,
Vladimir Stefanovic
 

Re:How is it possible to catch the keys: VK_CONTROL && 41

"Vladimir Stefanovic" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Key = 0; <---- Get rid of this, place it at the end of the routine!!!
--
Best regards,
Vladimir Stefanovic
ohh, i didn't see :-)
works perfect now, again THANK YOU VERY, VERY much Vlad !!!!!
Oren