Jump to content

Dynamic create TUniRadioGroup, how add ExtEvents


uniguibbs

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...