control ListControl

26/04/2004 - 16:20 por Kno | Informe spam
Alguien me puede ayudar?
Quiero utilizar un control ListControl, no se como poner
la informacion de los subitems.
Se que utilizando las clases de MFC es muy sencillo, pero
mi programa esta todo hecho con APIs de Windows utilizando
el Plataform SDK.
Me podrian ayudar.

Preguntas similare

Leer las respuestas

#1 Scafe
26/04/2004 - 16:36 | Informe spam
hola, como accedes al control, por COM??, depende de como
lo accedas podes interactuar con el

Alguien me puede ayudar?
Quiero utilizar un control ListControl, no se como poner
la informacion de los subitems.
Se que utilizando las clases de MFC es muy sencillo, pero
mi programa esta todo hecho con APIs de Windows


utilizando
el Plataform SDK.
Me podrian ayudar.
.

Respuesta Responder a este mensaje
#2 Kno
26/04/2004 - 18:57 | Informe spam
Los accedo con las macros predefinidas para el mismo.
el Listview me carga los datos solo para la lista, pero
ademas quiero añadirle el detalle.
Respuesta Responder a este mensaje
#3 Scafe
26/04/2004 - 19:23 | Informe spam
Podes encontrar esta y mas documentacion en la ayuda del
platform SDK. Saludos

/////////////////////////////////////////////////////////

Adding List-View Items and Subitems
To add an item to a list-view control, an application must
first define an LVITEM structure and then send an
LVM_INSERTITEM message, specifying the address of the
LVITEM structure.

If an application uses report view, subitem text must be
entered. The following code samples fill an LVITEM
structure and add the list-view items by using the
LVM_INSERTITEM message or the corresponding macro
ListView_InsertItem. Because the application saves its own
text, it specifies the LPSTR_TEXTCALLBACK value for the
pszText member of the LVITEM structure. Specifying the
LPSTR_TEXTCALLBACK value causes the control to send an
LVN_GETDISPINFO notification message to its owner window
whenever it needs to display an item.

// This code snippet adds three items, each with three
// subitems, to a list-view control.
// hWndListView - handle to the list-view control.
// The following application-specific structure,
// PETINFO, is used in the snippet.

typedef struct tagPETINFO
{
char szKind[10];
char szBreed[50];
char szPrice[20];
}PETINFO;

// A PETINFO variable is declared and initialized as
// follows:

PETINFO rgPetInfo[ ] =
{
{"Dog", "Poodle", "$300.00"},
{"Cat", "Siamese", "$100.00"},
{"Fish", "Angel Fish", "$10.00"},
};

// Some code to create the list-view control.
// Initialize LVITEM members that are common to all
// items.
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM |
LVIF_STATE;
lvI.state = 0;
lvI.stateMask = 0;

// Initialize LVITEM members that are different for each
item.
for (index = 0; index < 3; index++)
{
lvI.iItem = index;
lvI.iImage = index;
lvI.iSubItem = 0;
lvI.lParam = (LPARAM) &rgPetInfo[index];
lvI.pszText = LPSTR_TEXTCALLBACK; // sends an
// LVN_GETDISP
// message.


if(ListView_InsertItem(hWndListView, &lvI) == -1)
return NULL;
}

// Because the application specifies LPSTR_TEXTCALLBACK, it
// sends LVN_GETDISPINFO notification messages. The
// application must process these notification messages and
// supply the text for the subitems.
// The text is stored in a previously listed
// application-defined structure called PETINFO.

case WM_NOTIFY:
switch (((LPNMHDR) lParam)->code)
{
case LVN_GETDISPINFO:
switch (((LPNMLVDISPINFO)lParam)->item.iSubItem)
{
case 0:
plvdi->item.pszText rgPetInfo[plvdi->item.iItem].szKind;
break;

case 1:
plvdi->item.pszText rgPetInfo[plvdi->item.iItem].szBreed;
break;

case 2:
plvdi->item.pszText rgPetInfo[plvdi->item.iItem].szPrice;
break;

default:
break;
}
return 0;
}

// NOTE: in addition to setting pszText to point to
// the item text, you could copy the item text into
pszText
// using StringCchCopy. For example:
// StringCchCopy(rgPetInfo[plvdi->item.iItem].szKind,
// sizeof(rgPetInfo[plvdi-
item.iItem].szKind),


// plvdi->item.pszText);
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida