Help! listview

melkiorlenecrarque Messages postés 97 Date d'inscription dimanche 6 juillet 2003 Statut Membre Dernière intervention 20 janvier 2008 - 30 mai 2005 à 22:34
cs_louis14 Messages postés 793 Date d'inscription mardi 8 juillet 2003 Statut Membre Dernière intervention 10 février 2021 - 31 mai 2005 à 09:42
Hello !!
Encore un probleme de ListView !!
Toutes les colonnes sont bien remplies lorsque j'execute :

void AddLineListView(int ligne, int colonne, char* texte, BOOL first)
{
HWND hwndListView = GetDlgItem(hDlg,IDC_LIST1);
LVITEM lvLine = {0};
lvLine.mask = LVIF_TEXT;
lvLine.iItem = ligne;
lvLine.iSubItem = colonne;
lvLine.pszText = texte;
if( first == TRUE )
ListView_InsertItem(hwndListView, (LPARAM)&lvLine);
else
ListView_SetItem(hwndListView, (LPARAM)&lvLine);
}

par contre la premiere colonne est triée automatiquement, mais les informations des colonnes 2, 3 ... semblent tout simplement perdues!!!

voila comment je crée mais colonnes:

void initListView()
{
HWND hwndListView = GetDlgItem(hDlg,IDC_LIST1);
LV_COLUMN lvColumn;
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.cx = 162;
lvColumn.pszText = "Titre";
lvColumn.cchTextMax = lstrlen(lvColumn.pszText);
ListView_InsertColumn(hwndListView,0,(LPARAM)&lvColumn);
lvColumn.cx = 162;
lvColumn.pszText = "Artiste";
lvColumn.cchTextMax = lstrlen(lvColumn.pszText);
ListView_InsertColumn(hwndListView,1,(LPARAM)&lvColumn);
lvColumn.cx = 162;
lvColumn.pszText = "Album";
lvColumn.cchTextMax = lstrlen(lvColumn.pszText);
ListView_InsertColumn(hwndListView,2,(LPARAM)&lvColumn);
lvColumn.pszText = "Chemin";
lvColumn.cchTextMax = lstrlen(lvColumn.pszText);
ListView_InsertColumn(hwndListView,3,(LPARAM)&lvColumn);
ListView_SetExtendedListViewStyleEx(hwndListView,0 , LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
}

Quelqu'un a-t-il une idée sur l'origine du probleme?
Est-il possible d'empecher le tri automatique des colonnes?

Merci,

Melkior le necrarque.

1 réponse

cs_louis14 Messages postés 793 Date d'inscription mardi 8 juillet 2003 Statut Membre Dernière intervention 10 février 2021 8
31 mai 2005 à 09:42
il faut dériver ta classe listview et traiter la fonction Drawitem toi-même. il y a de bon exemple sur codeproject.com à ce sujet.

louis14
0
Rejoignez-nous