How can I switch cursor from insert to overwrite in a edit control without
using mouse click?
Thanks
Magic Lo
Does .SetFocus do what you want ??
HTH,
Daniel
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...
Pressing the "Ins"-key?
Jens
Magic Lo
"Daniel Hansen" <daniel...@gecapital.com>
???????:3D2EAE40...@gecapital.com...
Magic Lo,
what kind of edit do you have?
AFAIK the insert key only works at TRichEdit.
Thomas
Magic Lo
"Thomas Minx" <to...@tommivideo.de> 撰寫於郵件新聞:3d2ef3f1_2@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?
>
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
"Magic Lo" <mag...@msn.com> schrieb im Newsbeitrag news:3d2ef811_2@dnews...
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