properties - Publishing a property in a Lazarus component raises an 'Access violation' -


In Laser on Linux,

I have registered a component as a component, so that I leave it on a form.

Works like a charm, except that the qualities which I can publish are limited to simple forms like strings and integers.
Whenever I try to publish a property like a TStringList or TImage, it is an 'Access violation' when I click on it in Object Inspector.

I compared my code to standard components, but I do not know what they are doing differently.

So what is the extra step necessary to use such properties in the item inspector?

: 1. Create that asset inside your component controller - it will never be 2. In your property setter, you have to allocate your component to the new value for your value. Therefore, you must apply assignment method or assign in your component. Like

  TMyComponent = Class Private FString: TStrings; Published property strings: TString FStrings writes SetStrings; End; Manufacturer TMyComponent.Create (AOwner: TComponent); Start inheriting (AoONar); // Always make it in the constructor so that it will not be zero FStrings: = TStringList.Create; End; Process TMyComponent.SetStrings (Cost Avalue: TStrings); Start / this correct statement is FStrings.Assign (AValue); // This is not true // FStrings: = AValue; End;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -