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

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


Notification from CTreeCntrl

t_samal_c1@verifone.com
Monday, August 26, 1996

Environment: VC4.0, Win95
Hi,
 How do i process notifications from a control in a dialog bar (floating and 
docked)?
 I've got a CResizableDlgBar derived from a CDialogBar, that contains a Tree 
Control (Not as a member variable, its in the dlg. template).
 How do i get notification from this tree control when a user changes the 
selected node in the tree.
 I need to be able to enable/disable menu items based on this.
I tried overriding OnNotify and OnChildNotify functions like :

BOOL CResizableDlgBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	TRACE("notified0");
	switch (((NMHDR*)lParam)->code) {
	case TVN_SELCHANGED:
		UpdateDialogControls(GetParentFrame(),TRUE) ;
		break ;
	}
	return CDialogBar::OnNotify(wParam, lParam, pResult);
}

BOOL CResizableDlgBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM 
lParam, LRESULT* pLResult) 
{
	if(message==WM_NOTIFY) {
		TRACE("notified1");
		switch (((NMHDR*)lParam)->code) {
		case TVN_SELCHANGED:
			UpdateDialogControls(GetParentFrame(),TRUE) ;
			break ;
		}
	}
		
	return CDialogBar::OnChildNotify(message, wParam, lParam, pLResult);
}

Notifications are getting generated - i checked with spy++, but i'm not
able to process them in the Dialogbar.


Any help would be recieved with thanks.
Samal Chandran.
Verifone Blr.



Dicky Singh -- Dicky@landmark.com
Wednesday, August 28, 1996

[Mini-digest: 3 responses]

add code to your mainframe class (CMainFrame when 
using appwiz generated code) instead of class you derived from CDialogBar

-add ON_NOTIFY(TVN_SELCHANGED/ING, ID_WHATEVER, FnFoo) inside 
BEGIN_MESSAGE_MAP - END_...  after //}}AFX_MSG_MAP

-add method CMainFrame::FnFoo(NMHDR* pNMHDR, LRESULT* pResult)

----------
From: 	t_samal_c1@verifone.com[SMTP:t_samal_c1@verifone.com]
Sent: 	Monday, August 26, 1996 7:13 p
To: 	mfc-l@netcom.com
Subject: 	Notification from CTreeCntrl

Environment: VC4.0, Win95
Hi,
 How do i process notifications from a control in a dialog bar (floating and 
docked)?
 I've got a CResizableDlgBar derived from a CDialogBar, that contains a Tree 
Control (Not as a member variable, its in the dlg. template).
 How do i get notification from this tree control when a user changes the 
selected node in the tree.
 I need to be able to enable/disable menu items based on this.
I tried overriding OnNotify and OnChildNotify functions like :

BOOL CResizableDlgBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	TRACE("notified0");
	switch (((NMHDR*)lParam)->code) {
	case TVN_SELCHANGED:
		UpdateDialogControls(GetParentFrame(),TRUE) ;
		break ;
	}
	return CDialogBar::OnNotify(wParam, lParam, pResult);
}

BOOL CResizableDlgBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM 
lParam, LRESULT* pLResult) 
{
	if(message==WM_NOTIFY) {
		TRACE("notified1");
		switch (((NMHDR*)lParam)->code) {
		case TVN_SELCHANGED:
			UpdateDialogControls(GetParentFrame(),TRUE) ;
			break ;
		}
	}
		
	return CDialogBar::OnChildNotify(message, wParam, lParam, pLResult);
}

Notifications are getting generated - i checked with spy++, but i'm not
able to process them in the Dialogbar.


Any help would be recieved with thanks.
Samal Chandran.
Verifone Blr.



--------------------
Dicky Singh, Dicky@Landmark.COM
Dragon Team. Landmark Systems Inc.
8000 Towers Crescent, Vienna VA 22182
-----From: "Rommel Songco" 

Hi there!

	The control messages are being sent to the parent of the dialog bar.  Code
your message handlers there.

Regards,

Rommel Songco
rsongco@spectrasoft.com

-----From: "S. Balachandar" 

Hi!,

Try this:

Add a message map entry like :

	ON_NOTIFY( TVN_SELCHANGED, id-of your control, Member Fxn)

This will call  Whenever a notification comes.

Please Note :
-------------------
The OnChildNotify() which you tried to use is not useful for handling =
Child Notifications in parent!!!.

   The OnNotify()'s default Implementation tries to check the message =
map for appropriate member fxn to call!!!. So generally overloading =
OnNotify() is'nt really useful for this purpose.


Regards
Bala

-------------------------------------------------------------------------=
----------------------------------------
S. Balachandar                                e-mail : =
chandar@adca01.enet.dec.com
Software Engineer                             Phone  : 3370445 Ext : 479
Digital Equipment (I) Ltd.,                   Fax    : 3371498
Digital House, 45/14 Tumkur Road,  =20
Yeshwanthpur II Stage,                   =20
Bangalore 560 022.                         =20




| Вернуться в корень Архива |