Promblem with Dynamic Control Event Handling.
-
Hi all, I am creating a Edit Box Dynamically in CDialog Box. And when i Right Click on the Edit Box what i have created i want to show a Menu. //=========================================================================== //Source for Creating the Edit Box when mouse is clicked. CEdit *ptr = new CEdit; ptr->Create(WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL,CRect(point.x,point.y,point.x +100, point.y +20),this,NULL); Note : the Last Parameter is the ID for the Edit Control in Create(...) Api. //=========================================================================== Now i am not able to handle an event to this dynamically created Edit Box. I want to Handle the RButtonDown Event for every Dyanmically Created Edit Box. i Mean when ever i Right Click on the EditBox what i have Created i want to Populate a Menu using TrackPopUpMenu(...) Api. please help me out. Uday kiran
-
Hi all, I am creating a Edit Box Dynamically in CDialog Box. And when i Right Click on the Edit Box what i have created i want to show a Menu. //=========================================================================== //Source for Creating the Edit Box when mouse is clicked. CEdit *ptr = new CEdit; ptr->Create(WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL,CRect(point.x,point.y,point.x +100, point.y +20),this,NULL); Note : the Last Parameter is the ID for the Edit Control in Create(...) Api. //=========================================================================== Now i am not able to handle an event to this dynamically created Edit Box. I want to Handle the RButtonDown Event for every Dyanmically Created Edit Box. i Mean when ever i Right Click on the EditBox what i have Created i want to Populate a Menu using TrackPopUpMenu(...) Api. please help me out. Uday kiran
You need to add the entries of the control in the message map manually. The best way to do it is to look how class wizard does and do the same for your control. So, add an edit box to your dialog, add the handler with classwizard look at the message maps entries (in the dialog class header file and source file) and see what has changed. Now you can do the same for your control.
Cédric Moonen Software developer
Charting control [Updated - v1.1] -
You need to add the entries of the control in the message map manually. The best way to do it is to look how class wizard does and do the same for your control. So, add an edit box to your dialog, add the handler with classwizard look at the message maps entries (in the dialog class header file and source file) and see what has changed. Now you can do the same for your control.
Cédric Moonen Software developer
Charting control [Updated - v1.1]Hi Cedric Moonen, My Doubt is that the CEditBox doesn't Handle the WM_RBUTTON_DOWN Event. The Events handled for the Edit Box are. EN_CHANGE,EN_ERRORSPACE,EN_HSCROLL,EN_KILLFOCUS,EN_MAXTEXT,EN_SETFOCUS,EN_UPDATE. What about the Event Handler of WM_RBUTTON_WOWN Event. please tell me your suggestions. Uday kiran
-
Hi Cedric Moonen, My Doubt is that the CEditBox doesn't Handle the WM_RBUTTON_DOWN Event. The Events handled for the Edit Box are. EN_CHANGE,EN_ERRORSPACE,EN_HSCROLL,EN_KILLFOCUS,EN_MAXTEXT,EN_SETFOCUS,EN_UPDATE. What about the Event Handler of WM_RBUTTON_WOWN Event. please tell me your suggestions. Uday kiran
uday kiran janaswamy wrote:
The Events handled for the Edit Box are. EN_CHANGE,EN_ERRORSPACE,EN_HSCROLL,EN_KILLFOCUS,EN_MAXTEXT,EN_SETFOCUS,EN_UPDATE.
These aren't events handled by the edit control. These are notifications posted by the edit control to it's parent. In that case you can use WM_PARENTNOTIFY[^]. Or if your only interested in a right-click there is NM_RCLICK[^] notifications.