[DUG] Compnent creation question

Robert martin rob at chreos.co.nz
Wed Oct 15 16:44:58 NZDT 2008


Hi

Same error. 

Further info.  The error is now showing 'Control 'CB' has no parent'  
where CB is the name of the combobox.  manually freeing the combobox 
using a button and a .free works perfectly (all objects are freed and no 
erros).

Rob


Neven MacEwan wrote:
> Robert
>
> Have/can you updatebegin, updateend around the items property?
>
> Randon thought of the top of my head
>
> N
>   
>> Hi
>>
>> Just trying to make a TComboBox that automatically frees its items.
>>
>> I have the following code in the destructor
>>
>>     if (fAutomaticallyFreeObjects = True)
>>             and ((csDesigning in ComponentState) = False) then begin
>>         try
>>             for Counter := 0 to Self.Items.Count - 1 do begin
>>                 O := Items.Objects[Counter];
>>                 if (O <> nil) then begin
>>                    O.Free;
>>                 end;
>>             end;
>>         except
>>             on e: exception do begin
>>                 ShowMessage(IntToStr(i) + ' ' + 'Attempting to 
>> automatically free object memory.  The following error occured...' + 
>> #13#13 + e.message);
>>             end;
>>         end;
>>     end;
>>
>>
>> I get a 'Control '' has no parent error.  This happens when attempting 
>> to access the .Items property.  My custom error handling does not trigger.
>>
>> Any suggestions ?
>>
>> Thanks
>> Rob
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>>
>>
>>   
>>     
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>
>   


More information about the Delphi mailing list