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

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


Updating the file status in CRichEditCtrl

Chris Cicchetti -- c_cicchetti@finisar.com
Wednesday, February 12, 1997

Environment: Windows95, NT 4.0, Visual C++ 4.0

Hi,

I am currently using a CRichEditCtrl in a dialog box. The question I have is
related to testing for the current file modified status. I do this so I can
update the '*' on the dialog box titlebar to signal modifications. My
current inplementation in the CRichEditCtrl derived class is to use message
reflection on the EN_UPDATE message :

void CSSEditor::OnUpdate() 
{
	// Do something only if this is the first change
	if( !GetModify() )
	{
		GetParent()->SendMessage( WM_SSRCH_MESSY_FILE, NULL, NULL );
	}
}

Two questions :
1) This doesn't work. An EN_UPDATE message is *never* generated. Any idea
why not?
2) Even if this did work, it seems taxing to test on every update to the
edit control. Is there a better way?

Thanks,
Chris




P. Senthil -- senthilp@geocities.com
Friday, February 14, 1997

I faced a similar problem of not getting EN_UPDATE notifications. You
have to set the event mask for the Rich edit control, using
SetEventMask() member. In your case the mask would be ENM_UPDATE.

Chris Cicchetti wrote:
> Environment: Windows95, NT 4.0, Visual C++ 4.0
> 
> Hi,
> 
> I am currently using a CRichEditCtrl in a dialog box. The question I have is
> related to testing for the current file modified status. I do this so I can
> update the '*' on the dialog box titlebar to signal modifications. My
> current inplementation in the CRichEditCtrl derived class is to use message
> reflection on the EN_UPDATE message :
> 
> void CSSEditor::OnUpdate()
> {
>         // Do something only if this is the first change
>         if( !GetModify() )
>         {
>                 GetParent()->SendMessage( WM_SSRCH_MESSY_FILE, NULL, NULL );
>         }
> }
> 
> Two questions :
> 1) This doesn't work. An EN_UPDATE message is *never* generated. Any idea
> why not?
> 2) Even if this did work, it seems taxing to test on every update to the
> edit control. Is there a better way?
> 
> Thanks,
> Chris




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