BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OnKeyPress

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Borut Sustar
Guest





PostPosted: Mon Nov 10, 2003 2:31 pm    Post subject: OnKeyPress Reply with quote



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





PostPosted: Mon Nov 10, 2003 9:43 pm    Post subject: Re: OnKeyPress Reply with quote



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





PostPosted: Tue Nov 11, 2003 11:21 am    Post subject: Re: OnKeyPress Reply with quote



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





PostPosted: Tue Nov 11, 2003 11:28 am    Post subject: Re: OnKeyPress Reply with quote


"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





PostPosted: Tue Nov 11, 2003 1:06 pm    Post subject: Re: OnKeyPress Reply with quote

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





PostPosted: Mon Dec 08, 2003 11:42 pm    Post subject: Re: OnKeyPress Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.