CListView losing items

Hi,

I have a problem with a CListView in report mode.

I can add items but when I add the 10:th (or any > #10) item it's subtexts
aren't shown, but is rather shown in the last element in the view (sorted by
column #1 (ints showing the row number)) so far always the ninth element.

result:
1    text
10
11
2    text
3    text
4    text
5    text
6    text
7    text
8    text
9    text corsponding to # 11

I can't figure this one out. Can someone please help me?


0
naga1 (5)
11/17/2003 5:28:43 PM
vc.mfc 33608 articles. 0 followers. Follow

8 Replies
839 Views

Similar Articles

[PageSpeed] 59

For something like this you should post some code..
But here is how to fix half of your problem.

get the return value of InsertItem and use that to set the subitems with.
Since things are being sorted they don't endup were you think they might.
Specially when you are sorting numbers in string format.  They don't sort
like numbers do.  Example:

int Index = MyList.InsertItem(10,ItemText);
MyList.SetItemText(Index,1,SubItemText);

Ali R.


"Torgny Nyblom" <naga@linux.nu> wrote in message
news:fz7ub.34025$mU6.113082@newsb.telia.net...
> Hi,
>
> I have a problem with a CListView in report mode.
>
> I can add items but when I add the 10:th (or any > #10) item it's subtexts
> aren't shown, but is rather shown in the last element in the view (sorted
by
> column #1 (ints showing the row number)) so far always the ninth element.
>
> result:
> 1    text
> 10
> 11
> 2    text
> 3    text
> 4    text
> 5    text
> 6    text
> 7    text
> 8    text
> 9    text corsponding to # 11
>
> I can't figure this one out. Can someone please help me?
>
>


0
nospam8371 (80)
11/17/2003 7:07:17 PM
"Ali R." <nospam@company.com> wrote in message
news:F%8ub.995$dg5.3@newssvr23.news.prodigy.com...
> But here is how to fix half of your problem.

Thanks! You hit the spott.

> Specially when you are sorting numbers in string format.  They don't sort
> like numbers do.  Example:

A followup question, how to sort like one wants (1, 2, ..., 9, 10, ...)?

// Torgny



0
naga1 (5)
11/17/2003 9:27:42 PM
Look at CListView::SortItems. You can pass it a compare function.  In your
compare function compare the numbers not the strings. This is the easiest
way. They include in example at the bottom of the help page.

If you have trouble with that there are some custom listview on codeguru.
look under sorting toward the bottom of the page

http://www.codeguru.com/listview/index.shtml

Ali R.

"Torgny Nyblom" <naga@linux.nu> wrote in message
news:i3bub.34057$mU6.113442@newsb.telia.net...
> "Ali R." <nospam@company.com> wrote in message
> news:F%8ub.995$dg5.3@newssvr23.news.prodigy.com...
> > But here is how to fix half of your problem.
>
> Thanks! You hit the spott.
>
> > Specially when you are sorting numbers in string format.  They don't
sort
> > like numbers do.  Example:
>
> A followup question, how to sort like one wants (1, 2, ..., 9, 10, ...)?
>
> // Torgny
>
>
>


0
nospam8371 (80)
11/17/2003 9:52:49 PM
"Ali R." <nospam@company.com> wrote in message
news:Rqbub.1023$Gb6.103@newssvr23.news.prodigy.com...

Thanks!


0
naga1 (5)
11/17/2003 10:01:00 PM
A followup Q.

When trying to sort my CListCtrl I call:

int CALLBACK CStringListView::CompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort)

with

m_ctlList->SortItems(CompareFunc, (LPARAM) m_ctlList);

but this generates:

d:\src\Projects\KarateLog\strlstvw.cpp(132): error C2664:
'CListCtrl::SortItems' : cannot convert parameter 1 from 'int
(LPARAM,LPARAM,LPARAM)' to 'PFNLVCOMPARE'

I don't understand this. I took the call and the definition from VC++
documentation directly.

// Torgny


0
naga1 (5)
11/18/2003 8:38:58 AM
The function must also be static

-- 
Bjarne Nielsen

"Torgny Nyblom" <naga@linux.nu> skrev i en meddelelse
news:CUkub.38245$dP1.139374@newsc.telia.net...
> A followup Q.
>
> When trying to sort my CListCtrl I call:
>
> int CALLBACK CStringListView::CompareFunc(LPARAM lParam1, LPARAM lParam2,
> LPARAM lParamSort)
>
> with
>
> m_ctlList->SortItems(CompareFunc, (LPARAM) m_ctlList);
>
> but this generates:
>
> d:\src\Projects\KarateLog\strlstvw.cpp(132): error C2664:
> 'CListCtrl::SortItems' : cannot convert parameter 1 from 'int
> (LPARAM,LPARAM,LPARAM)' to 'PFNLVCOMPARE'
>
> I don't understand this. I took the call and the definition from VC++
> documentation directly.
>
> // Torgny
>
>


0
11/18/2003 9:30:56 AM
"Bjarne Nielsen" <bnielsenIH8spam@post11.tele.dk> wrote in message
news:e1SIrabrDHA.2820@TK2MSFTNGP10.phx.gbl...
> The function must also be static

Hmm setting the function to static results in:

d:\src\Projects\KarateLog\strlstvw.cpp(174): error C2724:
'CStringListView::CompareFunc' : 'static' should not be used on member
functions defined at file scope

I have a nasty feeling that I've missed something obvious...

// Torgny


0
naga1 (5)
11/18/2003 9:47:48 AM
The easiest way is to not have it as a member function, then.

-- 
Bjarne Nielsen

"Torgny Nyblom" <naga@linux.nu> skrev i en meddelelse
news:8Vlub.38249$dP1.139361@newsc.telia.net...
> "Bjarne Nielsen" <bnielsenIH8spam@post11.tele.dk> wrote in message
> news:e1SIrabrDHA.2820@TK2MSFTNGP10.phx.gbl...
> > The function must also be static
>
> Hmm setting the function to static results in:
>
> d:\src\Projects\KarateLog\strlstvw.cpp(174): error C2724:
> 'CStringListView::CompareFunc' : 'static' should not be used on member
> functions defined at file scope
>
> I have a nasty feeling that I've missed something obvious...
>
> // Torgny
>
>


0
11/18/2003 10:47:37 AM
Reply:

Similar Artilces:

search doesn't inculed inactive items
When you deactive items you can't use the serch function. It has everything else. why not this ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=32349a21-d165-4a3b-8fb0-9...

Great Plains 10.00 Blank Comment ID for Receivings Line Items
If the Comment ID field for POP Receipt table is for future release, Stepahnie of Odyssey Software suggested that the field be removed from the column list to avoid adding it and confuse the users. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft....

Combo Box Losing Settings
I have a combo box on a chart, the input range for which is controlled by a VBA macro using ListFillRange and a named range. Whilst the book is open all is fine, but whenever I save and close it the combo box loses its settings and when the book is re-opened it returns a blank box with no input range. Currently using XP and I'm sure I didn't encounter the same issue in 2000. Ian ...

CRM 4: Activities lose time when the sync with outlook
Hi, I have been having a strange problem where all the phonecall activities in our system have a time of 00:00. After a lot of investigation I have found that when the phonecall syncs with outlook, the time on the phonecall gets changed to 00:00. I have also found this happens with Fax and Letter, but not Task or Appointment. Has anyone else had this issue? Thanks ...

How 2 sort an autosum total list after adding items 2 autosum item
Am using detail dollar amount list to insert new transactions in the middle of a the detail list, and they in turn get included in the 'autosum' total calc which is located in another item total summary list in the same workbook. If we try to sort the autosum total summary list, the autosum totals seem to loose their connection with the detail autosum calc list. Is there anyway to keep this connection, ie be able to add items into the detail autosum calc lists, and then sort the autosum summary totals ? -- Thanks again for your help. akm (XPpro,SP-2,IE-7,Office2003...

Differnce between CListBox and CListCtrl and CListView
Hi Can someone tell me the difference between CListBox, CListCtrl and CListView classes. When to do for which class? Which class will be suitable for creating multicolumn list? Thanks in advance, Vijay > Can someone tell me the difference between CListBox, CListCtrl and > CListView classes. When to do for which class? > Which class will be suitable for creating multicolumn list? CListCtrl is used on a Dialog or Property Page. It is something you drag and drop and size it up the way you want automatically. CListView is used within a view. You have to tell it where to position ...

To retrive a item from a list view control
hi all.. i have put a list viewcontrol in my dialog box.. it has two coloumns.. now i need to select the index of the item that has been clicked i tried with ON_NOTIFY(LVN_ITEMCHANGED,ID,OnSelectList)-> Message the control is going to the function OnSelectList there i tried with GetItem(),Item and isubitem from NMLISTVIEW structure.. but i am not geting the exact index.. Any help Plz.. Thanks in Advance.. Vj Steps:- 1) Add a dialog 2) add a list control on it and have a subclass CMyListCtrl 3) In OnInitDialog(...) of dialog add this code which will add 4 columns and 4 r...

