<?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[Rechtecke und Kreise im View verschieben und es will einfach nicht =(]]></title><description><![CDATA[<p>Nabend allerseits,</p>
<p>so richtig will er mir keine Elemente verschieben und ich weiß nicht wo ich suchen soll, denn er bringt ja keine fehler oder warnungen. Hat einer ne Idee wo ich das suchen kann bzw sollte? Bin über jeden Tip dankbar.</p>
<p>greetz<br />
Tobi</p>
<pre><code>void CMy07AufgabeView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	CMy07AufgabeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CMyDrawObject *pDrawObject;
	// set default TRUE
	BOOL create_new=TRUE;

	if((m_nDefType!=DRW_RECT)&amp;&amp;(m_nDefType!=DRW_CIRCLE)){
		m_nDefType=DRW_RECT;	
	}

	// check if hit an object
	if( ! pDoc-&gt;DrawObjectList.IsEmpty( ))
	{
		// list contains draw objects
		POSITION pos = pDoc-&gt;DrawObjectList.GetTailPosition();

		while( pos != NULL )
		{
			// search for a hit
			pDrawObject=pDoc-&gt;DrawObjectList.GetAt(pos);

			if( pDrawObject-&gt;IsHit(point) )
			{
				// hit an object
				SetCapture();
				// set new cursor
				SetCursor( LoadCursor(NULL,IDC_SIZEALL) );
				// place on top
				pDoc-&gt;DrawObjectList.RemoveAt(pos);
				create_new = FALSE;
				break;
				// .. and insert again
			}
			else
				// seek next; top down
				pDoc-&gt;DrawObjectList.GetPrev(pos);
		}//while( pos != NULL )
	}//if( ! pDoc-&gt;DrawObjectList.IsEmpty( ))

	if( create_new )
	{
		switch( m_nDefType )
		{
		case DRW_RECT: pDrawObject= new CMyRectObject();
			break;
		case DRW_CIRCLE: pDrawObject= new CMyCircleObject();
			break;
		}
		pDrawObject-&gt;Pos= CRect(point, point);
		pDrawObject-&gt;Pos.InflateRect(20,20);
	}
	// add to list tail
	pDoc-&gt;DrawObjectList.AddTail( pDrawObject );
	Invalidate();
	CView::OnLButtonDown(nFlags, point);
}
</code></pre>
<pre><code>void CMy07AufgabeView::OnMouseMove(UINT nFlags, CPoint point) 
{
	if( GetCapture() == this )
	{
		// move an object
		CMy07AufgabeDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);
		POSITION pos = pDoc-&gt;DrawObjectList.GetTailPosition();
		if( pos != NULL )
		{
			// get topmost object
			CMyDrawObject *pDrawObject =
				pDoc-&gt;DrawObjectList.GetAt(pos);
			// remember previous position
			CRect OldPos( pDrawObject-&gt;GetPos() );
			// move it
			pDrawObject-&gt;SetPos( point );
			// redraw only changed area
			CRect RedrawRect;
			RedrawRect.UnionRect( OldPos,
				pDrawObject-&gt;GetPos() );
			// redraw changed area of the view
			RedrawWindow( RedrawRect );
		} // if( pos != NULL )
	} // if( GetCapture() == this )
	CView::OnMouseMove(nFlags, point);
}
</code></pre>
<pre><code>void CMy07AufgabeView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	if( GetCapture() == this )
	{
		ReleaseCapture();
	}
	CView::OnLButtonUp(nFlags, point);	
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/147541/rechtecke-und-kreise-im-view-verschieben-und-es-will-einfach-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 14:47:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147541.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 May 2006 20:10:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 20:10:28 GMT]]></title><description><![CDATA[<p>Nabend allerseits,</p>
<p>so richtig will er mir keine Elemente verschieben und ich weiß nicht wo ich suchen soll, denn er bringt ja keine fehler oder warnungen. Hat einer ne Idee wo ich das suchen kann bzw sollte? Bin über jeden Tip dankbar.</p>
<p>greetz<br />
Tobi</p>
<pre><code>void CMy07AufgabeView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	CMy07AufgabeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CMyDrawObject *pDrawObject;
	// set default TRUE
	BOOL create_new=TRUE;

	if((m_nDefType!=DRW_RECT)&amp;&amp;(m_nDefType!=DRW_CIRCLE)){
		m_nDefType=DRW_RECT;	
	}

	// check if hit an object
	if( ! pDoc-&gt;DrawObjectList.IsEmpty( ))
	{
		// list contains draw objects
		POSITION pos = pDoc-&gt;DrawObjectList.GetTailPosition();

		while( pos != NULL )
		{
			// search for a hit
			pDrawObject=pDoc-&gt;DrawObjectList.GetAt(pos);

			if( pDrawObject-&gt;IsHit(point) )
			{
				// hit an object
				SetCapture();
				// set new cursor
				SetCursor( LoadCursor(NULL,IDC_SIZEALL) );
				// place on top
				pDoc-&gt;DrawObjectList.RemoveAt(pos);
				create_new = FALSE;
				break;
				// .. and insert again
			}
			else
				// seek next; top down
				pDoc-&gt;DrawObjectList.GetPrev(pos);
		}//while( pos != NULL )
	}//if( ! pDoc-&gt;DrawObjectList.IsEmpty( ))

	if( create_new )
	{
		switch( m_nDefType )
		{
		case DRW_RECT: pDrawObject= new CMyRectObject();
			break;
		case DRW_CIRCLE: pDrawObject= new CMyCircleObject();
			break;
		}
		pDrawObject-&gt;Pos= CRect(point, point);
		pDrawObject-&gt;Pos.InflateRect(20,20);
	}
	// add to list tail
	pDoc-&gt;DrawObjectList.AddTail( pDrawObject );
	Invalidate();
	CView::OnLButtonDown(nFlags, point);
}
</code></pre>
<pre><code>void CMy07AufgabeView::OnMouseMove(UINT nFlags, CPoint point) 
{
	if( GetCapture() == this )
	{
		// move an object
		CMy07AufgabeDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);
		POSITION pos = pDoc-&gt;DrawObjectList.GetTailPosition();
		if( pos != NULL )
		{
			// get topmost object
			CMyDrawObject *pDrawObject =
				pDoc-&gt;DrawObjectList.GetAt(pos);
			// remember previous position
			CRect OldPos( pDrawObject-&gt;GetPos() );
			// move it
			pDrawObject-&gt;SetPos( point );
			// redraw only changed area
			CRect RedrawRect;
			RedrawRect.UnionRect( OldPos,
				pDrawObject-&gt;GetPos() );
			// redraw changed area of the view
			RedrawWindow( RedrawRect );
		} // if( pos != NULL )
	} // if( GetCapture() == this )
	CView::OnMouseMove(nFlags, point);
}
</code></pre>
<pre><code>void CMy07AufgabeView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	if( GetCapture() == this )
	{
		ReleaseCapture();
	}
	CView::OnLButtonUp(nFlags, point);	
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1059837</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059837</guid><dc:creator><![CDATA[McSnoop]]></dc:creator><pubDate>Wed, 17 May 2006 20:10:28 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 20:38:14 GMT]]></title><description><![CDATA[<p>ich hab zwar kein tipp, aber ich bin grade am selben problem am arbeiten, bzw. noch dabei es zu erstellen.<br />
Wofür ist das Programm, wenn man fragen darf?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059856</guid><dc:creator><![CDATA[Morides]]></dc:creator><pubDate>Wed, 17 May 2006 20:38:14 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 20:46:11 GMT]]></title><description><![CDATA[<p>Das Programm ist nur zum Test, die eigentliche Aufgabe bestand nur darin elemente darzustellen.</p>
<p>Aber ich habe noch vor:</p>
<p>- elemente verschiebbar zu machen<br />
- Font einzubingen (skalier- und verschiebbar)<br />
- das gleiche für kleine bilder/ornamente</p>
<p>rauskommen soll ein kleiner editor zu präsentationszwecken.</p>
<p>Alle diese Elemente/Bilder werden dann über einem Bild angeordnet und gelockt.<br />
Danach wird das Bild gesaved. Neben dem Bild ist dann noch ein 2ter View in dem<br />
man lustig Text hacken kann und wenn man das ganze drucken will is das verwurschtelte bild links und der text rechts auf dem Ausdruck. <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>So die Planung.</p>
<p>gruß<br />
Tobi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059859</guid><dc:creator><![CDATA[McSnoop]]></dc:creator><pubDate>Wed, 17 May 2006 20:46:11 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 20:53:31 GMT]]></title><description><![CDATA[<p>du speicherst nicht zufällig die koordinaten von den elementen in eine datei, oder speicherst du einfach das fertige bild?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059864</guid><dc:creator><![CDATA[Morides]]></dc:creator><pubDate>Wed, 17 May 2006 20:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 20:59:04 GMT]]></title><description><![CDATA[<p>in der Aufgabe selbst werden die elemente in einerm file hinterlegt so das dies auch wieder rekontruierbar ist, aber für dieses Präsiproject ist das nicht nötig bzw nicht vorgesehen. da soll nur ein bild hinten rauskommen und evtl noch gedruckt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059866</guid><dc:creator><![CDATA[McSnoop]]></dc:creator><pubDate>Wed, 17 May 2006 20:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Wed, 17 May 2006 21:07:52 GMT]]></title><description><![CDATA[<p>sowas änlches wie bei wir (mein Thread: <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-146144.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-146144.html</a>), nur das du wesentlich weiter bist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059869</guid><dc:creator><![CDATA[Morides]]></dc:creator><pubDate>Wed, 17 May 2006 21:07:52 GMT</pubDate></item><item><title><![CDATA[Reply to Rechtecke und Kreise im View verschieben und es will einfach nicht =( on Tue, 23 May 2006 12:38:24 GMT]]></title><description><![CDATA[<pre><code>public:

	//Default Constructor und Destructor
	virtual ~CMyDrawObject();
	CMyDrawObject(){};

	CRect Pos;
	int Type;

	virtual void Serialize(CArchive&amp; ar)
		{ if (ar.IsStoring())
			ar &lt;&lt; Pos;
			else
			ar &gt;&gt; Pos;
		};
	virtual BOOL IsHit(CPoint &amp;point){ return FALSE;};
	virtual void Draw(CDC* pDC){};

	// CRect&amp; damit der Rückgabewert halt CRect spezifisch ist ansonsten will return ein int =)
	inline CRect&amp; GetPos(){return Pos;};

	inline void SetPos(CPoint nPos){
		CRect rect(nPos, nPos);
		rect.InflateRect(20,20);
		Pos=rect;     &lt;------------------ Übeltäter
	};
</code></pre>
<p>Habe den Fehler gefunden. Nach einer gehörigen Debugsession hat sich rausgestellt das die Neue Position einfach nicht an Pos übergeben worden ist.</p>
<p>*argh*</p>
<p>Wollte das nur gesagt haben =).</p>
<p>Thread kann geclosed werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063483</guid><dc:creator><![CDATA[McSnoop]]></dc:creator><pubDate>Tue, 23 May 2006 12:38:24 GMT</pubDate></item></channel></rss>