Autor Beitrag
MisterB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Windows XP
Delphi 5 Professional
BeitragVerfasst: Mi 25.02.04 11:14 
Hallo,

aus einer combobox und einem treeview habe ich eine neue Komponente (TreeComboBox) erstellt. Im Objektinspektor wollte ich nun einen eigenen Knoten (TreeOptions) erstellen, in dem unter anderem die Eigenschaft Tree.Height dargestellt werden soll. Leider bekomme ich immer eine Zugriffsverletzung. Wahrscheinlich darf ich nicht in beiden den Treeview deklarieren. Habe aber keine Ahnung wie ich es sonst machen könnte. Hier noch ein kleiner Auszug des Programmcodes:


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
TTree = class(TTreeView)
  private
  ...  
  public
  ...
  protected
  ...  
  published
  end;

TTreeOptions = class(TPersistent)
    Tree: TTree;
  private
    function GetTreeHeight: Integer;
    procedure SetTreeHeight(newValue: Integer);
  published
    property TreeHeight: Integer read GetTreeHeight write SetTreeHeight;
  end;

TFlatTreeComboBox = class(TCustomComboBox)
    Tree : TTree;
  private
    FTreeOptions: TTreeOptions;
  published
     property TreeOptions: TTreeOptions read FTreeOptions write FTreeOptions;
  end;

implementation

function TTreeOptions.GetTreeHeight: Integer;
begin
  GetTreeHeight := Tree.Height;
end;

procedure TTreeOptions.SetTreeHeight(newValue: Integer);
begin
  Tree.Height := newValue;
end;


Vielen Dank!

Gruß
Stefan

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 25.02.04 12:42 
Deine Vorgehensweise ist eigentlich schon richtig, allerdings ist aus dem bisschen Source nicht zu erkennen wo dein Fehler liegt... Zeig mal ein bisschen mehr Code...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 25.02.04 13:15 
Hallo,

mir fehlt da irgendiw, wo du FTreeOptions erzeugst und wieder freigibst (am besten im überschriebenem constructor von TFlatTreeComboBox)

mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 25.02.04 13:21 
Keldorn hat folgendes geschrieben:
mir fehlt da irgendiw, wo du FTreeOptions erzeugst und wieder freigibst (am besten im überschriebenem constructor von TFlatTreeComboBox)

Deswegen hab ich ja geschrieben dass es ein bisschen zu wenig Source ist.... ;)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
MisterB Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Windows XP
Delphi 5 Professional
BeitragVerfasst: Mi 25.02.04 14:28 
Hallo nochmal!