Outlook Macro menu items not working
In Outlook 2003, I can no longer get into any of the menu items off Tools, Macro. I can click them but they don't do anything. This was working fine up to now. I have reinstalled Outlook but no joy. -- John Blessing "John Blessing" <jb@**REMOVE**THIS**LbeHelpdesk.com> wrote in message news:%dp1c.2671$1h7.19030@newsfep4-glfd.server.ntli.net... > In Outlook 2003, I can no longer get into any of the menu items off Tools, > Macro. I can click them but they don't do anything. This was working fine up > to now. I have reinstalled Outlook but no joy. > >...

Exchange 2003 OWAScratchPad maximum item size
I have increased the maximum item size on this public folder as per http://support.microsoft.com/?id=304307 to enable OWA clients to post attachments larger than 1MB. However, this limit seems to be reset whenever the Exchange server is restarted. Has anyone come across or indeed solved this problem. Ben Major ...

Item Price Maintenance
GP version 8.00g7. If you play around in the Item Price Maintenance window they try to exit, a popup asks if you'd like to save changes. Only 2 choices: Yes & Cancel. Cancel brings you back to the Item Price Maintenance window again, where you are trying to exit without saving changes. Only choice is to say yes. WTF? G Have you tried the red x in the upper right corner of the window? -- Richard L. Whaley Author / Consultant / MVP Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com "GiJ...

