Rebelss Posted September 24, 2019 Share Posted September 24, 2019 Hello, i'm testing the UniGui trial and trying to create a new TMyUniEdit with the OnChange method overriden but can't figure out how can someone post an example on how can i create a TUniEdit descendant with the OnChange method Overriden ? Thanks! Quote Link to comment Share on other sites More sharing options...
Rebelss Posted September 24, 2019 Author Share Posted September 24, 2019 No one ? we normally do something like this : unit MyEdit; interface uses Vcl.StdCtrls, vcl.Dialogs; Type TMyEdit = class(TEdit) public procedure Change; override; end; procedure Register; implementation uses System.Classes; procedure Register; begin RegisterComponents('MySuite', [TMyEdit]); end; { TMyEdit } procedure TMyEdit.Change; begin inherited; showmessage('MyOnChange'); end; end. But in Unigui the procedure "Change" doesn't exists on TUniEdit. Here is my code : unit MyUniEdit; interface uses Classes, uniGuiTypes, uniGUIClasses, uniGUIForm, UniEdit; type TMyUniEdit = class(TUniEdit) public procedure Change; override; end; procedure Register; implementation procedure Register; begin RegisterComponents('MyUnigui', [TMyUniEdit]); end; { TMyUniEdit } procedure TMyUniEdit.Change; begin inherited; if (Assigned(OnChange)) then showmessage('MyOnChange'); end; end. but the compiler message is : [dcc32 Error] MyUniEdit.pas(11): E2137 Method 'Change' not found in base class Quote Link to comment Share on other sites More sharing options...
Rebelss Posted September 25, 2019 Author Share Posted September 25, 2019 Hello guys, i figure out. I just have to override the DoOnChange event. unit MyUniEdit; interface uses Classes, uniGuiTypes, uniGUIClasses, UniGuiDialogs, UniEdit; type TMyUniEdit = class(TUniEdit) public procedure DoOnChange; override; end; procedure Register; implementation procedure Register; begin RegisterComponents('MyUnigui', [TMyUniEdit]); end; { TMyUniEdit } procedure TMyUniEdit.DoOnChange; begin inherited DoOnChange; // code something end; end. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.