InterviewSolution
| 1. |
Why Doesn't The Getstring Method Of Wxcommandevent Work? |
|
Answer» Many simple controls like buttons, list boxes, check boxes, etc., generate a wxCommandEvent, because the event is OFTEN processed by the parent window, and only command events propogate to the parent (if the control itself doesn't handle them). However, because the values needed by the event handler vary depending on the type of the control and on the specific event, wxCommandEvent has a variety of DIFFERENT methods for retrieving the value. Depending on the control and event, not all these methods will return non-zero or non-empty values. For example, GetString only works for EVT_LISTBOX and EVT_CHOICE, but doesn't make any sense for EVT_CHECKBOX. Read the documentation of the wxCommandEvent method for DETAILS of which events SUPPORT that method. If you need additional information, you'll need to retrieve a REFERENCE to the control which generated the event (see How can my EVT_XYZ handler find the control that generated an event?) Many simple controls like buttons, list boxes, check boxes, etc., generate a wxCommandEvent, because the event is often processed by the parent window, and only command events propogate to the parent (if the control itself doesn't handle them). However, because the values needed by the event handler vary depending on the type of the control and on the specific event, wxCommandEvent has a variety of different methods for retrieving the value. Depending on the control and event, not all these methods will return non-zero or non-empty values. For example, GetString only works for EVT_LISTBOX and EVT_CHOICE, but doesn't make any sense for EVT_CHECKBOX. Read the documentation of the wxCommandEvent method for details of which events support that method. If you need additional information, you'll need to retrieve a reference to the control which generated the event (see How can my EVT_XYZ handler find the control that generated an event?) |
|