![]() |
trabajando con ListView !!!
Amigos mios como puedo seleccionar (por codigo) un Item de un ListView conociendo su Caption.
Gracias de antemano Salu2 Ledian |
Código:
ComboList->ItemIndex = ComboList->Items->IndexOf(Cadena); |
ERRORRrr!!
lo intente con
Código:
ListView1->ItemIndex = ListView1->Items->IndexOf("1412"); Código:
E2034 Cannot convert 'char *' to 'TListItem *' ¿Me pudieras ayudar? |
Código:
ListView1->ItemIndex = ListView1->Items->IndexOf(AnsiString("1412")); |
Errorrrrr !!!
sigue el error pero ahora es:
Código:
|
desde la propia ayuda de delphi
Returns a list view item, if any, with the specified caption. function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean): TListItem; Description Call FindCaption to search for a list view item labeled by the string specified as the Value parameter. If the Inclusive parameter is True, the list item specified by StartIndex is the first item checked. Otherwise, the search starts on the next item. If the Wrap parameter is True, the search continues at the top of the list if a match has not been found before reaching the bottom. FindCaption returns the first item with the Caption property equal to Value. If the Partial parameter is True, a Caption matches if it starts with the substring Value. If Partial is False, the Caption must match Value exactly. If no item is found, FindCaption returns nil. saludos |
mmm !!!
No me has dicho nada. Aun asi no resulevo mi problema. ¿Me lo pudieras aclarar?
Gracias Ledian |
? Tienes la ayuda de delphi de exactamente lo que buscas, si no entiendes ingles bien, te lo explico. Pero de alli a que no te haya dicho nada creo que hay bastante. Saludos.
|
coso tiene razón, te respondí precipitadamente pensando en un TComboBox.
En Builder la clase TListWiew es igual que en delphi (VCL). Por lo que si miras la ayuda de Builder encontrarás lo que te apunta coso. |
!!! mmm ??
Bueno tienen razon
Cita:
les ruego que me ayuden salu2 Ledian |
Bien, pero es que no es por ponerse ferruco. Esa funcion, findcaption, hace exactamente lo que estabas pidiendo: mediante el caption de un listview, encuentra el listitem asociado. Te devuelve un objeto TListItem, del cual tu podras sacar todas sus propiedades.saludos.
|
Concretando, tienes dos posibilidades que te funcionarán:
Código:
TListItem* ListItem = ListView1->FindCaption(0, "1412", true, true, true); Código:
ListView1->Selected = ListView1->FindCaption(0, "1412", true, true, true); Saludos. |
La franja horaria es GMT +2. Ahora son las 18:06:09. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi