OnKeyPress not triggered in DevExpress component descendant

The code below defines a TcxDBBlobEdit descendantwith its own OnKeyPress.
My issue is that this OnKeyPress (‘breakpoint here’) never gets triggered.
What am I overlooking?

type
  TPasswordTcxDBBlobEdit = class(TcxDBBlobEdit)    // DevExpress component
  private
    procedure SetPasswordMode(const Value: Boolean);
  protected
     FPasswordMode : Boolean;
     FPasswordChar : Char;
     FPrivateKeyFld: String;
     procedure WMPaste(var Message: TWMPaste); message WM_PASTE;
  public
     property PasswordMode: Boolean read FPasswordMode write SetPasswordMode;
     property PasswordChar: Char write FPasswordChar;
     property PrivateKeyFld: String write FPrivateKeyFld;
     constructor Create(AOwner: TComponent); override;
     procedure KeyPress(var Key: Char); override; Key: Char); override;
  end;

{ TPasswordTcxDBBlobEdit }

constructor TPasswordTcxDBBlobEdit.Create(AOwner: TComponent);
begin
   inherited;
   FPasswordMode := false;
   FPasswordChar := '*';
end;

procedure TPasswordTcxDBBlobEdit.KeyPress(var Key: Char);
var
   lCtrl,
   lShift,
   lPaste: Boolean;
begin
   if not FPasswordMode then Exit;  // <-- Breakpoint here
   lCtrl  := (GetKeyState(VK_CONTROL) < 0); // High bit set
   lShift := (GetKeyState(VK_SHIFT) < 0);
   lPaste := lCtrl and ((Key = 'V') or (Key = 'v') or (Key = #$16))   // #$16 /questions/78928063/weird-16-value-for-v-character-in-onkeypress
             or
             lShift and (GetKeyState(VK_INSERT) < 0);
   if not lPaste then
      Key := #0;

  inherited;
end;

The new component is created in the FormCreate:

procedure TDialoogEditProvider.FormCreate(Sender: TObject);
begin
   FEditFTPPrivateKey := TPasswordTcxDBBlobEdit.Create(nil);   // Before inherited because this assigns FEditFTPPrivateKey.DataBinding.DataSource/DataField
   
   FEditFTPPrivateKey.PasswordMode := true;                   
   FEditFTPPrivateKey.Parent       := PanelFTP;
   FEditFTPPrivateKey.Properties.BlobEditKind                   := bekMemo;
   FEditFTPPrivateKey.Properties.BlobPaintStyle                 := bpsText;
   FEditFTPPrivateKey.Properties.ImmediateDropDownWhenActivated := False;
   FEditFTPPrivateKey.TabOrder     := ComboFTPType.TabOrder + 1;
   FEditFTPPrivateKey.Width        := ComboFTPType.Width;
   FEditFTPPrivateKey.Height       := ComboFTPType.Height;
   FEditFTPPrivateKey.Left         := ComboFTPType.Left;
   FEditFTPPrivateKey.Top          := ComboFTPType.Top + ComboFTPType.Height + 4;
   FEditFTPPrivateKey.ScrollBars   := ssVertical;
   FEditFTPPrivateKey.Hint         := sReadOnlyButPaste;
   
   inherited;
end;
  • This is a Delphi 12 64-bits app
  • Assigned(FEditFTPPrivateKey.OnKeyPress) is true at the end of the FormCreate

3

BrakNicku’s comment did the trick:

Inheritance is

TcxDBBlobEdit – > TcxCustomBlobEdit -> TcxCustomPopUpEdit

It is a popup editor of type (Tcx)Memo and that needs the OnKeypress handler.

Working code is now:

type
  TPasswordTcxDBBlobEdit = class(TcxDBBlobEdit)
  private
     procedure SetPasswordMode(const Value: Boolean);
     procedure MemoKeyPress(Sender: TObject; var Key: Char);
  protected
     FPasswordMode : Boolean;
     FPasswordChar : Char;
     FPrivateKeyFld: String;
     procedure WMPaste(var Message: TWMPaste); message WM_PASTE;
  public
     property PasswordMode: Boolean read FPasswordMode write SetPasswordMode;
     property PasswordChar: Char write FPasswordChar;
     property PrivateKeyFld: String write FPrivateKeyFld;
     constructor Create(AOwner: TComponent); override;
     procedure PropertiesPopup(Sender: TObject);
  end;

procedure TPasswordTcxDBBlobEdit.PropertiesPopup(Sender: TObject);
begin
   ((Sender as TcxDBBlobEdit).Properties.PopupControl as TcxPopupMemo).OnKeyPress := MemoKeyPress;
   inherited;
end;

procedure TPasswordTcxDBBlobEdit.MemoKeyPress(Sender: TObject; var Key: Char);
var
   lCtrl,
   lShift,
   lPaste: Boolean;
begin
   if not FPasswordMode then Exit;  // Alles toegestaan
   lCtrl  := (GetKeyState(VK_CONTROL) < 0); // High bit set
   lShift := (GetKeyState(VK_SHIFT) < 0);
   lPaste := lCtrl and ((Key = 'V') or (Key = 'v') or (Key = #$16))   // #$16 /questions/78928063/weird-16-value-for-v-character-in-onkeypress
             or
             lShift and (GetKeyState(VK_INSERT) < 0);
   if not lPaste then
      Key := #0;

  inherited;
end;

(Updated title and added DevExpress tag to the question because this is relevant)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật