CheckListBox - how to pass a checklisbox to a function in Delphi

0

I need to create a function where I step into the function a CheckListBox and this function will store in a variable the values of the checklistbox.

function PegaDescricao(checklistbox .......... ) : String;                                                                          
var i, cont, descricao : Integer;  
begin
  cont := 0;                                   
  for i:=0 to checkListBox.Items.Count-1 do                 
  begin
    if cont = 0 then
    begin  
      cont := contad +1;                                                                                                      
      descricao:=copy(checkListBox.Items.Strings[i],1,Length(checkListBox.Items.Strings[i])-4);                            
    end
    else
      descricao:=descricao+', '+copy(checkListBox.Items.Strings[i],1,Length(checkListBox.Items.Strings[i])-4);  
  end;  
end;  
    
asked by anonymous 06.12.2018 / 14:27

1 answer

3

Like any delphi parameter, you need to declare your type. All delphi components are objects, so just pass the class name referring to the object along with the parameter.

function PegaDescricao(checklistbox: TCheckListBox): String;
    
06.12.2018 / 14:51