Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Insert or overwrite

222 views
Skip to first unread message

Magic Lo

unread,
Jul 12, 2002, 6:00:22 AM7/12/02
to
Hi

How can I switch cursor from insert to overwrite in a edit control without
using mouse click?

Thanks
Magic Lo


Daniel Hansen

unread,
Jul 12, 2002, 6:24:00 AM7/12/02
to

Does .SetFocus do what you want ??

HTH,
Daniel

Ken White

unread,
Jul 12, 2002, 8:56:23 AM7/12/02
to
Magic Lo,

Windows applications don't usually change the cursor
(actually, the caret - the cursor is the mouse pointer)
when toggling between insert and overwrite mode.
Typically, something changes in a status bar instead.

If you really _must_ do this, you'll need to use the
API call CreateCaret() to change from the standard
I shaped caret to something else when in one mode,
and CreateCaret() with the HBitmap set to 0 to
change back to the standard I caret in the other
mode.

Ken
---
Ken White
kwh...@adpsi.com

Clipper Functions for Delphi and C++ Builder
http://www.adpsi.com

"Magic Lo" <mag...@msn.com> wrote in message news:3d2ea6c4_1@dnews...

Jens Gruschel

unread,
Jul 12, 2002, 9:53:16 AM7/12/02
to
> How can I switch cursor from insert to overwrite in a edit control without
> using mouse click?

Pressing the "Ins"-key?

Jens

Magic Lo

unread,
Jul 12, 2002, 10:27:44 AM7/12/02
to
What I mean is when I tried to edit the edit control in runtime, it always
inseted what you had typed in the current position, how can I do just
overwrite the current value?

Magic Lo

"Daniel Hansen" <daniel...@gecapital.com>
???????:3D2EAE40...@gecapital.com...

Thomas Minx

unread,
Jul 12, 2002, 11:21:10 AM7/12/02
to

"Magic Lo" <mag...@msn.com> schrieb im Newsbeitrag news:3d2ee56d_1@dnews...

> What I mean is when I tried to edit the edit control in runtime, it always
> inseted what you had typed in the current position, how can I do just
> overwrite the current value?

Magic Lo,
what kind of edit do you have?
AFAIK the insert key only works at TRichEdit.

Thomas

Magic Lo

unread,
Jul 12, 2002, 11:47:13 AM7/12/02
to
This is my problem, I can't use insert key with DBEdit control. Any idea?

Magic Lo

"Thomas Minx" <to...@tommivideo.de> 撰寫於郵件新聞:3d2ef3f1_2@dnews...

Roger Morton

unread,
Jul 12, 2002, 12:01:43 PM7/12/02
to
In <3d2ee56d_1@dnews>, Magic Lo wrote:


> What I mean is when I tried to edit the edit control in runtime, it
> always
> inseted what you had typed in the current position, how can I do just
> overwrite the current value?
>

If you want your typing to completely replace whatever was in the edit
control previously, just set the AutoSelect property.


Roger Morton
ro...@chez-morton.com

Thomas Minx

unread,
Jul 12, 2002, 2:07:37 PM7/12/02
to
Magic Lo,
AFAIK TDBEdit doesn't know about insert / overwrite mode.
I think the only way is to set AutoSelect=True, like Roger wrote.
Maybe you can offer the user to switch to his preferred mode.

Thomas

"Magic Lo" <mag...@msn.com> schrieb im Newsbeitrag news:3d2ef811_2@dnews...

Peter Below (TeamB)

unread,
Jul 12, 2002, 4:04:10 PM7/12/02
to
In article <3d2ea6c4_1@dnews>, Magic Lo wrote:
> How can I switch cursor from insert to overwrite in a edit control without
> using mouse click?

TEdit, TMemo and their DB-aware cousins have no support for overtype mode
(since the Windows controls behind them do not have support for it). It can
be emulated, however, by using a handler for the OnKeyPress event of the
control in question.

procedure TScratchMain.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
If (Sender Is TCustomEdit) and Odd(GetKeyState(VK_INSERT)) Then
With TCustomEdit(Sender) Do
If SelLength = 0 Then
Case Key of
' '..#126, #128..#255: Begin
SelLength := 1;
If (SelLength > 0) and (SelText[1] = #13) Then
SelLength := 2;
End;
End;
end;

With this handler the control will start out in insert mode since the state
of VK_INSERT is not toggled by default. Pressing it once will toggle the key
and put the control in overtype mode. If you want it to start out in
overtype, use "not Odd(...)" in the If statement.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


0 new messages