Ich schicke euch mal den gesamten Code. Ich hoffe es ist nicht zu viel.
Ich habe unter anderem Teile von einer anderen Komponente benutzt, deshalb sind vielleicht manche Teile des Codes überflüssig oder umständlich. Ich wollte aber eine 2D TreeComboBox erstellen.
Außerdem habe ich noch ein weiteres Problem, wenn ich schon den ganzen Code poste. Mit Hilfe der procedure TFlatTreeComboBox.Click wird der Treeview angezeigt und die Capture control an ihn übergeben. Ich würde aber anschließend gerne noch einmal die procedure TFlatTreeComboBox.PaintButton aufrufen um den Button neu zeichnen. Wenn ich die CaptureControl nicht an den Tree übergebe, reagiert die Komponente sehr langsam auf einen MausClick.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
type
  TTree = class(TTreeView)
  private
    procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
  public
    { Public-Deklarationen }
  protected
    procedure CreateParams(var Params: TCreateParams); override;
    procedure CreateWnd; override;
  published
  end;

  TTreeOptions = class(TPersistent)
    Tree: TTree;
  private
    function GetTreeHeight: Integer;
    procedure SetTreeHeight(newValue: Integer);
    function GetShowRoot: boolean;
    procedure SetShowRoot(RootStatus: boolean);
    function GetChangeDelay: integer;
    procedure SetChangeDelay(Time: Integer);
    function GetItems: TTreeNodes;
    procedure SetItems(Items: TTreeNodes);
  published
    property TreeHeight: Integer read GetTreeHeight write SetTreeHeight;
    property ShowRoot: Boolean read GetShowRoot write SetShowRoot;
    property ChangeDelay: Integer read GetChangeDelay write SetChangeDelay;
    property Items: TTreeNodes read GetItems write SetItems;
  end;

  TFlatTreeComboBox = class(TCustomComboBox)
    Tree : TTree;
  private
    FArrowColor: TColor;
    FArrowBackgroundColor: TColor;
    FBorderColor: TColor;
    FUseAdvColors: Boolean;
    FAdvColorArrowBackground: TAdvColors;
    FAdvColorBorder: TAdvColors;
    FButtonWidth: Integer;
    FChildHandle: HWND;
    FDefListProc: Pointer;
    FListHandle: HWND;
    FListInstance: Pointer;
    FSysBtnWidth: Integer;
    FSolidBorder: Boolean;
    FTreeOptions: TTreeOptions;
    procedure SetColors (Index: Integer; Value: TColor);
    function GetButtonRect: TRect;
    procedure PaintButton;
    procedure PaintBorder;
    procedure RedrawBorders;
    function GetSolidBorder: Boolean;
    procedure SetSolidBorder;
    procedure WMKillFocus (var Message: TMessage); message WM_KILLFOCUS;
    procedure WMPaint (var Message: TWMPaint); message WM_PAINT;
    procedure WMNCPaint (var Message: TMessage); message WM_NCPAINT;
    procedure CMEnabledChanged (var Msg: TMessage); message CM_ENABLEDCHANGED;
    procedure CMFontChanged (var Message: TMessage); message CM_FONTCHANGED;
    procedure CMSysColorChange (var Message: TMessage); message CM_SYSCOLORCHANGE;
    procedure CMParentColorChanged (var Message: TWMNoParams); message CM_PARENTCOLORCHANGED;
    function GetPopupMenu: TPopupMenu; reintroduce;
    procedure SetPopupMenu(AValue: TPopupMenu);
  protected
    procedure CalcAdvColors;
    procedure WndProc (var Message: TMessage); override;
    property SolidBorder: Boolean read FSolidBorder;
    procedure Click (var Message: TWMLButtonDown); reintroduce; message WM_LBUTTONDOWN;
  public
    constructor Create (AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property TreeOptions: TTreeOptions read FTreeOptions write FTreeOptions;
end;

implementation

{ TTree }

procedure TTree.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do
  begin
    Style := Style or WS_BORDER;
    ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;
    WindowClass.Style := CS_SAVEBITS;
  end;
end;

procedure TTree.CreateWnd;
begin
  inherited CreateWnd;
  Font.Size := 8;
  Font.Name := 'MS Sans Serif';
  Windows.SetParent(Handle, 0);
  CallWindowProc(DefWndProc, Handle, wm_SetFocus, 0, 0);
end;

procedure TTree.WMLButtonDown(var Message: TWMLButtonDown);
begin
  ReleaseCapture;
  Enabled := false;
  Visible := false;
end;

{TFlatTreeComboBox}

constructor TFlatTreeComboBox.Create (AOwner: TComponent);

begin
  inherited Create(AOwner);
  ControlStyle := ControlStyle - [csFixedHeight] + [csOpaque];
  TControlCanvas(Canvas).Control := self;
  FButtonWidth := 11;
  FSysBtnWidth := GetSystemMetrics(SM_CXVSCROLL);
  FDefListProc := nil;
  ItemHeight := 13;
  FArrowColor := clBlack;
  FArrowBackgroundColor := $00C5D6D9;
  FBorderColor := $008396A0;
  FUseAdvColors := False;
  FAdvColorBorder := 50;
  FAdvColorArrowBackground := 10;
  Style := csSimple;
  Tree := TTree.Create(Self);
  Tree.Parent := Self;
  with Tree do
  begin
    Top := Self.Top + Self.Height;
    Left := 0;
    Width := 0;
    Height := 200;
    Enabled := False;
    Visible := False;
  end;
  FTreeOptions := TTreeOptions.Create;
end;

destructor TFlatTreeComboBox.Destroy;
begin
  FreeObjectInstance(FListInstance);
  inherited;
end;

procedure TFlatTreeComboBox.SetColors (Index: Integer; Value: TColor);
begin
  case Index of
    0: FArrowColor := Value;
    1: FArrowBackgroundColor := Value;
    2: FBorderColor := Value;
  end;
  Invalidate;
end;

procedure TFlatTreeComboBox.CalcAdvColors;
begin
  if FUseAdvColors then
  begin
    FBorderColor := CalcAdvancedColor(TForm(Parent).Color, FBorderColor, FAdvColorBorder, darken);
    FArrowBackgroundColor := CalcAdvancedColor(TForm(Parent).Color, FArrowBackgroundColor, FAdvColorArrowBackground, darken);
  end;
end;

procedure TFlatTreeComboBox.CMSysColorChange (var Message: TMessage);
begin
  if FUseAdvColors then
    CalcAdvColors;
  Invalidate;
end;

procedure TFlatTreeComboBox.CMParentColorChanged (var Message: TWMNoParams);
begin
  if FUseAdvColors then
    CalcAdvColors;
  Invalidate;
end;

procedure TFlatTreeComboBox.WndProc (var Message: TMessage);
begin
  if (Message.Msg = WM_PARENTNOTIFY) then
    case LoWord(Message.wParam) of
      WM_CREATE:
        if FDefListProc <> nil then
        begin
          SetWindowLong(FListHandle, GWL_WNDPROC, Longint(FDefListProc));
          FDefListProc := nil;
          FChildHandle := Message.lParam;
        end
        else
          if FChildHandle = 0 then
            FChildHandle := Message.lParam
          else
            FListHandle := Message.lParam;
      end
  else
    if (Message.Msg = WM_WINDOWPOSCHANGING) then
      if Style in [csDropDown, csSimple] then
        SetWindowPos( EditHandle, 0,
          0, 0, ClientWidth - FButtonWidth - 2 * 2 - 4, Height - 2 * 2 - 2,
          SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE + SWP_NOREDRAW);
  inherited;
  if Message.Msg = WM_CTLCOLORLISTBOX then
  begin
    SetBkColor(Message.wParam, ColorToRGB(Color));
    Message.Result := CreateSolidBrush(ColorToRGB(Color));
  end;
end;

procedure TFlatTreeComboBox.WMKillFocus (var Message: TMessage);
begin
  inherited;
  if not (csDesigning in ComponentState) then
  begin
    SetSolidBorder;
  end;
end;

procedure TFlatTreeComboBox.CMEnabledChanged (var Msg: TMessage);
begin
  inherited;
  Invalidate;
end;

procedure TFlatTreeComboBox.WMPaint (var Message: TWMPaint);
var
  R: TRect;
  DC: HDC;
  PS: TPaintStruct;
begin
  DC := BeginPaint(Handle, PS);
  try
    R := PS.rcPaint;
    if R.Right > Width - FButtonWidth - 4 then
      R.Right := Width - FButtonWidth - 4;
    FillRect(DC, R, Brush.Handle);
    if RectInRect(GetButtonRect, PS.rcPaint) then
      PaintButton;
    ExcludeClipRect(DC, ClientWidth - FSysBtnWidth - 2, 0, ClientWidth, ClientHeight);
    PaintWindow(DC);
    if Tree.Visible = true then
    begin
      R := ClientRect;
      InflateRect(R, -2, -2);
      R.Right := Width - FButtonWidth - 3;
      Canvas.Brush.Color := clWindow;
      Canvas.FrameRect(R);
    end
  finally
    EndPaint(Handle, PS);
  end;
  RedrawBorders;
  Message.Result := 0;
end;

procedure TFlatTreeComboBox.WMNCPaint (var Message: TMessage);
begin
  inherited;
  RedrawBorders;
end;

procedure TFlatTreeComboBox.CMFontChanged (var Message: TMessage);
begin
  inherited;
  ItemHeight := 13;
  RecreateWnd;
end;

function TFlatTreeComboBox.GetButtonRect: TRect;
begin
  GetWindowRect(Handle, Result);
  OffsetRect(Result, -Result.Left, -Result.Top);
  Inc(Result.Left, ClientWidth - FButtonWidth);
  OffsetRect(Result, -1, 0);
end;

procedure TFlatTreeComboBox.PaintButton;
var
  R: TRect;
  x, y: Integer;
begin
  R := GetButtonRect;
  InflateRect(R, 1, 0);

  Canvas.Brush.Color := FArrowBackgroundColor;
  Canvas.FillRect(R);
  Canvas.Brush.Color := FBorderColor;
  Canvas.FrameRect(R);

  x := (R.Right - R.Left) div 2 - 6 + R.Left;
  if Tree.Visible = true then
    y := (R.Bottom - R.Top) div 2 - 1 + R.Top
  else
    y := (R.Bottom - R.Top) div 2 - 1 + R.Top;

  if Enabled = true then
  begin
    canvas.Brush.Color := FArrowColor;
    canvas.Pen.Color := FArrowColor;
    if Tree.Visible = true then
      canvas.Polygon([Point(x + 4, y + 2), Point(x + 8, y + 2), Point(x + 6, y)])
    else
      canvas.Polygon([Point(x + 4, y), Point(x + 8, y), Point(x + 6, y + 2)]);
  end
  else
  begin
    canvas.Brush.Color := clWhite;
    canvas.Pen.Color := clWhite;
    Inc(x); Inc(y);
    if Tree.Visible = true then
      canvas.Polygon([Point(x + 4, y + 2), Point(x + 8, y + 2), Point(x + 6, y)])
    else
      canvas.Polygon([Point(x + 4, y), Point(x + 8, y), Point(x + 6, y + 2)]);
    Dec(x); Dec(y);
    canvas.Brush.Color := clGray;
    canvas.Pen.Color := clGray;
    if Tree.Visible = true then
      canvas.Polygon([Point(x + 4, y + 2), Point(x + 8, y + 2), Point(x + 6, y)])
    else
      canvas.Polygon([Point(x + 4, y), Point(x + 8, y), Point(x + 6, y + 2)]);
  end;
  ExcludeClipRect(Canvas.Handle, ClientWidth - FSysBtnWidth, 0, ClientWidth, ClientHeight);
end;

procedure TFlatTreeComboBox.PaintBorder;
var
  DC: HDC;
  R: TRect;
  BtnFaceBrush, WindowBrush: HBRUSH;
begin
  DC := GetWindowDC(Handle);

  GetWindowRect(Handle, R);
  OffsetRect(R, -R.Left, -R.Top);
  Dec(R.Right, FButtonWidth + 1);
  try
    BtnFaceBrush := CreateSolidBrush(ColorToRGB(FBorderColor));
    WindowBrush := CreateSolidBrush(ColorToRGB(Color));

    FrameRect(DC, R, BtnFaceBrush);
    InflateRect(R, -1, -1);
    FrameRect(DC, R, WindowBrush);
    InflateRect(R, -1, -1);
    FrameRect(DC, R, WindowBrush);
  finally
    ReleaseDC(Handle, DC);
  end;
  DeleteObject(WindowBrush);
  DeleteObject(BtnFaceBrush);
end;

function TFlatTreeComboBox.GetSolidBorder: Boolean;
begin
  Result := ( (csDesigning in ComponentState) and Enabled) or
    (not(csDesigning in ComponentState) and
    ((GetFocus = Handle) or (GetFocus = EditHandle)) );
end;

procedure TFlatTreeComboBox.SetSolidBorder;
var
  sb: Boolean;
begin
  sb := GetSolidBorder;
  if sb <> FSolidBorder then
  begin
    FSolidBorder := sb;
    RedrawBorders;
  end;
end;

procedure TFlatTreeComboBox.RedrawBorders;
begin
  PaintBorder;
end;

procedure TFlatTreeComboBox.Click(var Message: TWMLButtonDown);
var
  CP, SP: TPoint;
begin
  CP.X := Left;
  CP.Y := Top + Height;
  SP := Parent.ClientToScreen(CP);
  with Tree do
  begin
    Left := SP.X;
    Top := SP.Y;
    Width := Self.Width;
    Enabled := True;
    Visible := True;
    SetCaptureControl(Tree);
  end;
end;

function TFlatTreeComboBox.GetPopupMenu: TPopupMenu;
begin
  GetPopupMenu:=Tree.PopupMenu;
end;

procedure TFlatTreeComboBox.SetPopupMenu(AValue: TPopupMenu);
begin
  Tree.PopupMenu:=AValue;
end;

{TTreeOptions}

function TTreeOptions.GetTreeHeight: Integer;
begin
  GetTreeHeight := Tree.Height;
end;

procedure TTreeOptions.SetTreeHeight(newValue: Integer);
begin
  Tree.Height := newValue;
end;

function TTreeOptions.GetShowRoot: boolean;
begin
  GetShowRoot:=Tree.ShowRoot;
end;

procedure TTreeOptions.SetShowRoot(RootStatus: boolean);
begin
  Tree.ShowRoot:=RootStatus;
end;

function TTreeOptions.GetChangeDelay: Integer;
begin
  GetChangeDelay:=Tree.ChangeDelay;
end;

procedure TTreeOptions.SetChangeDelay(Time: Integer);
begin
  Tree.ChangeDelay:=Time;
end;

function TTreeOptions.GetItems: TTreeNodes;
begin
  GetItems:=Tree.Items;
end;

procedure TTreeOptions.SetItems(Items: TTreeNodes);
begin
  Tree.Items:=Items;
end;

end.


Gruß
Stefan

Moderiert von user profile iconDeCodeGuru: Code- durch Delphi-Tags ersetzt
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 25.02.04 20:27 
Hallo

hättest doch gleich sagen können, das du ftreeoptions erzeugst ;)

