Event senden : OnEndLabelEdit

EriFo

Erfahrenes Mitglied
Ich hab da ein CTreeCtrl und wenn der benutzer gerade ein Item editiert und [enter]
drückt würde ich dem nun gerne sagen wollen, das es aufhören soll.

Wenn man jedoch "einfach so" [enter] drückt, wird der Standard Button ausgelöst.
Deshalb fange ich das schon in PreTranslateMessage(..) ab:

Die Nachricht wird dann aber nicht von dem CTreeCtrl sondern von dem CEdit in den CTreeCtrl abgefeuert - die abzufangen und soweit kein problem :

Code:
if (pMsg->hwnd == ((CTreeCtrl*)GetDlgItem(IDC_IMG_TREE))->GetEditControl()->GetSafeHwnd()
&& pMsg->message == WM_KEYDOWN)
{
	if (pMsg->wParam == VK_RETURN)
	{
		//--- hier Nachricht senden und Editieren beenden - T_T 
		return TRUE;
	}
}

Aber wie sende ich jetzt die Nachrich und wo bekomme ich die Parameter her ?!
Die Enstprechende Nachricht heist : TVN_ENDLABELEDIT
Die MSDN sagt folgendes dazu aber ich werd nicht schlau draus :

TVN_ENDLABELEDIT
ptvdi = (LPNMTVDISPINFO) lParam

Notifies a tree view control's parent window about the end of label editing for an item. This notification message is sent in the form of a WM_NOTIFY message.

If the pszText member is non-NULL, return TRUE to set the item's label to the edited text. Return FALSE to reject the edited text and revert to the original label.
ptvdi
Address of an NMTVDISPINFOstructure. The item member of this structure is a TVITEM structure whose hItem, lParam, and pszText members contain valid information about the item that was edited.
If label editing was canceled, the pszText member of the TVITEM structure is NULL; otherwise, pszText is the address of the edited text.
If the pszText member is NULL, the return value is ignored.

If you specified the LPSTR_TEXTCALLBACK value for this item and the pszText member is non-NULL, your TVN_ENDLABELEDIT handler should copy the text from pszText to your local storage.
(wieso kann eigentlich der CODE nicht so lang sein wie das ZITAT ?!)

Hab schon ein bischen mit SendMessage(..) rumgebastetl aber ohne Erfolg.
Kann mir jemand helfen ?!

M.f.G: Erik
 
Zuletzt bearbeitet:
Zurück