![]() |
Re: Variablenübergabe - ich verzweifle
Hallo MuhKuh
könntest du vielleicht an einem simplen Beispiel zeigen wie das geht? :roll: |
Re: Variablenübergabe - ich verzweifle
Hi,
ist mal aus dem Kopf getippt:
Delphi-Quellcode:
unit Main;
interface uses Sub, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm3 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FormMain: TForm3; implementation {$R *.dfm} procedure TForm3.Button1Click(Sender: TObject); begin with TForm5.Create(Application) do begin try MemoText := 'Das ist ein Test'; ShowModal; finally Free; end; end; end; end.
Delphi-Quellcode:
unit Sub;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm5 = class(TForm) Memo1: TMemo; private { Private declarations } function GetMemoText: String; procedure SetMemoText(const Value: String); public property MemoText: String read GetMemoText write SetMemoText; end; implementation {$R *.dfm} function TForm5.GetMemoText: String; begin Result := Memo1.Text; end; procedure TForm5.SetMemoText(const Value: String); begin Memo1.Text := Value; end; end. |
Re: Variablenübergabe - ich verzweifle
vielen dank fuer die Antwort. Ich werde es gleich mal ausprobieren und mich dann nochmal melden.
:stupid: |
DP-Maintenance
Dieses Thema wurde von "Matze" von "Programmieren allgemein" nach "Object-Pascal / Delphi-Language" verschoben.
Delphi-Frage |
Re: Variablenübergabe - ich verzweifle
Hi Muh Kuh,
jepp es klappt :bounce2: vielen Merci. Manche einfach erscheinende Dinge kosten oft viel Schweiss. Ich habe die Sache jetzt mal für den "Transfer" von ListBoxen umgebogen. Vielen Dank.
Delphi-Quellcode:
unit Main;
interface uses Sub, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm3 = class(TForm) Button1: TButton; ListBoxMain: TListBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FormMain: TForm3; implementation {$R *.dfm} procedure TForm3.Button1Click(Sender: TObject); var i: integer; begin with TForm5.Create(Application) do begin try ListBoxMain.Items[0]:='erster eintrag'; ListBoxMain.Items[1]:='zweiter eintrag'; ListBoxMain.Items[2]:='noch ein eintrag'; listboxtrans:=listboxmain; ShowModal; finally Free; end; end; end; end.
Delphi-Quellcode:
unit Sub;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm5 = class(TForm) ListBox1: TListBox; private function GetListBox(): Tlistbox; procedure SetListBox(const Value: TListBox); public property ListBoxTrans: TListBox read GetListBox write SetListBox; end; var FormSub: TForm5; implementation {$R *.dfm} function TForm5.GetListBox: TListBox; begin GetListBox:= listbox1; end; procedure TForm5.SetListBox(const Value: TListBox); var i:integer; begin for i := 0 to value.Count - 1 do ListBox1.Items[i]:=value.Items[i]; end; end. |
Re: Variablenübergabe - ich verzweifle
Ich denke, dies:
Delphi-Quellcode:
kann man durch das:
procedure TForm5.SetListBox(const Value: TListBox);
var i:integer; begin for i := 0 to value.Count - 1 do ListBox1.Items[i]:=value.Items[i]; end;
Delphi-Quellcode:
ersetzen.
procedure TForm5.SetListBox(const Value: TListBox);
begin Listbox1.items.assign(Value.items); end; Grüße Klaus |
Re: Variablenübergabe - ich verzweifle
Danke Klaus
Delphi-Quellcode:
geht auch. Das hatte ich schonmal probiert, hat aber wegen eines anderen Fehlers nicht gefunzt.
ListboxFields.items.assign(Value.items);
Merci :corky: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz