snow Posted April 12, 2022 Share Posted April 12, 2022 Hi, I need to add a ClientEvent.ExtEvent to a form during runtime as the code is created dynamically. If added via the designer everything works as expected but if I add it in runtime (FormCreate) it doesn't work. To show what I mean I've added two simple projects showing a messagebox on activation of the form (or rather not). Is there a way to solve this problem? Thanks in advance. Regards works.zip doesn't work.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2022 Share Posted April 12, 2022 53 minutes ago, snow said: doesn't work.zip 9.25 kB · 1 download procedure TMainForm.UniFormCreate(Sender: TObject); begin bFirstActivate := true; // this does not work // Self.ClientEvents.ExtEvents.Add('activate=function window.activate(sender, eOpts) ' // + '{ ' // + 'ajaxRequest(sender, ''myActivate'', [''text=test'']); ' // + '} ' // ); JSInterface.JSAddListener('activate', 'function(me){ajaxRequest(me, "myActivate", ["text=test"])}') end; 1 Quote Link to comment Share on other sites More sharing options...
snow Posted April 12, 2022 Author Share Posted April 12, 2022 That did the trick... thank you! 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.