Solved

Keyboard Insert Key (Overwrites) doesn't work

Posted on 2001-07-25
7
532 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
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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