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 

pressing a button with enter

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
HanslH
Guest





PostPosted: Sun Feb 01, 2004 3:04 pm    Post subject: pressing a button with enter Reply with quote



Hoped I wouldn't be biting my nails off over something so stupid after
one month of delphi (4):
I have a (bitbtn) button on a form type ok. I set it's default
property to true, tab order 0. There is also an edit control and a
cancel button.
If I press enter while the tedit has focus nothing happens. If i give
the button focus with tab and press enter nothing happens . If I make
an on keypress event handler for the button and press enter after
giving focus nothing happens (the debugger doesn't even enter the
event handler, the button doesn't even appear to get pressed). If I
put my keyboard on the sidewalk near a skyscraper end jump on the
enter key from the top nothing happens. What else could i try?



procedure TFormGetText.BitBtn2Click(Sender: TObject);
begin
caption := 'pressed';
end;

procedure TFormGetText.BitBtn2KeyPress(Sender: TObject; var Key:
Char);
begin
if (Key = #13) then begin
caption := 'pressed';
Key := #0;
BitBtn2.Click;
end;
end;

Back to top
HanslH
Guest





PostPosted: Sun Feb 01, 2004 3:25 pm    Post subject: Re: pressing a button with enter Reply with quote



Well it seems to be caused by a HandleMessages procedure from another
form which I thought to have been form specific by making it a class
function.

On Sun, 01 Feb 2004 16:04:44 +0100, HanslH <NOSPAMhh_000001 (AT) xs4all (DOT) nl>
wrote:

Quote:
Hoped I wouldn't be biting my nails off over something so stupid after
one month of delphi (4):
I have a (bitbtn) button on a form type ok. I set it's default
property to true, tab order 0. There is also an edit control and a
cancel button.
If I press enter while the tedit has focus nothing happens. If i give
the button focus with tab and press enter nothing happens . If I make
an on keypress event handler for the button and press enter after
giving focus nothing happens (the debugger doesn't even enter the
event handler, the button doesn't even appear to get pressed). If I
put my keyboard on the sidewalk near a skyscraper end jump on the
enter key from the top nothing happens. What else could i try?



procedure TFormGetText.BitBtn2Click(Sender: TObject);
begin
caption := 'pressed';
end;

procedure TFormGetText.BitBtn2KeyPress(Sender: TObject; var Key:
Char);
begin
if (Key = #13) then begin
caption := 'pressed';
Key := #0;
BitBtn2.Click;
end;
end;


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using 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.