Anyway to access component's internal object? lazarus / 21-General ---------------------------------------------------------------------- egsuh · 2022-08-27 11:29 Currently I'm looking into TValueListEditor, but it may apply to other components as well. There is a TValueListEditor.Strings property, which is type TValueListStrings which is again a descendant of TStringList. Now, let's assume that I have followings within an object.        AValueListEditor1: TValueListEditor;        AStringList: TValueListStrings; Is there any way that I set ValueListEditor1.Strings := AStringList and edit AStringList's content directly? Currently I do :         ValueListEditor1.Strings.Text := AStrlngList.Text;      to copy from AStringList, and then after editing,          AStringList.Text := ValueListEditor1.Strings.Text; to copy to. What I want is to edit AStringList directly using a TValueListEditor, without copying the contents from forth and back. As you guess, when the ValueListEditor1 is destroyed, the content should not be freed. This looks similar to RTTI controls, but I think not the same. I just looking for ways to access specific memory directly. ---------------------------------------------------------------------- Thaddy · 2022-08-27 11:44 Do not use a Tstringlist but instead create a TValueListStrings instead of TStringlist. then you can do:  ValueListEditor1.Strings := AStrlngList;  // the latter is now a  TValueListStrings provided the strings property is read/write, which it should be. ---------------------------------------------------------------------- dje · 2022-08-27 12:44 Why do you need two TStringList's? (TValueListStrings is derived from TStringList) I can think of only two reasons. Unless you are destoying your TValueListEditor, or you have speed/performance issues, I'd just use the same TStringList. ie: The one TValueListEditor provides. ---------------------------------------------------------------------- Thaddy · 2022-08-27 13:01 I think OP's idea is to use the same editor for similar but not equal values. Anyway, in both cases it is better not use a Tstringlist, but use TValuelistStrings, because it only adds methods and does not affect Tstringlist functionality otherwise.. That said, why not use simply assign? In that case you can indeed use any Tstrings descendent. E.G.: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ValueListEditor1.Strings.beginupdate; // don't forget! ValueListEditor1.Strings.Assign( AStringList);      //Simply assign AStringList, ValueListEditor1.Strings.endupdate; // don't forget! ---------------------------------------------------------------------- egsuh · 2022-08-27 14:30 I'll settle on Assign for now. What I intended is to edit an invisible object (whether it is TStringList or TValueListEditor), without copying it into TValueListEditor's internal object.  To summarize, what I want is AStringList is alive after following operations. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i AStringList.Text := 'many lines of texts'; OriginalStringAddr := ValueListEditor1.Strings; ValueListEditor1.Strings := AStringList; // ... doing things inserting and deleting list  ....ValueListEditor1.Strings := OriginalStringAddr; ValueListEditor1.Free;   // by Closing forms, etc. ADataSet.FieldByName('Options').AsString := AStringList.Text; // what I want is this. It might look weird, but this is ultimate differentiation of data and visual operation^^, I guess. Of course, I'm not at a position to discuss on software engineering.  Just imagination. Anyway this is not applicable. TValueListEditor1.setStrings is defined as :           FStrings.Assign(Avalue); So it just copies content only. And Assign seems not to work with TValueListStrings --- don't know why. Probably TValueListStrings without owner may not operate properly.