Jump to content

Cannot Toggle Insert/Overwrite State In TUniDBEdit/TUniEdit


Frederick

Recommended Posts

While inside either TUniDBEdit or TUniEdit, pressing the Insert key to toggle between the insert and overwrite state does not seem to have any effect for typing text. The state is always in Insert mode.

How do I get UniGUI to toggle the insert/overwrite state when I press the Insert key and how to I check and display the Insert/Overwrite status?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1514)
 

Link to comment
Share on other sites

1 hour ago, Frederick said:

While inside either TUniDBEdit or TUniEdit, pressing the Insert key to toggle between the insert and overwrite state does not seem to have any effect for typing text. The state is always in Insert mode.

 

1 hour ago, Frederick said:

overwrite state does not seem to have any effect for typing text

This behavior, you yourself must implement in your project I guess.
And it’s normal that it doesn’t work by default.

Link to comment
Share on other sites

25 minutes ago, Sherzod said:

Does it work on Delphi VCL?

I tried it in Delphi 10.3.2 VCL and interestingly, it does not work.However, I don't use this Delphi version for Windows programs. When I tried it in Delphi 7, it just works natively without having me to implement any code. It could be because of one of my third-party libraries.

Anyway, I found the following code to use in Delphi 10 and it works perfectly in the Windows program.

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

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

In UniGUI, the OnKeyDown code is compilable. However, Delphi chokes on the OnKeyPress code because it says that SelLength is not a member of TUniDBEdit. What code can I create to simulate the SelLength property?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...