Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#1

Eigene Property - Zur Runtime wieder zurückgesetzt

  Alt 22. Sep 2006, 15:38
Hi,

Also ich bin ja gerade ne Property mit dem PropertyEditor am basteln.. Also das klappt auch soweit schon...
Während der Designtime wird alles richtig angezeigt. Wenn ich das Programm aber starte dann ist die Komponente im Ur-Zustand

Delphi-Quellcode:
procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(TDPListItems), nil, '', TDPItemPropEdit);
end;

procedure TDPItemPropEdit.Edit;
var Dlg: TDPListItemsEditForm;
begin
  Dlg := TDPListItemsEditForm.Create(Application);
  try
    with Dlg do
    begin
      DPItems := TDPListItems(GetOrdValue);
      ShowModal;
    end;
  finally
    FreeAndNil(Dlg);
  end
end;

function TDPItemPropEdit.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;
Die EditForm:

Delphi-Quellcode:
procedure TDPListItemsEditForm.FormShow(Sender: TObject);
var i: Integer;
begin
  // "Laden"
  for i:= 0 to DPItems.Count-1 do
   ListBox1.Items.Add(DPItems[i].Caption);
  DPItems.Clear;
end;

procedure TDPListItemsEditForm.Button2Click(Sender: TObject);
var i: Integer;
begin
  // OK Button.. Properties werden gesetzt.. der Property editor wird geschlossen
  for i:= 0 to ListBox1.Count-1 do
  begin
    DPItems.Add(ListBox1.Items[i]);
  end;
  Close;
end;

procedure TDPListItemsEditForm.Button1Click(Sender: TObject);
begin
  ListBox1.Items.Add(Edit1.Text)
end;
Woran kann das liegen?

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat