Board index » delphi » Question about DBMemo and the return key

Question about DBMemo and the return key

Delphi has been easy for me to learn so far. But I seem to be stuck with
what seems to me a very simple problem.  I cannot seem to get a DBMemo
control to allow using the Enter key to go to a new line within the memo.
When I hit the enter key I get no response.  I have noticed that when I hit
Ctrl+Enter it does got to a new line.  Events OnKeyPress, and OnKeyDown do
not capture the Enter key, but OnKeyUp does.  How can I make this work?  If
I capture the Enter key in the OnKeyUp event how would I make it go to a
new line?  Is there a property or flag that can be set somewhere that
changes this behavior?
  This seems to me like a function that should work without any coding. It
lets you do wordwrap by simply setting a property, why is hitting enter to
go to a new line so damn hard? I have worked on this for 2 days and have
gotten nowhere.

Thanks for your help,

Frustrated newbie

PS This is Delphi 1.0 (Application must run on Win 3.1)

 

Re:Question about DBMemo and the return key


Quote
Larry J Browning wrote:

> Delphi has been easy for me to learn so far. But I seem to be stuck with
> what seems to me a very simple problem.  I cannot seem to get a DBMemo
> control to allow using the Enter key to go to a new line within the memo.
> When I hit the enter key I get no response.  I have noticed that when I hit
> Ctrl+Enter it does got to a new line.  Events OnKeyPress, and OnKeyDown do
> not capture the Enter key, but OnKeyUp does.  How can I make this work?  If
> I capture the Enter key in the OnKeyUp event how would I make it go to a
> new line?  Is there a property or flag that can be set somewhere that
> changes this behavior?
>   This seems to me like a function that should work without any coding. It
> lets you do wordwrap by simply setting a property, why is hitting enter to
> go to a new line so damn hard? I have worked on this for 2 days and have
> gotten nowhere.

> Thanks for your help,

> Frustrated newbie

> PS This is Delphi 1.0 (Application must run on Win 3.1)

Hi Larry,

you only forgot that it is MS Windows you are running. The user
interface model assigns the Enter key to the form, to fire the default
button, for example. Technically you should be able to overcome this,
but then, why do you use MS windows? And why the Delphi applicaton
framework?
The Enter key is handled before you get at it. Sure there is a conflict,
since the formatting of a multiline text field (memo) requires the Enter
key, too, for natural marking of a paragraphs end.
To keep your user interface clean you better accept the solution offered
by the Delphi developers and use Ctrl-Enter, when formatting your memo
is a must.

Regards
Achim

Re:Question about DBMemo and the return key


Achim,
I would be extremely happy if the enter key would mark the end of the
paragraph.  This is exactly what I am attempting to accomplish.  As I said
in my previous post, the enter key does nothing, the cursor just sits there
and blinks at me, not moving at all.
I use the MS windows interface because it is demanded by my users, and the
last time I checked, they are the ones signing my paycheck.  I write
programs that are useful to them, not me.

Achim Richter <arich...@t-online.de> wrote in article
<5t8orn$83...@news00.btx.dtag.de>...

Quote
> Larry J Browning wrote:

> > Delphi has been easy for me to learn so far. But I seem to be stuck
with
> > what seems to me a very simple problem.  I cannot seem to get a DBMemo
> > control to allow using the Enter key to go to a new line within the
memo.
> > When I hit the enter key I get no response.  I have noticed that when I
hit
> > Ctrl+Enter it does got to a new line.  Events OnKeyPress, and OnKeyDown
do
> > not capture the Enter key, but OnKeyUp does.  How can I make this work?
 If
> > I capture the Enter key in the OnKeyUp event how would I make it go to
a
> > new line?  Is there a property or flag that can be set somewhere that
> > changes this behavior?
> >   This seems to me like a function that should work without any coding.
It
> > lets you do wordwrap by simply setting a property, why is hitting enter
to
> > go to a new line so damn hard? I have worked on this for 2 days and
have
> > gotten nowhere.

> > Thanks for your help,

> > Frustrated newbie

> > PS This is Delphi 1.0 (Application must run on Win 3.1)

> Hi Larry,

> you only forgot that it is MS Windows you are running. The user
> interface model assigns the Enter key to the form, to fire the default
> button, for example. Technically you should be able to overcome this,
> but then, why do you use MS windows? And why the Delphi applicaton
> framework?
> The Enter key is handled before you get at it. Sure there is a conflict,
> since the formatting of a multiline text field (memo) requires the Enter
> key, too, for natural marking of a paragraphs end.
> To keep your user interface clean you better accept the solution offered
> by the Delphi developers and use Ctrl-Enter, when formatting your memo
> is a must.

> Regards
> Achim

Re:Question about DBMemo and the return key


Hi Larry,

my suggestion for your ongoing troubles is:

Since the form is in control of the Enter key, get yourself a chance by
switching on KeyPreview. Now you should be able to catch the Enter key.
Drop it by setting the character code to zero and do whatever you want,
e.g. insert a paragraph mark in your memo text.

I would send you ready-to-use code, but I am on vacation, far away from
my office.

Keep your customers satisfied.
Achim

Re:Question about DBMemo and the return key


Quote
Larry J Browning wrote:

> Delphi has been easy for me to learn so far. But I seem to be stuck with
> what seems to me a very simple problem.  I cannot seem to get a DBMemo
> control to allow using the Enter key to go to a new line within the memo.
> When I hit the enter key I get no response.  I have noticed that when I hit
> Ctrl+Enter it does got to a new line.  Events OnKeyPress, and OnKeyDown do
> not capture the Enter key, but OnKeyUp does.  How can I make this work?  If
> I capture the Enter key in the OnKeyUp event how would I make it go to a
> new line?  Is there a property or flag that can be set somewhere that
> changes this behavior?
>   This seems to me like a function that should work without any coding. It
> lets you do wordwrap by simply setting a property, why is hitting enter to
> go to a new line so damn hard? I have worked on this for 2 days and have
> gotten nowhere.

> Thanks for your help,

> Frustrated newbie

> PS This is Delphi 1.0 (Application must run on Win 3.1)

Larry, I use Orpheus from TurboPower which has a component you
can use to replace DBMemo called OvcDBEditor. One of the properties
it has is "WantEnter" when this is True you can use Enter to
start a new paragraph.

Other Threads