Aber mir fällt da wieder was ein, da war was. dein Code ist mir jetzt zu lang, als das ich das jetzt probieren könnte, d.h. mal ne neue sinnvolle ;) Kompo gemacht.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
type
  ttestpanel = class(tpanel)
  private
    FStrings: tstrings;
    FStrings2: TStrings;
    procedure SetStrings(const Value: tstrings);
    procedure SetStrings2(const Value: TStrings);
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published-Deklarationen }
    property Strings:tstrings read FStrings write SetStrings;
    property Strings2:TStrings read FStrings2 write SetStrings2;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Beispiele', [ttestpanel]);
end;

{ ttestpanel }

constructor ttestpanel.Create(AOwner: TComponent);
begin
  inherited create(aowner);
  FStrings:=TStringlist.Create;
  FStrings2:=TStringlist.Create;
end;

destructor ttestpanel.Destroy;
begin
  FStrings.Free;
  FStrings2.Free;
  inherited;
end;

procedure ttestpanel.SetStrings(const Value: tstrings);
begin
  FStrings := Value;
end;

procedure ttestpanel.SetStrings2(const Value: TStrings);
begin
  FStrings2.Assign(value);  //<-----
end;

der einzigste unterschied zwischen den stings und strings2 - eigenschaften ist das assign bei der Setmethode. Änderungen im OI werden nur bei Strings2 gehen. (und wenn auch bei strings dann bestimmt kein zweites mal), bei strings wirds AV´s geben. Irgendwo habe ich mal aufgeschnappt, das der oi immer mit eigenen Objekten arbeitet, die dann die eigentliche Komponente auch kopieren muß, d.h. das assign. eine einfache Zuweisung mit := reicht hier nicht. die ganzen VCL-Kompos sind auch so aufgebaut.
großartig sicher bin ich da aber nicht in der Erklärung, vielleicht schreibt nochmal jemadn was dazu :) oder/und korrigiert mich.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)