<?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[Probleme mit DynTabCtrl]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich weiß nicht, ob hier irgendjemand mit der Klasse DynTabCtrl arbeitet, aber ich versuche mein Glück trotzdem mal. Ich habe folgendes Problem:</p>
<p>- Ich habe ein Dialog mit mehren Tabs (mit Hilfe von DynTabCtrl)<br />
- Bei einen Unterdialog habe ich ein Button und wenn dieser geklickt wird, geht ein neues Fenster mit mehreren Tabs auf (auch wieder mit DyntabCtrl)<br />
- Das klappt alles einwandfrei, weil die Bedingung mit Hilfe deiner Klasse sehr intuitiv ist<br />
- Wenn ich dieser Fenster nun schließe und erneut, durch Klicken auf den Button, öffnen will, schmiert mir das Programm immer ab<br />
- Und zwar hier:</p>
<pre><code>BOOL CWnd::SetWindowPos(const CWnd* pWndInsertAfter, int x, int y, int cx,
      int cy, UINT nFlags)
{
      ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));

      if (m_pCtrlSite == NULL)
            return ::SetWindowPos(m_hWnd, pWndInsertAfter-&gt;GetSafeHwnd(),
                  x, y, cx, cy, nFlags);
      else
            return m_pCtrlSite-&gt;SetWindowPos(pWndInsertAfter, x, y, cx, cy, nFlags);
}
</code></pre>
<p>Im Call Stack stehen nun folgende drei Funktionen an oberster Stelle:</p>
<blockquote>
<p>DynTabCtrl::SetRec() Line 92 C++</p>
</blockquote>
<blockquote>
<p>DynTabCtrl::InsertItem(CDialog * dlg=0x00df31d0,</p>
</blockquote>
<blockquote>
<p>ATL::CStringT&lt;wchar_t,StrTraitMFC&lt;wchar_t,ATL::ChTraitsCRT&lt;wchar_t&gt; &gt; &gt; titel=&quot;Allgemeines&quot;, unsigned int ID=133) Line 66 C++</p>
</blockquote>
<p>Ich hoffe, dass jemand helfen kann und kann natürlich auch den Quellcode von DynTabCtrl zeigen (eine tolle Klasse von phlox81)</p>
<p>Vielen Dank für eure Mühen</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/174994/probleme-mit-dyntabctrl</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 01:03:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/174994.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Mar 2007 07:57:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Tue, 06 Mar 2007 07:57:51 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich weiß nicht, ob hier irgendjemand mit der Klasse DynTabCtrl arbeitet, aber ich versuche mein Glück trotzdem mal. Ich habe folgendes Problem:</p>
<p>- Ich habe ein Dialog mit mehren Tabs (mit Hilfe von DynTabCtrl)<br />
- Bei einen Unterdialog habe ich ein Button und wenn dieser geklickt wird, geht ein neues Fenster mit mehreren Tabs auf (auch wieder mit DyntabCtrl)<br />
- Das klappt alles einwandfrei, weil die Bedingung mit Hilfe deiner Klasse sehr intuitiv ist<br />
- Wenn ich dieser Fenster nun schließe und erneut, durch Klicken auf den Button, öffnen will, schmiert mir das Programm immer ab<br />
- Und zwar hier:</p>
<pre><code>BOOL CWnd::SetWindowPos(const CWnd* pWndInsertAfter, int x, int y, int cx,
      int cy, UINT nFlags)
{
      ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));

      if (m_pCtrlSite == NULL)
            return ::SetWindowPos(m_hWnd, pWndInsertAfter-&gt;GetSafeHwnd(),
                  x, y, cx, cy, nFlags);
      else
            return m_pCtrlSite-&gt;SetWindowPos(pWndInsertAfter, x, y, cx, cy, nFlags);
}
</code></pre>
<p>Im Call Stack stehen nun folgende drei Funktionen an oberster Stelle:</p>
<blockquote>
<p>DynTabCtrl::SetRec() Line 92 C++</p>
</blockquote>
<blockquote>
<p>DynTabCtrl::InsertItem(CDialog * dlg=0x00df31d0,</p>
</blockquote>
<blockquote>
<p>ATL::CStringT&lt;wchar_t,StrTraitMFC&lt;wchar_t,ATL::ChTraitsCRT&lt;wchar_t&gt; &gt; &gt; titel=&quot;Allgemeines&quot;, unsigned int ID=133) Line 66 C++</p>
</blockquote>
<p>Ich hoffe, dass jemand helfen kann und kann natürlich auch den Quellcode von DynTabCtrl zeigen (eine tolle Klasse von phlox81)</p>
<p>Vielen Dank für eure Mühen</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1240016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1240016</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 06 Mar 2007 07:57:51 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Tue, 06 Mar 2007 11:23:14 GMT]]></title><description><![CDATA[<p>Und was passiert in</p>
<blockquote>
<p>DynTabCtrl::SetRec() Line 92 C++</p>
</blockquote>
<p>Das ist doch das Entscheidende...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1240159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1240159</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 06 Mar 2007 11:23:14 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Tue, 06 Mar 2007 13:16:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich zeig einfach mal die komplette Klasse:</p>
<pre><code class="language-cpp">#include&quot;stdafx.h&quot;
#include &quot;DynTabCtrl.h&quot;
#include &lt;algorithm&gt;

/*
Autor Jens Weller aka phlox81
(C) 05/2004
Für Anregungen und Verbesserungen
bitte Mail an www.phlox81.de,
oder http://www.phlox81.de

  DynTabCtrl.cpp

*/

DynTabCtrl::DynTabCtrl(bool deltab):delete_tab(deltab)
{
	m_aktuellepos =0;
}

 DynTabCtrl::~DynTabCtrl()
{
	if(!m_tabs.empty())
	{
		for(int i =0; i &lt; m_tabs.size(); i++)//vector freigeben
		{
			if(!m_tabs[i]-&gt;DestroyWindow())
				MessageBox(_T(&quot;Freigeben des Tabsheets fehlgeschlagen&quot;));
			delete m_tabs[i];
		}
		m_tabs.clear();//vector leeren
	}
}

BEGIN_MESSAGE_MAP(DynTabCtrl, CTabCtrl)
	//{{AFX_MSG_MAP(CMyTab)
		ON_WM_LBUTTONDOWN()
		ON_WM_RBUTTONDOWN()
		// HINWEIS - Der Klassen-Assistent fügt hier Zuordnungsmakros ein und entfernt diese.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/*
Korrekter Aufruf:
m_tab.InsertItem(new MyDlg(),&quot;titel&quot;, IDD_MYDLG);
Klasse verwaltet die Pointer, und Löscht sie bei DeleteItem/Destruktor
*/
int DynTabCtrl::InsertItem(CDialog * dlg, CString titel, UINT ID)
{
	if(!dlg-&gt;Create(ID,this))
	{
		MessageBox(_T(&quot;Create von &quot;) + titel + _T(&quot; Fehlgeschlagen&quot;));
		delete dlg;
		dlg =NULL;
		return FALSE;
	}
	if(m_tabs.empty())
	{
		dlg-&gt;ShowWindow(SW_SHOW);
	}
	else
		dlg-&gt;ShowWindow(SW_HIDE);
	m_tabs.push_back(dlg);
	m_titel.push_back(titel);
	SetRec();
	return CTabCtrl::InsertItem(m_tabs.size()-1,titel);

}

CDialog* DynTabCtrl::GetTab(int itab)
{
	if(m_tabs.size() &gt; itab &amp;&amp; itab &gt; -1)
		return m_tabs[itab];
	return NULL;
}

void DynTabCtrl::SetRec()
{
	CRect tabRec, itemRec;
	int nX, nY, nXz, nYz;
	GetClientRect(&amp;tabRec);
	GetItemRect(0, &amp;itemRec);
	nX=itemRec.left;
	nY=itemRec.bottom+1;
	nXz=tabRec.right-itemRec.left-1;
	nYz=tabRec.bottom-nY-1;
	if(!m_tabs.empty())
	{
		vector&lt;CDialog*&gt;::iterator itablist = m_tabs.begin();
		(*itablist)-&gt;SetWindowPos(&amp;wndTop, nX, nY, nXz, nYz, SWP_SHOWWINDOW);
		if(m_tabs.size() &gt; 1)
		{
			itablist++;
			for(; itablist != m_tabs.end(); itablist++)
			{
				(*itablist)-&gt;SetWindowPos(&amp;wndTop, nX, nY, nXz, nYz, SWP_HIDEWINDOW);
			}
		}
	}
}

void DynTabCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
{
	CTabCtrl::OnLButtonDown(nFlags, point);
    if(m_aktuellepos != GetCurFocus())
    {
            m_tabs[m_aktuellepos]-&gt;ShowWindow(SW_HIDE);
            m_aktuellepos=GetCurFocus();
            m_tabs[m_aktuellepos]-&gt;ShowWindow(SW_SHOW);
            m_tabs[m_aktuellepos]-&gt;SetFocus();
    }
}

BOOL DynTabCtrl::DeleteItem(int nItem)
{
	if(nItem &gt; -1 &amp;&amp; nItem &lt; m_tabs.size())
	{
		if(CTabCtrl::DeleteItem(nItem))
		{
			delete m_tabs[nItem];
			m_tabs.erase(std::find(m_tabs.begin(),m_tabs.end(),m_tabs[nItem]));
			m_titel.erase(std::find(m_titel.begin(),m_titel.end(),m_titel[nItem]));
			if(!m_tabs.empty())
			{
				SetCurFocus(0);
				m_aktuellepos = 0;
				m_tabs[0]-&gt;ShowWindow(SW_SHOW);
				m_tabs[0]-&gt;SetFocus();
				m_tabs[0]-&gt;Invalidate();
			return TRUE;
			}
		}
	}
	return FALSE;
}
void DynTabCtrl::OnRButtonDown(UINT nFlags, CPoint point) 
{
	if(delete_tab)
	{
		// Beliebiges Tab schliessen
		/*CRect rect;
		for(int i =0,n = GetItemCount();i &lt; n; i++)
		{
			GetItemRect(i,&amp;rect);
			if(rect.PtInRect(point))
			{
				SetCurFocus(i);
				break;
			}
		}*/
		CRect c;
		GetItemRect(GetCurFocus(),&amp;c);
		if(c.PtInRect(point))
		{
			CMenu m;
			ClientToScreen(&amp;point);
			m.CreatePopupMenu();
			m.InsertMenu(0,MF_BYPOSITION,55555,_T(&quot;löschen&quot;));
			m.TrackPopupMenu(TPM_LEFTALIGN + TPM_LEFTBUTTON,point.x, point.y, this, NULL);
		}
	}
		/*MessageBox(&quot;test&quot;);
	if(MessageBox(&quot;Tab &quot;+ m_titel[GetCurFocus()] +&quot; schliessen ?&quot;,&quot;Tab wird geschlossen&quot;,MB_YESNO)==IDYES)
		DeleteItem(GetCurFocus());*/
}

BOOL DynTabCtrl::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen

	if(wParam == 55555 &amp;&amp; delete_tab)
	{
		DeleteItem(GetCurFocus());
	}
	return CTabCtrl::OnCommand(wParam, lParam);
}

void DynTabCtrl::SetDeleteTab(bool deltab)
{
	delete_tab = deltab;
}

bool DynTabCtrl::GetDeleteTab()
{
	return delete_tab;
}
</code></pre>
<p>Vielen Dank für die Hilfe</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1240236</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1240236</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 06 Mar 2007 13:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Tue, 06 Mar 2007 13:31:18 GMT]]></title><description><![CDATA[<p>Soweit ich das richtig interpretiere setzt SecRec die Fensterposition.</p>
<p>Wie sieht denn der Code aus, in dem du das DynTabCtrl erstellst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1240251</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1240251</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Tue, 06 Mar 2007 13:31:18 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Tue, 06 Mar 2007 14:45:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/642">@phlox81</a>: erstmal Danke für deine Mail. Ich hätte dir natürlich auch noch per Mail gedankt.</p>
<p>zum Problem:</p>
<p>so ertslle ich die Tabs:</p>
<pre><code class="language-cpp">BOOL AddOrEditClub::OnInitDialog()
{
	CDialog::OnInitDialog();

	//ShowWindow(SW_MAXIMIZE);

	ctlAddOrEditTab.InsertItem(new ClubGeneral(), _T(&quot;Allgemeines&quot;), IDD_CLUBGENERAL);
	ctlAddOrEditTab.InsertItem(new ClubStadium(), _T(&quot;Stadion&quot;), IDD_CLUBSTADIUM);
	ctlAddOrEditTab.InsertItem(new ClubCoach(), _T(&quot;Trainer&quot;), IDD_CLUBCOACH);

	// TODO:  Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
</code></pre>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1240306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1240306</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 06 Mar 2007 14:45:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DynTabCtrl on Wed, 07 Mar 2007 19:43:01 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Bei diesem Problem bin ich leider noch nicht weitergekommen und würde mich sehr über Hilfe freuen.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1241243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1241243</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 07 Mar 2007 19:43:01 GMT</pubDate></item></channel></rss>