Solved

Keyboard Insert Key (Overwrites) doesn't work

Posted on 2001-07-25
7
523 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now