Jump to content

Dynamic create TUniRadioGroup, how add ExtEvents


uniguibbs
 Share

Recommended Posts

unigui 0.94  

 delphi xe2

 

Dynamic create TUniRadioGroup.

following code,  the columns doesn't divide to 6. 

what's wrong?

 

  RemoveControl(rgEmp2);  
  rgEmp2 := TUniRadioGroup(InsertControl(TUniRadioGroup.Create(Self)));
  rgEmp2.ClientEvents.ExtEvents.Add(
    'radioGroup.beforerender=function radioGroup.beforerender(sender, eOpts)'
    + #13#10
    + '{'
    + #13#10
    + 'sender.columns = 6'
    + #13#10
    + '}'
  ); 
 
 
  if not cdsDepMan.IsEmpty then
  begin
    cdsDepMan.First;
    while not cdsDepMan.Eof do
    begin
      rgEmp2.Items.Add(cdsDepManempname.AsString);
      cdsDepMan.Next;
    end;
  end;

 

Link to comment
Share on other sites

second question:

    give a name to the componet.

    next time run this code ,  exception raise

 

 

---------------------------
Debugger Exception Notification
---------------------------
Project FlowQinJia.exe raised exception class EComponentError with message 'A component named rgrmp2 already exists'.
---------------------------
 
i try to  RemoveControl(rgEmp2) at first;   

 

another exception raise  " the component not exists."

what's wrong?
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.

 Share

×
×
  • Create New...