Solved

Keyboard Insert Key (Overwrites) doesn't work

Posted on 2001-07-25
7
542 Views
Last Modified: 2010-05-18
It seems that the TEdit doesn't recognise the keyboard insert key (toggle to overwrite/insert), it is always in
insert state!

Can anyone help?

Thanks.



0
Comment
Question by:llkhor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 25 total points
ID: 6320969
you've to check this byself

you could do this on the keyup event using the keystate-api
if overwrite is set just set the sellength of the tedit to 1


meikl ;-)
0
 
LVL 4

Accepted Solution

by:
jsweby earned 25 total points
ID: 6321620
To elaborate on meikl's answer, from the Borland Community (just use Edit instead of Memo):

The Windows TEdit and TMemo controls have no overwrite capability. It is possible to emulate this behavior however, by setting the SelLength property of the edit or memo control to one during the processing of the KeyPress event. This causes the character at the current position of the caret to be overwritten.

The following example demonstrates emulation of an overwrite capability of a TMemo component. The state of the overwrite mode can be toggled by pressing the insert key.

Example:

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure Memo1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Memo1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
    InsertOn : bool;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key = VK_INSERT) and (Shift = []) then
    InsertOn := not InsertOn;
end;

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
  if ((Memo1.SelLength = 0) and
      (not InsertOn)) then
    Memo1.SelLength := 1;
end;

J.
0
 

Author Comment

by:llkhor
ID: 6357838
thanks for your feedback. :-)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 26

Expert Comment

by:Russell Libby
ID: 8733784
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To split points between kretzschmar and jsweby

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8733837
hi russell,

you are quite busy,
guessing i should begin too

can i ask you, where you provide the links
of the questions you have already tagged?

meikl ;-)
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8733995

Meikl,

A little busy, only have 3 wks worth of q's to look at now... ;-)

I have been keeping the list in notepad currently, then when the final list/assignment is complete we are supposed to post them at:

http://www.experts-exchange.com/Community_Support/CleanUp

In a format that is similar to
-----------------------------------

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20136904.html 
- To be deleted and points refunded

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20137079.html -
To be deleted and points refunded

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20137464.html -
PAQ/Refund

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20137508.html -
To be deleted and points refunded

-----

If I misunderstood, and you want to SEE the list i have so far, let me know and I can post it for you.


Best Regards,
Russell

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a path if not exists 7 109
Delphi problems to abort a printjob 9 36
Firemonkey Queue list 1 33
Firemonkey Listview item popup menu ? 1 39
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question