 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Borut Sustar Guest
|
Posted: Mon Nov 10, 2003 2:31 pm Post subject: OnKeyPress |
|
|
Hello!
Using BCB5 professional!
I would like to do the folowing:
- when I press Enter (on keyboard) I would like that Edit1 acts like I would
press Tab.
Is it possible to do something like that?
Thx in advance!
Borut
Slovenia
|
|
| Back to top |
|
 |
Fishface Guest
|
Posted: Mon Nov 10, 2003 9:43 pm Post subject: Re: OnKeyPress |
|
|
Borut Sustar wrote:
| Quote: | I would like to do the folowing:
- when I press Enter (on keyboard) I would like that Edit1 acts like I would
press Tab.
Is it possible to do something like that?
|
Hi, Borut! This works, but I don't know if there is an easier way:
http://groups.google.com/groups?selm=7521fn%24l607%40forums.borland.com
|
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Tue Nov 11, 2003 11:21 am Post subject: Re: OnKeyPress |
|
|
In Edit1, double click the OnKeyPress event in the Object Inspector. In the
code template that opens, put in the following :-
void __fastcall TMainForm::Edit1KeyPress(TObject *Sender, char &Key)
{
if (Key==VK_RETURN)
{
Key=0; keybd_event((BYTE)VK_TAB,(BYTE)0,0,0);
keybd_event((BYTE)VK_TAB,(BYTE)0,KEYEVENTF_KEYUP,0);
}
}
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
[email]markj (AT) criticalremovethisspuriousantispamstuff (DOT) co.uk[/email]
"Borut Sustar" <borut (AT) bokosoft (DOT) si> wrote
| Quote: | Using BCB5 professional I would like to do the folowing:
- when I press Enter (on keyboard) I would like that Edit1 acts like I
would
press Tab. Is it possible to do something like that? Thx in advance!
Borut
Slovenia
|
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Nov 11, 2003 11:28 am Post subject: Re: OnKeyPress |
|
|
"Mark Jacobs" <markj (AT) critical (DOT) co.uk> wrote:
| Quote: | In Edit1, double click the OnKeyPress event in the Object
Inspector. In the code template that opens, put in the
following :- [...]
|
While that will work, it won't stop the bell from sounding.
Fishface provided the correct method.
~ JD
|
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Tue Nov 11, 2003 1:06 pm Post subject: Re: OnKeyPress |
|
|
What is this - slag Jacobs off day?!? The code I cited works, has been
tested, and does not ring any bells, because I set Key=0 before the
keybd_events.
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
[email]markj (AT) criticalremovethisspuriousantispamstuff (DOT) co.uk[/email]
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: |
"Mark Jacobs" <markj (AT) critical (DOT) co.uk> wrote:
In Edit1, double click the OnKeyPress event in the Object
Inspector. In the code template that opens, put in the
following :- [...]
While that will work, it won't stop the bell from sounding.
Fishface provided the correct method.
~ JD
|
|
|
| Back to top |
|
 |
Dwayne Guest
|
Posted: Mon Dec 08, 2003 11:42 pm Post subject: Re: OnKeyPress |
|
|
Hello Borut ,
Using BCB5 professional!
I would like to do the folowing:
- when I press Enter (on keyboard) I would like that Edit1 acts like I would
press Tab.
Is it possible to do something like that?
Go to your Form and on Event turn on the OnKeyPress
Then put this in.
void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key)
{
if (Key == VK_RETURN) {
Key=0;
Perform(WM_NEXTDLGCTL,0,0);
}
}
Dwayne
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|