OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Using UDN_DELTAPOS handler in TEdit

Date: 2/4/00
Time: 7:26:19 PM
Remote Name: 127.0.0.1

Comments

Q. You have some code in TEdit (EvUpDown) which is written to respond to UDN_DELTAPOS notifications generated by TUpDown. I don't see how these messages can get there as the parent to the edit control and up/down control will get the notification, followed by the normal "AT_CHILD" processing directed to the up/down control (not the TEdit).

A. There are several ways: For example this function will forward UDN_DELTAPOS message from all updown controls to corresponding edit.

class TMyDialog : public TDialog{ 
    ... 
}; 

DEFINE_RESPONSE_TABLE1(TMyDialog, TDialog) 
  EV_UDN_DELTAPOS(-1, EvUpDown), 
END_RESPONSE_TABLE;

void TMyDialog::EvUpDown(TNmUpDown far& not) 
{ 
   TCurrentEvent& currentEvent = GetCurrentEvent(); 
   THandle hWnd = ::GetWindow(not.hwndFrom, GW_HWNDPREV); 
   if(hWnd) 
    ::SendMessage(hWnd,
   currentEvent.Message, currentEvent.Param1,currentEvent.Param2); 
}

Sincerely 
Yura

Last changed: July 14, 2001