CodePudding user response:
1. Check if keys Ctrl + C/Ctrl + V2. Disable the text box of the right mouse button
CodePudding user response:
Create a new project, put a text box, then add the following code red:The unit Unit1;
Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Type
TEdit=class (StdCtrls TEdit)
Procedure WndProc (var Message: TMessage); Override.
end;
TForm1=class (TForm)
Edit1: TEdit;
Private
{Private declarations}
Public
{Public declarations}
end;
Var
Form1: TForm1;
Implementation
{$R *. DFM}
{TEdit}
procedure TEdit. WndProc (var Message: TMessage);
The begin
With the Message do
If (Msg=WM_COPY) or (Msg=WM_CUT) or (Msg=WM_PASTE) then
The Exit;
Inherited
end;
The end.
CodePudding user response:
Record for useCodePudding user response:
Record for useCodePudding user response:
This is very good, I used the message mechanism,CodePudding user response:
Should also join the keyboard message, otherwise the somebody else press CTRL + C can also, ha ha,CodePudding user response:
The text box is set to enabled:=falseCodePudding user response:
Delete text box, or put the text box set to invisibleVisible:=false;
Hey hey hey hey
CodePudding user response:
If it is disable all TEdit control, use the method of the second floorIf specific TEdit control is disabled, you can use below method
unit Unit11;
Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables;
Type
TForm11=class (TForm)
Edt1: TEdit;
Qry1: TQuery;
Edt2: TEdit;
Procedure FormCreate (Sender: TObject);
Procedure FormDestroy (Sender: TObject);
Procedure edt1ContextPopup (Sender: TObject; MousePos: TPoint;
Var Handled: Boolean);
Private
{Private declarations}
FOldWndProc: TWndMethod;//save the particular control the original address
Public
{Public declarations}
Procedure NewWndProc (var Message: TMessage);//the new message definition
end;
Var
Form11: TForm11;
Implementation
{$R *. DFM}
Procedure TForm11. NewWndProc (var Message: TMessage);
The begin
//copy, cut and paste
If (Message. Msg=WM_CUT) or (Message. Msg=WM_COPY) or
(Message. Msg=WM_PASTE)
Then
exit;
FOldWndProc (Message);
end;
Procedure TForm11. Edt1ContextPopup (Sender: TObject; MousePos: TPoint;
Var Handled: Boolean);
The begin
Handled:=True;//disable the right-click menu
end;
Procedure TForm11. FormCreate (Sender: TObject);
The begin
FOldWndProc:=edt1. WindowProc;
Edt1. WindowProc:=NewWndProc;
end;
Procedure TForm11. FormDestroy (Sender: TObject);
The begin
Edt1. WindowProc:=FOldWndProc;
end;
End.
CodePudding user response:
The second floor is intercepted messages directly, should even stop button off,,CodePudding user response:
Focus on pick up clear clipboard text boxCodePudding user response:
Learning,,,,,,,CodePudding user response:
Feel the ninth floor to try tomorrowCodePudding user response:
Early in the morning to see technical post, the collection
CodePudding user response: