tappatappa Posted November 9, 2016 Share Posted November 9, 2016 I am guessing whether is it possible to add a ClientEvent AFTER the component construction and render. For instance: add (or remove) a mouseover effect to a panel after the user clicks on a button. void __fastcall TForm1::ButtonClick(TObject* Sender) { Panel1->ClientEvents->ExtEvents->Values[L"mouseover"]=A_FUNCTION_BODY; } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 9, 2016 Share Posted November 9, 2016 Hi, Try: procedure pMouseEnter(Sender: TObject); procedure TMainForm.pMouseEnter(Sender: TObject); begin // end; Use: UniPanel1.OnMouseEnter := nil UniPanel1.OnMouseEnter := pMouseEnter; Best regards. Quote Link to comment Share on other sites More sharing options...
tappatappa Posted November 9, 2016 Author Share Posted November 9, 2016 Hi Delphi Developer, I am afraid that in my case using ajax events is not an option. I have to use tiny javascript-only events (where possible), in order to keep network usage to a reasonable level. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 9, 2016 Share Posted November 9, 2016 Then try this: uses ... uniGUIJSInterface; procedure TMainForm.UniButton1Click(Sender: TObject); begin IUniJSInterface(UniPanel1).JSAddListener('mouseover', 'function(sender){ ... }'); end; Quote Link to comment Share on other sites More sharing options...
tappatappa Posted November 9, 2016 Author Share Posted November 9, 2016 Ok that looks very promising. If I call JSAddListener multiple times, do the events cancel out? If not: How can I remove all the mouseover events added that way? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 10, 2016 Share Posted November 10, 2016 Hi, If I call JSAddListener multiple times, do the events cancel out? Yes, it can be done... How can I remove all the mouseover events added that way? For example (JS code): MainForm.UniPanel1.events.mouseover.listeners = []; Use: uses ... uniGUIJSInterface; procedure TMainForm.UniButton1Click(Sender: TObject); begin IUniJSInterface(UniPanel1).JSAssign('events.mouseover.listeners', '[]'); end; Best regards. Quote Link to comment Share on other sites More sharing options...
tappatappa Posted November 10, 2016 Author Share Posted November 10, 2016 Yes! Thanks again Delphi Developer, you are a hero! 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.