Jump to content

ClientEvents.ExtEvents not fire if added in runtime mode (if control is also created at runtime)


Recommended Posts

Hello everyone,

When creates a control (ex: uniEdit) in runtime mode and then adds "ClientEvents.ExtEvents" this events don't fire

but If I add the same event in runtime mode but in a control created at design time then fires ok.

Exemple:
 

procedure TMainForm.UniFormCreate(Sender: TObject);

  const after_render_Event = 'afterrender=function afterrender(sender, eOpts)  {  sender.allowBlank = false;}';

begin

  //Works ok
  //************
  // UniEdit Control (Created in Design mode)
  // Add client event in runtime fires ok
  UniEdit1.ClientEvents.ExtEvents.Add(after_render_Event);


  //No Works!!!!!!!!!!
  //*******************
  // UniEdit Control (Created at Rumtime time)
  FRunTimeUniEdit := TUniEdit(InsertControl(TUniEdit.Create(Self)));
  with FRunTimeUniEdit do
  begin
    Left := 72;
    Top := 122;
    Width := 200;
    // Add the same client event in runtime mode not fires
    ClientEvents.ExtEvents.Add(after_render_Event);
  end;
end;

Someone knows why this happens?

Thank you.

 

Sample.jpg

Link to post
Share on other sites

Hello,

Assign a name to the new creating component

  with FRunTimeUniEdit do
  begin
    Left := 72;
    Top := 122;
    Width := 200;
    Name := 'NewName';  //<----------------
    // Add the same client event in runtime mode not fires
    ClientEvents.ExtEvents.Add(after_render_Event);
  end;

 

  • Like 1
Link to post
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...