Jump to content

ClientEvent.ExtEvent doesn't fire if added in runtime


snow

Recommended Posts

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

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...