<?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[Feststellen ob der View aktiv ist oder nicht]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich habe zwei CViews. Zwischen diesen wechsle ich per CTabCtrl. Doch nun möchte ich wissen ob View1 aktiv oder nicht aktiv ist und sobald er inaktiv ist soll er den Text in dem View als datei speichern. Dieser soll dann beim umschalten auf den zweiten View geladen werden.</p>
<p>Wie heißt der Befehl, um fest zu stellen ob ein View noch active ist?</p>
<p>Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/51228/feststellen-ob-der-view-aktiv-ist-oder-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sun, 31 May 2026 14:20:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/51228.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Oct 2003 10:18:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 10:18:49 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich habe zwei CViews. Zwischen diesen wechsle ich per CTabCtrl. Doch nun möchte ich wissen ob View1 aktiv oder nicht aktiv ist und sobald er inaktiv ist soll er den Text in dem View als datei speichern. Dieser soll dann beim umschalten auf den zweiten View geladen werden.</p>
<p>Wie heißt der Befehl, um fest zu stellen ob ein View noch active ist?</p>
<p>Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368190</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368190</guid><dc:creator><![CDATA[ThorstenTPP]]></dc:creator><pubDate>Wed, 08 Oct 2003 10:18:49 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 16:05:29 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>die Klasse CFrameWnd stellt hierfür die Methode GetActiveView zur Verfügung.</p>
<p>MfG.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368493</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368493</guid><dc:creator><![CDATA[Wonko]]></dc:creator><pubDate>Wed, 08 Oct 2003 16:05:29 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 17:18:17 GMT]]></title><description><![CDATA[<p>aber wie stell ich das an das der Text in CView1 gespeichert wird? Das geht doch dann über CMainframe oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368560</guid><dc:creator><![CDATA[ThorstenTPP]]></dc:creator><pubDate>Wed, 08 Oct 2003 17:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 18:23:18 GMT]]></title><description><![CDATA[<p>Sind die beiden Views vom gleichen Typ ?<br />
Sind sie an dasselbe Dokument gebunden ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368600</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368600</guid><dc:creator><![CDATA[Wonko]]></dc:creator><pubDate>Wed, 08 Oct 2003 18:23:18 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 18:35:53 GMT]]></title><description><![CDATA[<p>ja sind an das selbe CDocument gebunden...wieso fragst du?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368606</guid><dc:creator><![CDATA[ThorstenTPP]]></dc:creator><pubDate>Wed, 08 Oct 2003 18:35:53 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Wed, 08 Oct 2003 20:57:59 GMT]]></title><description><![CDATA[<p>normalerweise werden bei der MDI/SDI Architektur die Daten im Dokument vorgehalten.</p>
<p>Der View dient damit zur Eingabe/Darstellung der Daten und reicht diese an<br />
das Dokument weiter/holt sie sich aus dem Dokument.</p>
<p>Die Views werden ja vermutlich beim Umschalten sichtbar/unsichtbar gemacht...<br />
nun musst Du eigentlich nur noch feststellen, ob der View gerade sichtbar oder<br />
unsichtbar wird(OnShowWindow) und ob es sich um View1 oder View2 handelt.</p>
<p>Letzteres kannst Du rausfinden, indem Du über das Document die Views enumerierst<br />
(GetFirstViewPosition/GetNextView) und (innerhalb der Viewklasse) mit 'this'<br />
vergleichst.</p>
<p>MfG.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/368704</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/368704</guid><dc:creator><![CDATA[Wonko]]></dc:creator><pubDate>Wed, 08 Oct 2003 20:57:59 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Thu, 09 Oct 2003 20:13:57 GMT]]></title><description><![CDATA[<p>...<br />
wow</p>
<p>...<br />
das ist echt heftig...*am kopf kratz*<br />
wie soll das dann aussehen?! und was ist enumerieren?! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/369431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/369431</guid><dc:creator><![CDATA[ThorstenTPP]]></dc:creator><pubDate>Thu, 09 Oct 2003 20:13:57 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Thu, 09 Oct 2003 21:23:16 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>um rauszufinden, ob es sich um View1 oder View2 handelt, fügst Du Deiner View-Klasse<br />
eine Funktion wie die folgende hinzu</p>
<pre><code>int CMyView::GetViewIndex()
{
	CMyDocument *p_doc=GetDocument();
	POSITION pos=p_doc-&gt;GetFirstViewPosition();
	int idx=-1;
	CView *p_view=0;
	while(pos!=0)
	{
		idx++;
		p_view=p_doc-&gt;GetNextView(pos);
		if(p_view==this)
			break;
	}	
	return idx;
}
</code></pre>
<p>Dem Dokument würdest Du zum Speichern des Textes eine Membervariable vom<br />
Typ CString hinzufügen (public).</p>
<p>Zum Speichern bzw. Laden des Textes vom View zum Dokument und umgekehrt<br />
könntest Du dem View eine weitere Funktion hinzufügen:</p>
<pre><code>void CMyView::UpdateData(bool store)
{
	CMyDocument *p_doc=GetDocument();

	if(store)
	{
		// Daten aus dem View in die CString Variable im Dokument
	}
	else
	{
		// Daten aus der CString Variable im Dokument in den View holen
	}

}
</code></pre>
<p>Nun musst Du in der OnShowWindow-Methode Deines Views nur noch entsprechend<br />
auf sichtbar/unsichtbar werden reagieren:</p>
<pre><code>void CMyView::OnShowWindow(BOOL bShow, UINT nStatus )
{
	int idx=GetViewIndex();
	if(idx==0 &amp;&amp; !bShow)
		UpdateData(true);
	else
		if(idx==1 &amp;&amp; bShow)
			UpdateData(false);
}
</code></pre>
<p>Hoffe, es ist jetzt etwas klarer.</p>
<p>MfG.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/369479</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/369479</guid><dc:creator><![CDATA[Wonko]]></dc:creator><pubDate>Thu, 09 Oct 2003 21:23:16 GMT</pubDate></item><item><title><![CDATA[Reply to Feststellen ob der View aktiv ist oder nicht on Fri, 10 Oct 2003 16:13:24 GMT]]></title><description><![CDATA[<p>oh vielen vielen dank!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/370007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/370007</guid><dc:creator><![CDATA[ThorstenTPP]]></dc:creator><pubDate>Fri, 10 Oct 2003 16:13:24 GMT</pubDate></item></channel></rss>