⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdecombobox.pas

📁 pde专用vcl
💻 PAS
字号:
unit PDEComboBox;

interface

uses
  SysUtils, Classes, Controls, StdCtrls, Windows, Messages;
type
  TPDEComboBox = class(TComboBox)
  private
    { Private declarations }
    FOnChange: TNotifyEvent;
    function DropChar(sinstr:string) :string;
  protected
    { Protected declarations }
    procedure Change; override;
  public
    { Public declarations }
  published
    { Published declarations }
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('PDE', [TPDEComboBox]);
end;

function TPDEComboBox.DropChar(sinstr:string) :string;
var i:integer;
begin
  DropChar := sinstr;
  for  i:= 1 to Length(sinstr) do
  begin
    if Copy(sinstr,i,1) = '''' then
    begin
      DropChar:=Copy(sinstr,1,i-1);
      Break;
    end;
  end;
end;

procedure TPDEComboBox.Change;
var
  iSel, i: integer;
begin
  inherited;
  if Pos('''', Self.Text) > 0 then
  begin
    iSel := Self.GetSelStart;
    i := Length(Self.Text);
    while Pos('''', Self.Text) > 0 do
      Self.Text := copy(Self.Text, 1, Pos('''', Self.Text) - 1) + copy(Self.Text, pos('''', Self.Text) + 1, Length(Self.Text));
    i := i - Length(Self.Text);
    iSel := iSel - i;
    Self.SetSelStart(iSel);
  end;
End;
{begin
  Self.Text:= DropChar(Self.Text);
  inherited Changed;
  Self.SelStart:= Length(Self.Text);
  self.SelLength:=0;
  if assigned(FOnChange) then FOnChange(self);
end;   }

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -