<?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 Problem in CFormView]]></title><description><![CDATA[<p>Moin erstmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich habe eine ListCtrl Klasse, in die ich eine OnPlaceEdit<br />
Funktionalität eingebaut habe, also, es bekommt eine editbox<br />
den focus, wenn man auf einen Listeneintrag klickt, um ihn dort<br />
zu editieren. Klappt alles wunderbar in einem Dialog.</p>
<p>So, nun hab ich in meinem Projekt aber ein SplitterWindow, ein Treeview,<br />
und ein FormView, in den Formview ist das ListCtrl eingebettet.<br />
Wenn ich nun drauf klicke, erscheint erstgar kein Editfeld mehr, und<br />
ich kann nicht sehen was passiert, aber das getippte landet trotdem<br />
im Editfeld, (nur net sichtbar).</p>
<p>Der Quellcode:</p>
<pre><code class="language-cpp">void LInc::OnClick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPNMITEMACTIVATE    lpNMItem = (LPNMITEMACTIVATE) pNMHDR;
	if(lpNMItem-&gt;iItem &gt; -1 )
	{
		//MessageBox(&quot;test&quot;);
	CString str;
	int x,y;
	// TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen
	RECT rect,rect1,rect2;

	str = GetItemText(lpNMItem-&gt;iItem ,lpNMItem-&gt;iSubItem);

	ListView_GetSubItemRect(m_hWnd,lpNMItem-&gt;iItem,
		lpNMItem-&gt;iSubItem,LVIR_BOUNDS,&amp;rect);
	//Get the Rectange of the listControl
	GetWindowRect(&amp;rect1);
	//Get the Rectange of the Dialog
	::GetWindowRect(hwnd,&amp;rect2);

	x=rect1.left-rect2.left;
	y=rect1.top-rect2.top;

	edit-&gt;SetWindowPos((CWnd*)HWND_TOP,rect.left+x,rect.top+y-20, 
		rect.right-rect.left - 3,
		rect.bottom-rect.top -1,NULL);//Editbox über eintrag positionieren

//	edit-&gt;Setlist(this)

	edit-&gt;Init(str,lpNMItem-&gt;iItem,lpNMItem-&gt;iSubItem);
	edit-&gt;ShowWindow(SW_SHOW);//Fernster auf Show setzten

	if(edit-&gt;SetFocus()==NULL)//Fenster den Focus geben
		MessageBox(&quot;null&quot;);
	//Draw a Rectangle around the SubItem
	::Rectangle(::GetDC(lpNMItem-&gt;hdr.hwndFrom),
		rect.left,rect.top-1,rect.right,rect.bottom);//nett rummalen
	}
	*pResult = 0;
}
</code></pre>
<p>Hat jemand eine Idee woran es liegt, das das Editfeld unsichtbar bleibt im FormView ?<br />
Gäbe es eine Alternative zu ShowWindow ?</p>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/69910/focus-problem-in-cformview</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 21:24:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/69910.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Apr 2004 18:52:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Focus Problem in CFormView on Thu, 01 Apr 2004 18:52:18 GMT]]></title><description><![CDATA[<p>Moin erstmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich habe eine ListCtrl Klasse, in die ich eine OnPlaceEdit<br />
Funktionalität eingebaut habe, also, es bekommt eine editbox<br />
den focus, wenn man auf einen Listeneintrag klickt, um ihn dort<br />
zu editieren. Klappt alles wunderbar in einem Dialog.</p>
<p>So, nun hab ich in meinem Projekt aber ein SplitterWindow, ein Treeview,<br />
und ein FormView, in den Formview ist das ListCtrl eingebettet.<br />
Wenn ich nun drauf klicke, erscheint erstgar kein Editfeld mehr, und<br />
ich kann nicht sehen was passiert, aber das getippte landet trotdem<br />
im Editfeld, (nur net sichtbar).</p>
<p>Der Quellcode:</p>
<pre><code class="language-cpp">void LInc::OnClick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPNMITEMACTIVATE    lpNMItem = (LPNMITEMACTIVATE) pNMHDR;
	if(lpNMItem-&gt;iItem &gt; -1 )
	{
		//MessageBox(&quot;test&quot;);
	CString str;
	int x,y;
	// TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen
	RECT rect,rect1,rect2;

	str = GetItemText(lpNMItem-&gt;iItem ,lpNMItem-&gt;iSubItem);

	ListView_GetSubItemRect(m_hWnd,lpNMItem-&gt;iItem,
		lpNMItem-&gt;iSubItem,LVIR_BOUNDS,&amp;rect);
	//Get the Rectange of the listControl
	GetWindowRect(&amp;rect1);
	//Get the Rectange of the Dialog
	::GetWindowRect(hwnd,&amp;rect2);

	x=rect1.left-rect2.left;
	y=rect1.top-rect2.top;

	edit-&gt;SetWindowPos((CWnd*)HWND_TOP,rect.left+x,rect.top+y-20, 
		rect.right-rect.left - 3,
		rect.bottom-rect.top -1,NULL);//Editbox über eintrag positionieren

//	edit-&gt;Setlist(this)

	edit-&gt;Init(str,lpNMItem-&gt;iItem,lpNMItem-&gt;iSubItem);
	edit-&gt;ShowWindow(SW_SHOW);//Fernster auf Show setzten

	if(edit-&gt;SetFocus()==NULL)//Fenster den Focus geben
		MessageBox(&quot;null&quot;);
	//Draw a Rectangle around the SubItem
	::Rectangle(::GetDC(lpNMItem-&gt;hdr.hwndFrom),
		rect.left,rect.top-1,rect.right,rect.bottom);//nett rummalen
	}
	*pResult = 0;
}
</code></pre>
<p>Hat jemand eine Idee woran es liegt, das das Editfeld unsichtbar bleibt im FormView ?<br />
Gäbe es eine Alternative zu ShowWindow ?</p>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/493418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/493418</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Thu, 01 Apr 2004 18:52:18 GMT</pubDate></item></channel></rss>