Article View: pl.comp.lang.delphi
Article #346481Re: Czy można się odwołać do zmiennej po nazwie tekstem?
From: Jan Drawski
Date: Wed, 21 Mar 2018 11:10
Date: Wed, 21 Mar 2018 11:10
31 lines
1992 bytes
1992 bytes
W dniu 2018-03-21 o 11:48, ExM pisze: > W dniu środa, 21 marca 2018 00:44:27 UTC+1 użytkownik Roman Tyczka napisał: >> On Tue, 20 Mar 2018 09:29:31 -0700 (PDT), ExM wrote: > >> Nie da się. [...] > Chciałbym umożliwić wczytanie wartości ze zmiennej istniejącej w aplikacji do dynamicznie tworzonego komponentu tEdit. > Informacje o tworzonym komponencie oraz tym co ma być wczytane do niego zapisane są w bazie danych. procedure ChangeVal(Obj: TObject; ValName: String; Val: TValue); var ctx: TRttiContext; rttitype: TRttiType; rttiprop: TRttiProperty; value: TValue; begin rttitype := ctx.GetType(Obj.ClassType); rttiprop := rttitype.GetProperty(ValName); rttiprop.SetValue(Obj, Val.ToString); end; procedure TForm1.Button1Click(Sender: TObject); begin ChangeVal(Edit1, 'Text', 'Test') end; -- Pozdrawiam Janek
Technical Details
Message-ID:
<5ab23db8$0$669$65785112@news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mailReferences:
<121d9004-81f5-4ce9-9c86-3e2c46815153@googlegroups.com> <1hiujpxl68d3y.dlg@tyczka.com> <c6e3f56f-5dc4-40d6-87b6-58e205049909@googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail Subject: Re: Czy można się odwołać do zmiennej po nazwie tekstem? Newsgroups: pl.comp.lang.delphi References: <121d9004-81f5-4ce9-9c86-3e2c46815153@googlegroups.com> <1hiujpxl68d3y.dlg@tyczka.com> <c6e3f56f-5dc4-40d6-87b6-58e205049909@googlegroups.com> From: Jan Drawski <dfghdfg@o2.pl> Date: Wed, 21 Mar 2018 12:10:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <c6e3f56f-5dc4-40d6-87b6-58e205049909@googlegroups.com> Lines: 31 Message-ID: <5ab23db8$0$669$65785112@news.neostrada.pl> Organization: Telekomunikacja Polska NNTP-Posting-Host: 37.47.35.253 X-Trace: 1521630648 unt-rea-a-01.news.neostrada.pl 669 37.47.35.253:5016 X-Complaints-To: abuse@news.neostrada.pl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit