Board index » cppbuilder » 'return' key close the 'form', how not?

'return' key close the 'form', how not?

I have few little 'edit' box for inputting and they are in
tab order.
It works fine with tab of course.

People are used to hit the 'return' key when filled a box.
But the entire 'form' is closed with the 'return'.

How can I let the 'return' acts like 'tab' only close the
'form'
when the tab is on 'OK' or 'Abort' buttons?

Thanks.

 

Re:'return' key close the 'form', how not?


I'm a newby so forgive me if I've forgot something, but I thought I'd
try to help.

Add this code to your OnKeyPress Event for each edt control you would
like to use enter as tab.

        if (Key == VK_RETURN)
        {
                Key=0;
                Perform(WM_NEXTDLGCTL,0,0);
        } //end-if

Hopefully this helps!!

Shawn Mortensen
Valley Hope Association

Quote
Jian wrote:
> I have few little 'edit' box for inputting and they are in
> tab order.
> It works fine with tab of course.

> People are used to hit the 'return' key when filled a box.
> But the entire 'form' is closed with the 'return'.

> How can I let the 'return' acts like 'tab' only close the
> 'form'
> when the tab is on 'OK' or 'Abort' buttons?

> Thanks.

Re:'return' key close the 'form', how not?


Hi Jian,

pressing Enter in a TEdit doesn't usually close a form. I guess the
Button's  Default property is set to true.

HTH

Holger

Re:'return' key close the 'form', how not?


Holger:

Thanks, I checked every TEdit box's properties and the TForm's
properties.
but can't find the related property. Could you please point it in more
detail?

Appreciate for help.

Jian

Quote
Holger Klaas wrote:
> Hi Jian,

> pressing Enter in a TEdit doesn't usually close a form. I guess the
> Button's  Default property is set to true.

> HTH

> Holger

Re:'return' key close the 'form', how not?


Hi, Jian:
    The Holger's meaning is that may there is a "Button" on the form, and
the function of this button is to close the form, and you have set the
"Default" property of this button to true, it not means the property of form
or Edit box.

--
--------------------------------------------------------
Guohua Zhao
g...@drexel.edu
or
guohua.z...@worldnet.att.net

Quote
"Jian" <jxw...@uoguelph.ca> wrote in message

news:3953CA1E.2FACB30@uoguelph.ca...
Quote
> Holger:

> Thanks, I checked every TEdit box's properties and the TForm's
> properties.
> but can't find the related property. Could you please point it in more
> detail?

> Appreciate for help.

> Jian

> Holger Klaas wrote:

> > Hi Jian,

> > pressing Enter in a TEdit doesn't usually close a form. I guess the
> > Button's  Default property is set to true.

> > HTH

> > Holger

Re:'return' key close the 'form', how not?


Unless you other actions for keys you can have a single OnKeyPress
function and use it for all the edit control.
Quote
Shawn Mortensen wrote:

> Add this code to your OnKeyPress Event for each edt control you would
> like to use enter as tab.

Other Threads