<?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[Problem beim einsortieren von items in ein ListView...]]></title><description><![CDATA[<p>hi ich habe mir hier mal ein listview erstellt:</p>
<pre><code class="language-cpp">HWND DoCreateListView( HWND hParent, HWND hLview ) {

    RECT rParent;
    LVCOLUMN lvc;
    LVITEM lvi;

        GetClientRect( hParent, &amp;rParent );

    InitCommonControls();

    hLview = CreateWindowEx( WS_EX_WINDOWEDGE, WC_LISTVIEW, &quot;&quot;,
                            WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_EDITLABELS,
                            0, 0, rParent.right, rParent.bottom, hParent,
                            (HMENU)ID_LVIEW, 0, 0 );

    // set the mask of LV
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

    lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
    lvi.state = 0;
    lvi.stateMask = 0;

    //add columns
    for( int i = 0; i &lt; 5; i++ ) {

        lvc.iSubItem = i;
        lvc.pszText = &quot;TestColumn&quot;;
        lvc.cx = 120;
        lvc.fmt = LVCFMT_CENTER;
        ListView_InsertColumn( hLview, i, &amp;lvc );

        for( int i = 0; i &lt; 20; i++ ) {

            lvi.iItem = i;
            lvi.iImage = i;
            lvi.iSubItem = 0;
            lvi.pszText = &quot;test&quot;;
            ListView_InsertItem( hLview, &amp;lvi );
        }
    }

    return( hLview );
}
</code></pre>
<p>und frage mich gerade wie ich je 20 mal test in jede spalte reinschreiben lasse.... was fehlt in meinen coe noch? hat es was mit der LVN_NOTIFY zu tun?, wenn ja diese hab ich noch nicht in angriff genommen.</p>
<p>Gruß Tobi!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173927/problem-beim-einsortieren-von-items-in-ein-listview</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 21:37:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173927.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Feb 2007 11:05:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 11:05:08 GMT]]></title><description><![CDATA[<p>hi ich habe mir hier mal ein listview erstellt:</p>
<pre><code class="language-cpp">HWND DoCreateListView( HWND hParent, HWND hLview ) {

    RECT rParent;
    LVCOLUMN lvc;
    LVITEM lvi;

        GetClientRect( hParent, &amp;rParent );

    InitCommonControls();

    hLview = CreateWindowEx( WS_EX_WINDOWEDGE, WC_LISTVIEW, &quot;&quot;,
                            WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_EDITLABELS,
                            0, 0, rParent.right, rParent.bottom, hParent,
                            (HMENU)ID_LVIEW, 0, 0 );

    // set the mask of LV
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

    lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
    lvi.state = 0;
    lvi.stateMask = 0;

    //add columns
    for( int i = 0; i &lt; 5; i++ ) {

        lvc.iSubItem = i;
        lvc.pszText = &quot;TestColumn&quot;;
        lvc.cx = 120;
        lvc.fmt = LVCFMT_CENTER;
        ListView_InsertColumn( hLview, i, &amp;lvc );

        for( int i = 0; i &lt; 20; i++ ) {

            lvi.iItem = i;
            lvi.iImage = i;
            lvi.iSubItem = 0;
            lvi.pszText = &quot;test&quot;;
            ListView_InsertItem( hLview, &amp;lvi );
        }
    }

    return( hLview );
}
</code></pre>
<p>und frage mich gerade wie ich je 20 mal test in jede spalte reinschreiben lasse.... was fehlt in meinen coe noch? hat es was mit der LVN_NOTIFY zu tun?, wenn ja diese hab ich noch nicht in angriff genommen.</p>
<p>Gruß Tobi!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232486</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232486</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 11:05:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 13:34:26 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<p>und frage mich gerade wie ich je 20 mal test in jede spalte reinschreiben lasse.... was fehlt in meinen coe noch? hat es was mit der LVN_NOTIFY zu tun?, wenn ja diese hab ich noch nicht in angriff genommen.</p>
</blockquote>
<pre><code class="language-cpp">//add columns
    for( int i = 0; i &lt; 5; i++ ) {

        lvc.iSubItem = i;
        lvc.pszText = &quot;TestColumn&quot;;
        lvc.cx = 120;
        lvc.fmt = LVCFMT_CENTER;
        ListView_InsertColumn( hLview, i, &amp;lvc );
    }
    for( int i = 0; i &lt; 20; i++ ) {
        lvi.mask = LVIF_TEXT;
        lvi.iItem = i;
        lvi.iSubItem = 0;
        lvi.pszText = &quot;test&quot;;
        ListView_InsertItem( hLview, &amp;lvi );
        for (int j=1; j&lt;5; ++j) {
             lvi.iSubItem = 1;
             ListView_SetItem( hLview, &amp;lvi);
        }
    }

    return( hLview );
}
</code></pre>
<p>mask wurdevergessen zu setzen. Du kannst image nicht setzten wenn Du keine Imagelist definiert hast!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232599</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 21 Feb 2007 13:34:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 14:39:43 GMT]]></title><description><![CDATA[<p>also irgendwie klappt das so nicht es wird immer noch alles in die erste spalte geschrieben...</p>
<p>PS.: ist lvi.iSubItem ist der wert der hier zugewiesen wird immer 1 oder 0? also ist das hier nen flag??</p>
<p>Gruß Tobi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232647</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 14:39:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 14:48:33 GMT]]></title><description><![CDATA[<p>Nein Subitem 0 ist die erste Spalte. Subitem 1 die zweite etc.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232654</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 21 Feb 2007 14:48:33 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 14:52:22 GMT]]></title><description><![CDATA[<p>hmm aber trotzdem shcreibt er nichts in die spalten... was muss ich noch aendern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232659</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 14:52:22 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 14:56:38 GMT]]></title><description><![CDATA[<p>ok.. schon gut geht doch alles <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="🙂"
    /><br />
nur noch die frage wie mach ich das das ich die HeadControls oben fest machen kann also das man die spalten nicht von der breite her aendern kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232666</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 14:56:38 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 15:24:56 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/msdnmag/issues/03/06/CQA/" rel="nofollow">http://msdn.microsoft.com/msdnmag/issues/03/06/CQA/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232684</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 21 Feb 2007 15:24:56 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 15:40:20 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/23365">@link</a> ich find da irgendwie nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>und noch ne frage... wie kommt es das ich nur fuer die erste spalte ListView_Insert benutzen kann und fuer weitere funktioniert nur ListView_SetItem, wieso ?</p>
<p>Gruß Tobi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232694</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 15:40:20 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 15:45:43 GMT]]></title><description><![CDATA[<p>hast du SubItem auch verändert?</p>
<p>Mfg Ominion</p>
<p>EDIT: sry, war blöd^^</p>
<p>Du musst erstmal ein Item erstellen, und dann kannst du erst die Items verändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232697</guid><dc:creator><![CDATA[Ominion]]></dc:creator><pubDate>Wed, 21 Feb 2007 15:45:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 16:01:42 GMT]]></title><description><![CDATA[<p>hm ok und wie muesste ich den quelltext dann veraendern, das mir das prog einträge zeilen weise macht?</p>
<p>also zB. hab ich hier eine struct Test: mit char name[128]; int alter; };</p>
<p>so nun leg ich mir 50 objecte an und belege sie mit zufalls werten<br />
Test test[ 50 ];<br />
test[ 0 ].name = &quot;Knut&quot;; test[ 0 ].alter = 12;<br />
test[ 1 ].name = &quot;Ingo&quot;; test[ 1 ].alter = 18;<br />
test[ 2 ].name = &quot;Irre&quot;; test[ 2 ].alter = 13;<br />
...</p>
<p>jetz habe ich hier mein LV</p>
<p>#NUM. | Name | Alter<br />
-----------------&gt;&gt;&gt; erster eintrag vertig, gehe naechste zeile.<br />
|<br />
V</p>
<p>for( int zeile = 0; zeile &lt; 50; zeile++ ) {</p>
<p>lvi.iItem = zeile;<br />
lvi.SubItem = 0;<br />
lvi.pszText = // sprintf( szBuffer, &quot;%i&quot;, zeile )<br />
ListView_InsertItem( hLview, &amp;lvi );</p>
<p>lvi.SubItem = 1;<br />
lvi.pszText = test[ i ].name;<br />
ListView_SetItem( hLview, &amp;lvi );</p>
<p>lvi.SubItem = 2;<br />
lvi.pszText = sprintf( szBuffer, &quot;%i&quot;, test[ i ].alter )<br />
ListView_SetItem( hLview, &amp;lvi );</p>
<p>}</p>
<p>is das so irgendwie richtig???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232709</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 21 Feb 2007 16:01:42 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Wed, 21 Feb 2007 19:05:22 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/23365">@link</a> ich find da irgendwie nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>und noch ne frage... wie kommt es das ich nur fuer die erste spalte ListView_Insert benutzen kann und fuer weitere funktioniert nur ListView_SetItem, wieso ?</p>
<p>Gruß Tobi</p>
</blockquote>
<p>Die Technik ist dort drin beschrieben:<br />
Locking Column Headers!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232825</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 21 Feb 2007 19:05:22 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Thu, 22 Feb 2007 07:22:09 GMT]]></title><description><![CDATA[<p>und @mein Beispiel.. ist der so gebrauchbar oder schlecht geschrieben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232945</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Thu, 22 Feb 2007 07:22:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Thu, 22 Feb 2007 08:19:08 GMT]]></title><description><![CDATA[<p>Dein Beispiel ist Quark. sprintf returniert doch kleinen Speicher sondern eine Anzahl von Zeichen!</p>
<p>Ansonsten stimmt es.</p>
<p>Still es Dir so vor: InterItem erzeugt eine neue Zeile mit leeren Subitems.<br />
Mit Setitem setzt Du die Daten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1232981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1232981</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 22 Feb 2007 08:19:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim einsortieren von items in ein ListView... on Thu, 22 Feb 2007 17:28:36 GMT]]></title><description><![CDATA[<p>mit sprintf() will ich doch nur den int in nen char konvertieren.<br />
und wie mach ich das wenn ich nen item ankilcke das er mir die ganze zeile makiert?</p>
<p>Gruß Tobi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1233522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1233522</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Thu, 22 Feb 2007 17:28:36 GMT</pubDate></item></channel></rss>