shawdown Posted August 10, 2018 Share Posted August 10, 2018 Hello, I am creating a custom component inherited from uniEdit. In this component I would like to add a function in the ExtEvents KeyDown event. What would be the correct way to do it? Quote Link to comment Share on other sites More sharing options...
shawdown Posted August 13, 2018 Author Share Posted August 13, 2018 Any suggestion. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 14, 2018 Share Posted August 14, 2018 Hi, Sorry for delay, Also you can use IUniJSInteface, for example: JSAddListener('keydown', 'function(sender, e, eOpts){...}'); Quote Link to comment Share on other sites More sharing options...
GerhardV Posted August 14, 2018 Share Posted August 14, 2018 Delphi Developer, correct me if I am wrong but I assume he would need to add that call in the "WebCreate" method which needs to be overridden in a custom component? TCustomControl = class(TUniEdit) protected procedure WebCreate; override; end; procedure TCustomControl.WebCreate; begin inherited; JSAddListener('keydown', 'function(sender, e, eOpts){...}'); end; Quote Link to comment Share on other sites More sharing options...
shawdown Posted August 14, 2018 Author Share Posted August 14, 2018 Hello friends I added in the create event and it worked perfectly. Having trouble using create? constructor TCustomControl.Create(AOwner: TComponent); Begin inherited; JSAddListener('keydown', 'function(sender, e, eOpts){...}'); End; Quote Link to comment Share on other sites More sharing options...
shawdown Posted August 14, 2018 Author Share Posted August 14, 2018 Lastly, what would be the way to add this code to a custom component? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 15, 2018 Share Posted August 15, 2018 JSConfig('remoteSort', [False], DataStore); Quote Link to comment Share on other sites More sharing options...
shawdown Posted August 15, 2018 Author Share Posted August 15, 2018 JSConfig('remoteSort', [False], DataStore); Perfect. Thank you one more time. Quote Link to comment Share on other sites More sharing options...
SMARAM Posted March 16, 2020 Share Posted March 16, 2020 Hi, I want to put a javascript encapsulate on a customDateTimePicker. function afterrender(sender, eOpts) { $("#"+sender.inputEl.id).inputmask("99/99/9999",{placeholder:"__/__/____"}); I'm trying to add the method on WebCreate but it give me error 'There is no Default JavaScript Object. [ : TUniSmDateTimePicker]'. If I put it in LoadCompleted, it doesn't work. Is there any other method to add the listener that could be encapsulate? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 16, 2020 Share Posted March 16, 2020 20 minutes ago, SMARAM said: function afterrender(sender, eOpts) { Hi, What code do you use to add? Quote Link to comment Share on other sites More sharing options...
SMARAM Posted March 16, 2020 Share Posted March 16, 2020 1 minute ago, Sherzod said: Hi, What code do you use to add? JSAddListener('afterrender', GetJSInputMaskDate); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 16, 2020 Share Posted March 16, 2020 35 minutes ago, SMARAM said: JSAddListener('afterrender', GetJSInputMaskDate); Also you can use ClientEvents. Quote Link to comment Share on other sites More sharing options...
SMARAM Posted March 16, 2020 Share Posted March 16, 2020 4 minutes ago, Sherzod said: Also you can use ClientEvents. I already use ClientEvents but I would like to encapsulate my method. Which method ClientEvents is loaded? Is there a way to override it? 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.