Define your own events in C ++ Builder

zhaozj2021-02-16  99

.h // ---------------------------------------------------------------------------- -------------------------------------------------- - Class XXX {Private:

TNOTIFYEVENT FONCUSTOMCLICK; VOID __FASTCALL FIRECUSTOMCLICK ();

PUBLIC:

__Property TNotifyEvent ONCUSTOMCLICK = {read = foncustomclick, Write = foncustomclick};} // ---------------------------------- -------------------------------------------------- ---------------. CPP // ------------------------------- -------------------------------------------------- ----------------- void __fastcall tfrmRecorder :: FirecustomClick () {if (foncustomclick) foncustomclick (this);}

Void __fastcall tfrmRecorder :: PanelCustomMouseDown (Tobject * Sender, TMousebutton Button, Tshiftstate Shift, Int x, int y) {FirecustomClick ();} // ----------------- -------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------------- void __fastcall onmycustomclick (TOBJECT * Sender); // -------- -------------------------------------------------- -------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------------------------ Void __fastcall tfmimain :: ONMYCUSTOMCLICK (TOBJECT * Sender {

} M_VecRecorders [I] -> OnMCustomClick = onmycustomclick; // ------------------------------------- -------------------------------------------------- -----------

转载请注明原文地址:https://www.9cbs.com/read-10841.html

New Post(0)