Author: Tomas Rutkauskas
I published the Charcase property of a TDBMemo, but have had a couple of problems.
If I set the case to Upper or Lower sometimes, depending on what text is in the
memo, no matter where I place the cursor and start typing (dataset in browse mode
before this) the cursor jumps to the start of the memo and types there instead.
Setting Charcase to normal corrects this. This only happens on a memo that is
fairly full with text (the display area that is!). Any ideas why this is happening
and how to stop it?
Answer:
This happens even in a normal TDBMemo. My solution is to use the OnEnter event of
the TDBMemo:
1 { ... }2 x := TDBMemo(Sender).SelStart;
3 ifnot (TDBMemo(Sender).DataSource.DataSet.State in dsEditModes) then4 TDBMemo(Sender).DataSource.DataSet.Edit;
5 TDBMemo(Sender).SelStart := x;
6 TDBMemo(Sender).SelLength := 0;
7 { ... }
This seems to solve that problem entirely. First it stores the clicked on location of the memo, and you can see what the rest does.