Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CListCtrl editieren

Empfohlene Antworten

Hi, ich möchte gern einen Eintrag in meinem ListCtrl umbenennen können.

So wie man Dateien im Explorer umbenennt. Mit welcher Funktion macht man denn das?

Danke für den Hinweis :hells:

Hab jetzt bei Codeprojekt eine Demo Anwendung runtergeladen und auch die Funktion StartEdit und EndEdit gefunden.

Aber das lässt sich wohl nicht so ohne weiteres in mein Programm einbauen.

Schaut nämlich sehr kompliziert aus und ICH NIX VERSTEHEN!!

Weil dazu gibts ja keine Hilfe und kompilieren lässt sichs bei mir nicht. Stürtr gleich ab.

BOOL CReportCtrl::StartEdit(int nItem, int nSubItem)

{

// Get the grid width and height

if (!m_bAllowEdit || !_IsValidIndex(nItem) || nSubItem < 0 || nSubItem >= GetColumnCount())

return FALSE;

if (m_ptEditting.x == nItem && m_ptEditting.y == nSubItem)

return TRUE;

EndEdit(TRUE);

m_ptEditting.x = nItem;

m_ptEditting.y = nSubItem;

SetAllItemStates(RC_ITEM_SELECTED, RC_ITEM_UNSELECTED); // unselect all

SetItemStates(m_ptEditting.x, RC_ITEM_SELECTED | RC_ITEM_FOCUSED);

// determine editbox font and alignment

const DWORD FMT = _GetHeaderTextFormat(nSubItem);

if (FMT != m_dwPrevEditFmt)

{

m_dwPrevEditFmt = FMT;

// Funny thing:

// Changing CEdit style among ES_LEFT, ES_CENTER, ES_RIGHT at runtime works

// sometimes and fails other times. It just cannot guarantee to be succeed.

// So I decided to destroy and recreate the CEdit every time when the text

// format changes.

if (m_pWndEdit->GetSafeHwnd() != NULL)

m_pWndEdit->DestroyWindow();

if (!m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0))

return FALSE;

}

else

{

if (m_pWndEdit->GetSafeHwnd() == NULL

&& !m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0))

{

return FALSE;

}

}

m_pWndEdit->SetFont(GetFont());

CRect rcEdit;

ListView_GetSubItemRect(GetSafeHwnd(), m_ptEditting.x, m_ptEditting.y, LVIR_LABEL, &rcEdit);

if (m_ptEditting.y > 0 && GetImageList() != NULL && GetItemImage(m_ptEditting.x, m_ptEditting.y) >= 0)

rcEdit.DeflateRect(16, 0, 0, 0);

// Move the editbox to that grid, obtain text from the grid, display the

// editbox, and, finally, highlights all text in the editbox and set the

// windows focus to the editbox.

m_pWndEdit->MoveWindow(&rcEdit);

m_pWndEdit->SetWindowText(GetItemText(m_ptEditting.x, m_ptEditting.y));

m_pWndEdit->ShowWindow(SW_SHOW);

m_pWndEdit->SetSel(0, -1);

m_pWndEdit->SetFocus();

return TRUE;

}

Hab jetzt bei Codeprojekt eine Demo Anwendung runtergeladen und auch die Funktion StartEdit und EndEdit gefunden.
Wenn es nur um die erste Spalte geht, brauchst du nichts von Codeproject.

kompilieren lässt sichs bei mir nicht.
Wenn es sich nicht kompilieren lässt, dann rück mit der Fehlermeldung raus.

Stürtr gleich ab.
Was sich nicht kompilieren lässt, kann nicht abstürzen ;)

Sorry, etwas doof ausgedrückt...

Es lässt sich kompilieren läuft aber net. Hier knallts:

CReportCtrl::PreSubclassWindow() line 935 + 37 bytes

Ich möchte nicht nur die erste Spalte umbenennen. Man soll irgeneine Spalte anklicken und dann im Kontextmenü auf "Umbenennen" klicken können.

Du kannst Dir das Projekt hier runter laden:

http://www.codeproject.com/listctrl/ReportControl.asp

Vielleicht läufts ja bei Dir?!

Oh mann, sorry! Ich hab das Projekt in dem Unterordner geöffnet.

Dachte ich brauch das ListView.

Ich habe diese Struktur net kapiert. Dachte das sind mehrere Projekte zusammengefasst wo es um verschiedene Themen geht...

Jetzt kann ichs auch öffnen.

Bin gespannt ob ich raus bekomme wie die das gemacht machen.

Jetzt muss ich aber schluss machen. Hab noch einen Termin.

Bis morgen!! Bin mir sicher ich brauche Dich nochmal ;)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.