Solved

How to update subItems in ListView on C++ Builder

Posted on 2001-09-08
6
2,856 Views
Last Modified: 2007-12-19
Any one help me How to Update subItems on ListView!
0
Comment
Question by:vinhdh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:ua1zcl
ID: 6466409

 That looks such procedure in win32 api version, maybe it helps you.

------------------------ in host (of LV) window callback proc -----------------
  case WM_NOTIFY:
     {//1
       NMHDR *pnmhdr  = (NMHDR *)lParam;
       switch (pnmhdr->code)
       {//2
        case LVN_GETDISPINFO:
             return ListView_OnGetDispInfo((LV_DISPINFO *) pnmhdr);
      // .....
     }
----------------------------------------------------
PFABONDATA1 - poiner to structure contains fixed (or limited) lenth of strings.

LRESULT ListView_OnGetDispInfo( LV_DISPINFO *plvdi)
{//0
 PFABONDATA1 pfad = (PFABONDATA1)(plvdi->item.lParam);

 switch (plvdi->item.iSubItem)
 {//1
     case serialn: plvdi->item.pszText = pfad->szSerialn; break;
     case dognum:(!psf->bNotUseDognum)?plvdi->item.pszText = pfad->szDogOrdinal:" ";
     break;
   case dogdate: (!psf->bNotUseDogDate)?plvdi->item.pszText = pfad->szDogDate:" ";
   break;
     case region: (psf->bNotUseRegions)?" ":plvdi->item.pszText = pfad->szRegion;
     break;
     case postind: (psf->bNotUsePostindx)?" ":plvdi->item.pszText = pfad->szPostind;
     break;
     case street: plvdi->item.pszText = pfad->szStreet; break;
     case house: plvdi->item.pszText = pfad->szHousenum; break;
     case corpus: plvdi->item.pszText = pfad->szCorpus; break;
     case kvart: plvdi->item.pszText = pfad->szKvart; break;
     case family: plvdi->item.pszText = pfad->szFamily; break;
     case name: plvdi->item.pszText = pfad->szName; break;
     case telephone: plvdi->item.pszText = pfad->szTelephone; break;
     case payprev: plvdi->item.pszText = pfad->szPayyearPrev; break;
     case paycur: plvdi->item.pszText = pfad->szPayyearCur; break;
     case paynext: (psf->bNotUseNextYrCol)?
                              " ":plvdi->item.pszText = pfad->szPayyearNext;break;
     case nopayed: plvdi->item.pszText = pfad->szNopayed; break;
     case remarks: plvdi->item.pszText = pfad->szRemarks; break;
   case deleted: plvdi->item.pszText = pfad->szDeleted;break;
   default:break;
  }//1

 return 0;
}
-----------------------------
Alex.
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 100 total points
ID: 6487905
I  think, you can make next:
ListView->Items->Item[index] = <update from data> ;
and after this UpdateItems
ListView->UpdateItems(i,i);
Good Luck, Alex
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6498982
hi AlexVirochovsky,
Welcome to Expert Exchange!

Here in the C++ section, the experts have agreed to post comments rather than answers.  This helps the users because, in general, they will get more help if their question remains in the upper portion of the Q list where it is more visible.  That enhances the collaborative nature of EE.

So in the future, please post comments, like everybody else.  Thanks!
=--==-=-=-=-=-=-=-=-=-=-=-=-=-

hi vinhdh,

Can you be more specific about what help you need?  Are you using Visual C++ and MFC?  Have you been able to populate the list with data?  

Have you tried
  m_cListCtl->SetItemText( nItem, nSubItem, "New text");

-- Dan
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6502050
hi Dan!
Welcome to Expert Exchange!
See a title of Question :
>>How to update subItems in ListView on C++ Builder
From this all your comment is unusable.
My reply , of couse, correct: it is line from
BCB project.

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6502580
hi AlexVirochovsky,

>> From this all your comment is unusable.

I am not proposing that my comment is an answer -- no, no no.  Far from it!   I would *never* assume that a one line of information would solve a user's problem.  

   Q: How can I fix my program ?

   A: Use the debugger [lock as answer]

That is not a complete answer!  I would first ask some questions to see what *specific* help the user needed.  Then I would formulate a response, providing details that applied directly to the user's situation.  

Don't you think that vinhdh has access to the same help file that you have?  The one that describes how to use

   ListView->Items->Item[index]= "text";

With that assumption, isn't it rather silly to assume that quoting the obvious will fail to solve his problem?  Isn't it more sensible to assume that he needs help with some specific aspect of setting sub-item data?  Or perhaps he needs a more general discussion of how to create and populate the list in the first place.  

In any case, it is incorrect to lock the Q without first getting more specific details, then addressing the specific needs.

-- Dan
0
 
LVL 11

Expert Comment

by:griessh
ID: 7024907
Dear vinhdh

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to

     "delete this question"

since you never gave more feedback.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question