15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Bug in CListCtrl::OnEndLabelEdit() ?

Serge Wautier -- serge.wautier@ontonet.be
Monday, February 10, 1997

Environment: MSVC 4.1 / Win95

Hi All,

Is this a bug or am i in a (too) special case ?

Processing of the edition of a label in a list control :
CListCtrl::OnEndLabelEdit()  (LVN_ENDLABELEDIT) :

If want to check if edition was user-canceled . The doc says :

"Windows 95: You can determine if editing is being canceled by checking the
pDispInfo->lpszText member; if it is NULL, the user is canceling editing."

That's true : it is NULL whe nthe user cancels edition.
The problem is that if the user does not modify the text and strikes ENTER
(accept the default text),  pDispInfo->lpszText is NULL as well !

You might think that if the user doesn't change the text, it's the same as
cancelling the edition. Probably yes in some cases. But not in mine :
I've got items that exist but are unnamed by default (Label is 'unnamed').
When the user enters edition of the label, i change the text from 'unnamed'
to a default name based on the item's properties. The user is very likely
to accept this default name... Except that in that case, CListCtrl tells me
that the user canceled edition !

Any hint welcome.

Serge Wautier,
Techno Trade s.a.
Belgium
serge.wautier@ontonet.be
http://www.tbox.fr



Doncho Angelov -- alian@plovdiv.techno-link.com
Thursday, February 13, 1997

Hi Serge !

You could 'patch' this situation by checking if the label of the node is =
'unnamed'. Then, you must know that the user has pressed Enter as well. =
Or, if you like bigger patches, you could handle OnKeyDown and to set =
everytime one variable BOOL bLastKeyWasEnter to true or false according =
to the situation and then to handle this in your OnEndLabelEdit. Sorry, =
I don't know if the situation you face is bug or whatever, but you could =
try this solution...

Doncho

----------
From: 	Serge Wautier[SMTP:serge.wautier@ontonet.be]
Sent: 	Monday, February 10, 1997 6:24 PM
To: 	mfc list
Subject: 	Bug in CListCtrl::OnEndLabelEdit() ?

Environment: MSVC 4.1 / Win95

Hi All,

Is this a bug or am i in a (too) special case ?

Processing of the edition of a label in a list control :
CListCtrl::OnEndLabelEdit()  (LVN_ENDLABELEDIT) :

If want to check if edition was user-canceled . The doc says :

"Windows 95: You can determine if editing is being canceled by checking =
the
pDispInfo->lpszText member; if it is NULL, the user is canceling =
editing."

That's true : it is NULL whe nthe user cancels edition.
The problem is that if the user does not modify the text and strikes =
ENTER
(accept the default text),  pDispInfo->lpszText is NULL as well !

You might think that if the user doesn't change the text, it's the same =
as
cancelling the edition. Probably yes in some cases. But not in mine :
I've got items that exist but are unnamed by default (Label is =
'unnamed').
When the user enters edition of the label, i change the text from =
'unnamed'
to a default name based on the item's properties. The user is very =
likely
to accept this default name... Except that in that case, CListCtrl tells =
me
that the user canceled edition !

Any hint welcome.

Serge Wautier,
Techno Trade s.a.
Belgium
serge.wautier@ontonet.be
http://www.tbox.fr




Become an MFC-L member | Вернуться в корень Архива |