<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
    <title>Invokable - Paste.ie</title>
    <description>Invokable - Paste.ie</description>
    <atom:link href="https://paste.ie/view/rss/707f3afe" rel="self" type="application/rss+xml" />
    <link>https://paste.ie/</link>
    <language>en</language>
<item>
    <title>Re: Invokable</title>
    <link>https://paste.ie/view/dfbddb12</link>
    <pubDate>Tue, 29 Nov 2016 01:35:02 +0000</pubDate>
    <dc:creator>Mature Leopard</dc:creator>
    <guid isPermaLink="false">https://paste.ie/view/dfbddb12</guid>
    <description><![CDATA[In this method: ------------------------- procedure TWidgetImpl&lt;T&gt;.SetInstance(const Inst: T); var ctx: TRttiContext; typ: TRttiType; m: TRttiMethod; begin typ := ctx.GetType(TypeInfo(T)); m :=&#8230;]]></description>
    <content:encoded><![CDATA[<div class="delphi" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">In</span> this method<span style="color: #000066;">:</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">-------------------------</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">procedure</span> TWidgetImpl&lt;T&gt;<span style="color: #000066;">.</span><span style="color: #006600;">SetInstance</span><span style="color: #000066;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> Inst<span style="color: #000066;">:</span> T<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">var</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; ctx<span style="color: #000066;">:</span> TRttiContext<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; typ<span style="color: #000066;">:</span> TRttiType<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; m<span style="color: #000066;">:</span> TRttiMethod<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">begin</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; typ <span style="color: #000066;">:</span><span style="color: #000066;">=</span> ctx<span style="color: #000066;">.</span><span style="color: #006600;">GetType</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">TypeInfo</span><span style="color: #000066;">&#40;</span>T<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; m <span style="color: #000066;">:</span><span style="color: #000066;">=</span> typ<span style="color: #000066;">.</span><span style="color: #006600;">GetMethod</span><span style="color: #000066;">&#40;</span><span style="color: #ff0000;">'Initialize'</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">Assigned</span><span style="color: #000066;">&#40;</span>m<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">begin</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; m<span style="color: #000066;">.</span><span style="color: #006600;">Invoke</span><span style="color: #000066;">&#40;</span>TValue<span style="color: #000066;">.</span><span style="color: #006600;">From</span>&lt;T&gt;<span style="color: #000066;">&#40;</span>Inst<span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span> <span style="color: #000066;">&#91;</span><span style="color: #000066;">&#93;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">--------------</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">I have a <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000066;">&#40;</span>fSubscriber<span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">of</span> T <span style="color: #000000; font-weight: bold;">and</span> I get access like this<span style="color: #000066;">:</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">typ <span style="color: #000066;">:</span><span style="color: #000066;">=</span> ctx<span style="color: #000066;">.</span><span style="color: #006600;">GetType</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>fSubscriber <span style="color: #000000; font-weight: bold;">as</span> <span style="color: #000066; font-weight: bold;">TObject</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">.</span><span style="color: #006600;">ClassInfo</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">....</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600;">m</span><span style="color: #000066;">.</span><span style="color: #006600;">Invoke</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>fSubscriber <span style="color: #000000; font-weight: bold;">as</span> <span style="color: #000066; font-weight: bold;">TObject</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span><span style="color: #000066;">&#91;</span><span style="color: #000066;">&#93;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Your code <span style="color: #000000; font-weight: bold;">is</span> different <span style="color: #000000; font-weight: bold;">in</span> these two lines<span style="color: #000066;">.</span> <span style="color: #006600;">I</span> think I tried <span style="color: #000000; font-weight: bold;">to</span> use TypeInfo <span style="color: #000000; font-weight: bold;">and</span> didn<span style="color: #ff0000;">'t work nicely if I recall correctly. </span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">Is it wrong what I am doing?</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">Thanks</span></div></li>
</ol></div>]]></content:encoded>
</item>
<item>
    <title>Re: Invokable</title>
    <link>https://paste.ie/view/5411a46e</link>
    <pubDate>Tue, 29 Nov 2016 01:34:37 +0000</pubDate>
    <dc:creator>Social Madrill</dc:creator>
    <guid isPermaLink="false">https://paste.ie/view/5411a46e</guid>
    <description><![CDATA[In this method: ------------------------- procedure TWidgetImpl&lt;T&gt;.SetInstance(const Inst: T); var ctx: TRttiContext; typ: TRttiType; m: TRttiMethod; begin typ := ctx.GetType(TypeInfo(T)); m :=&#8230;]]></description>
    <content:encoded><![CDATA[<div class="delphi" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">In</span> this method<span style="color: #000066;">:</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">-------------------------</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">procedure</span> TWidgetImpl&lt;T&gt;<span style="color: #000066;">.</span><span style="color: #006600;">SetInstance</span><span style="color: #000066;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> Inst<span style="color: #000066;">:</span> T<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">var</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; ctx<span style="color: #000066;">:</span> TRttiContext<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; typ<span style="color: #000066;">:</span> TRttiType<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; m<span style="color: #000066;">:</span> TRttiMethod<span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">begin</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; typ <span style="color: #000066;">:</span><span style="color: #000066;">=</span> ctx<span style="color: #000066;">.</span><span style="color: #006600;">GetType</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">TypeInfo</span><span style="color: #000066;">&#40;</span>T<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; m <span style="color: #000066;">:</span><span style="color: #000066;">=</span> typ<span style="color: #000066;">.</span><span style="color: #006600;">GetMethod</span><span style="color: #000066;">&#40;</span><span style="color: #ff0000;">'Initialize'</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">Assigned</span><span style="color: #000066;">&#40;</span>m<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">begin</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; m<span style="color: #000066;">.</span><span style="color: #006600;">Invoke</span><span style="color: #000066;">&#40;</span>TValue<span style="color: #000066;">.</span><span style="color: #006600;">From</span>&lt;T&gt;<span style="color: #000066;">&#40;</span>Inst<span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span> <span style="color: #000066;">&#91;</span><span style="color: #000066;">&#93;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">--------------</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">I have a <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000066;">&#40;</span>fSubscriber<span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">of</span> T <span style="color: #000000; font-weight: bold;">and</span> I get access like this<span style="color: #000066;">:</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">typ <span style="color: #000066;">:</span><span style="color: #000066;">=</span> ctx<span style="color: #000066;">.</span><span style="color: #006600;">GetType</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>fSubscriber <span style="color: #000000; font-weight: bold;">as</span> <span style="color: #000066; font-weight: bold;">TObject</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">.</span><span style="color: #006600;">ClassInfo</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066;">....</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #006600;">m</span><span style="color: #000066;">.</span><span style="color: #006600;">Invoke</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>fSubscriber <span style="color: #000000; font-weight: bold;">as</span> <span style="color: #000066; font-weight: bold;">TObject</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span><span style="color: #000066;">&#91;</span><span style="color: #000066;">&#93;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Your code <span style="color: #000000; font-weight: bold;">is</span> different <span style="color: #000000; font-weight: bold;">in</span> these two lines<span style="color: #000066;">.</span> <span style="color: #006600;">I</span> think I tried <span style="color: #000000; font-weight: bold;">to</span> use TypeInfo <span style="color: #000000; font-weight: bold;">and</span> didn<span style="color: #ff0000;">'t work nicely if I recall correctly. </span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">Is it wrong what I am doing?</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">Thanks</span></div></li>
</ol></div>]]></content:encoded>
</item>
</channel>
</rss>