Some Visio drawings lose text when creating PDF from Word
I have a number of Visio drawings that I've inserted into a Word document, using Edit>>Copy Drawing in Visio then Paste Special (selecting Microsoft Visio Drawing Object and Paste Link). When I compile a PDF using Adobe Acrobat Professional 7, some of the Visio drawings lose their text (all of it). <arggh> Anyone got any ideas or cures?? Thanks Mike ...

new mail icon in system tray when rule is applied that deletes items...
Hello, Is there a way to make the new mail icon go away when new messages come in that are automatically marked as read and then deleted (moved to deleted items folder) via rules? Thanks! Brian Brian McCullough <nomorespammingme@myemailaddress.com> wrote: > Is there a way to make the new mail icon go away when new messages > come in that are automatically marked as read and then deleted (moved > to deleted items folder) via rules? No. -- Brian Tillman ...

a win-lose situation
i have a pivot table where i display who won a wrestling match along with when and where. the problem is, i want two things that i'm not sure are possible: 1) in the totals and subtotals, i would like to have them display the number of times my data says "won" or "1" then a "/" and the number of times my data says "lost" or "0". i also have a "won by fall" column that features a "1" or a "0", indicating whether they won by fall or not, but i also have a "forfeight" in some. 2) i need it to ret...

Sent items problem
I have a problem with items that have been placed in folders. Once an item is placed in a folder and then replied to or forwarded the item does not show up in the sent items folder. Rather it puts the sent item into the same folder the original email was located. I would like to revert all sent items to the sent items folder... Ideas? Thanks in advance. Ryan Hi Ryan, In Outlook, Tools -> Options -> E-mail Options, there is an setting for Save copies of messages in Sent Items folder. Make sure this option is checked. Best Regards, Ryan M. Keith, BSCSE, MCSE Microso...

Only load actually visible items?
Hi, Im building an application to use instead of the explorer thumbnail view. Lets say i have a folder with 2500 images, and at any given time i can show 25 images at thumbnail size on my screen. I have a control (PictureControl, PC) on which i have a picturebox to display the individual images, and a label for the name. Ive loaded all theese 2500 controls onto a FlowLayoutPanel. Now i want an event to fire when i scroll and a PC becomes visible, so that i can load the image then, and when it leaves the visible area i can unload the image. so that i use a minimal amount of memory. ...

Sent Items Folder #4
Just recently I have noticed that a couple of users are not getting their sent email to default to their 'Sent Items' folder. We have an Exchange 2000 Server running with a mixture of Outlook 2000 and 2003 clients. One of the problems is from a 2K client and then another one with 2003??? It is hit and miss....one time it saves to their folder, the next it will not. I am aware, and have checked, the 'Save Forwarded Messages' checkbox and it is checked (as I am not sure if they were forwarding messages that did not appear in their Sent Items folder). Has anyone heard of this...

