<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Focus setzen mit DHTML]]></title><description><![CDATA[<p>Ich habe eine von CHTMLView abgeleitete Klasse mit der ich HTML-Seiten darstelle. Jetzt möchte ich den Fokus auf ein bestimmtes &lt;input&gt; Element setzen,<br />
Das funktioniert aber nicht. Was fehlt noch?</p>
<pre><code class="language-cpp">CWnd* CHtmlFenster::do_SetFocus(_bstr_t ID){
 CWnd::SetFocus();
 CWnd* w=GetFocus();
 CComPtr&lt;IHTMLElement&gt; element;
 CComPtr&lt;IHTMLControlElement&gt; contr;
 CComPtr&lt;IHTMLElement&gt; contr2;
 HRESULT b=E_NOINTERFACE;
 if (getHtmlElement(ID,element)) {
    b=element-&gt;QueryInterface(IID_IHTMLControlElement, (void**) &amp;contr);
    if (b==S_OK){
        b=contr-&gt;focus();
                // Beim Debuggen ist hier b==S_OK, also alles in Ordnung, der
                // Fokus wird trotzdem nicht gesetzt. 
    }
 }
 return w;
}
</code></pre>
<p>Es ist sichergestellt das die Funktion erst ausgeführt wird, wenn die HTML-Seite geladen ist!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/5749/focus-setzen-mit-dhtml</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 15:30:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/5749.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 May 2003 08:09:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Focus setzen mit DHTML on Mon, 12 May 2003 08:09:00 GMT]]></title><description><![CDATA[<p>Ich habe eine von CHTMLView abgeleitete Klasse mit der ich HTML-Seiten darstelle. Jetzt möchte ich den Fokus auf ein bestimmtes &lt;input&gt; Element setzen,<br />
Das funktioniert aber nicht. Was fehlt noch?</p>
<pre><code class="language-cpp">CWnd* CHtmlFenster::do_SetFocus(_bstr_t ID){
 CWnd::SetFocus();
 CWnd* w=GetFocus();
 CComPtr&lt;IHTMLElement&gt; element;
 CComPtr&lt;IHTMLControlElement&gt; contr;
 CComPtr&lt;IHTMLElement&gt; contr2;
 HRESULT b=E_NOINTERFACE;
 if (getHtmlElement(ID,element)) {
    b=element-&gt;QueryInterface(IID_IHTMLControlElement, (void**) &amp;contr);
    if (b==S_OK){
        b=contr-&gt;focus();
                // Beim Debuggen ist hier b==S_OK, also alles in Ordnung, der
                // Fokus wird trotzdem nicht gesetzt. 
    }
 }
 return w;
}
</code></pre>
<p>Es ist sichergestellt das die Funktion erst ausgeführt wird, wenn die HTML-Seite geladen ist!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27958</guid><dc:creator><![CDATA[Didi]]></dc:creator><pubDate>Mon, 12 May 2003 08:09:00 GMT</pubDate></item><item><title><![CDATA[Reply to Focus setzen mit DHTML on Mon, 12 May 2003 08:22:00 GMT]]></title><description><![CDATA[<p>Vielleicht hilft dir das hier:<br />
von[url] <a href="http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/controlelement/focus.asp" rel="nofollow">http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/controlelement/focus.asp</a> [/url]<br />
Remarks</p>
<p>This method fires the onfocus event.</p>
<p>As of Microsoft<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/00ae.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--registered"
      title=":registered:"
      alt="®"
    /> Internet Explorer 5, elements that expose the IHTMLControlElement::focus method must have the TABINDEX attribute set.</p>
<p>Elements cannot receive focus until the document finishes loading.</p>
<p>Außerdem find ich das ja mal echt cool das sich hie rmal einer mit DHTML in MFC auseinander setzt.<br />
cu next<br />
Tristan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27959</guid><dc:creator><![CDATA[Tristan]]></dc:creator><pubDate>Mon, 12 May 2003 08:22:00 GMT</pubDate></item><item><title><![CDATA[Reply to Focus setzen mit DHTML on Mon, 12 May 2003 10:51:00 GMT]]></title><description><![CDATA[<p>Danke für die Anregung Tristan.<br />
Ich habe eine Lösung gefunden.<br />
Das Problem ist, das zuerst das HTML-Fenster (IHTMLWindow2) den Fokus erhalten muss, danach funktioniert es. (Ich habe keine Ahnung warum!).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27960</guid><dc:creator><![CDATA[Didi]]></dc:creator><pubDate>Mon, 12 May 2003 10:51:00 GMT</pubDate></item></channel></rss>