Formatting Pivot Table Item Row Totals
Hello, Is there a way to automatically have the item row totals appear in bold while the detail remains unbold? For example, if I have a Pivot Table that displays the following data: State City Total Tennessee Nashville 500 Chattanooga 300 Memphis 200 Knoxville 100 Tennessee Total 1,100 I would want the number 1,100 to appear in bold while the other four numbers (the detail) are not ...

Chart items moving around
I have a worksheet containing a lot of graphs that I have aligned carfully. I then have a macro that updates the sheet for various business units and collects pictures of the sheet in another file. Everything works fine except that the chart items move around a little which is quite annoying since I want it to look exactly the same for all units. For example, when I have run the macro a couple of times I can find a legend a bit off its original position or a plot area that has become a bit smaller. Does anyone know why this happens and if there is something to do about it? This actuall...

Tracking loan last year; importing time tracking items
1. I am not able to set up a loan account to track my loan which started last year. Money allows me to track only from the beginning of the current year. 2. I have a bunch of 'time tracking' items in a spreadsheet which I would like to import into Money SB for association with invoices, but understand that it is not possible. Are there solutions to these problems? TIA. 1) Set the date back on your computer just long enough to create the loan account. Why Money enforces this piece of mindlessness is a question for the ages. 2) I have no clue. I don't use SB. Next to nobody ...

Object Collection: Couldn't find item indicated by text (FRX)
Hi there, I have a problem using Account Category in my frx report. When I try to design my report using Great Plains Account category, I get the error "Object Collection: Couldn't fine item indicated by text." When trying to generate report. Then the report does not contain any category other than the first one. After some tests I discovered that, only the first line item in my row format that contains account category appear in my report (either if this line have one category or a range of categories) but no other rows have category appears in my report. In addition, I ...

summing line items by category
I have all my expenses listed by date order for 2009. I categorized them using a "Data Validation" list. Now I want to get totals for each category. How do I do this? Without seeing your WB I would suggest to Filter-Out whatever needed category and calculate its sum with SUBTOTAL. Micky "The Ambassador" wrote: > I have all my expenses listed by date order for 2009. I categorized them > using a "Data Validation" list. Now I want to get totals for each category. > How do I do this? Hi Assuming you have headings in row 1 like ...

importing/editing inventory items/defining columns within item win
Is there a way for me to import old inventory lists generated in a spreadsheet, and make them into new items within my database in RMS small business manager?? i have a spreadsheet of over two thousand items, and I would not like to have to manually input them, instead I would like to assign a colum to a specific cell in the item window. I also would like to be able to edit large groups of items with one action, for example editing a supplier name for multple entries. Also, I am trying to define which columns I can see when I search for an Item, I want to be able to see the item numbe...

Emails and SFO? Not copying to sent items...
Apparently CRM Emails that are sent are not copied to your sent items in outlook. This really seems like a deal breaker to me -- and a real barrier for end users. The biggest reason we are considering using CRM is because of the extensive amount of time our users spend in outlook. I can see the users now bitching because they cannot find emails they sent and work with them in the way they normally would. Any ideas on this? It's true that sent e-mails are not copied to Sent Items (of course those created with CRM toolbar)...... .........they are copied to Deleted Items... Rafal Perwej...

Net Worth Report: Investment Account cash compenent as a separate line item
Is there a way to get MS Money to combine the cash account associated with an Investment account with the investment account. For investment accounts, 2 lines are unnecessarily reported in the Networth report such as below. I want only one amount reported. Account Name X $x Account Name X (cash) $Y Using Money 2004. Thx Probably not. Money really does think these are two accounts. You could always copy the report to Excel where you could make it say anything you want. "Bill Toupee" <billtupea@domain.com> wrote in message news:hmnXf.210000$H%4.1...

Imported Items Sent Folder Options
I changed machines and installed Win 7 Pro on the new machine. I imported my email to the new machine. Win 7 Live mail in the installed account has the usual folders including the SENT folder which has a (sent option) that show who the message is sent to. In the (Storage folder Imported messages SENT folder) the sent folder does not have a SENT to option, only date, my name, etc.. A SENT option in this folder would be very desireable to use for reference to whomever I sent the messages before. I don't consider this option nitpicking, it only seems logical as in the default e...