fixed sending duplicate EVT_COMBOBOX events; documented that GetValue() returns new value when called from EVT_COMBOBOX handler

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-09-15 23:07:15 +00:00
parent 35960bbf22
commit 13bcc34881
4 changed files with 43 additions and 17 deletions

View File

@@ -27,7 +27,7 @@
class WXDLLEXPORT wxComboBox: public wxChoice
{
public:
wxComboBox() { }
wxComboBox() { Init(); }
wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
@@ -38,6 +38,8 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr)
{
Init();
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
wxComboBox(wxWindow *parent, wxWindowID id,
@@ -49,6 +51,8 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr)
{
Init();
Create(parent, id, value, pos, size, choices, style, validator, name);
}
@@ -75,7 +79,7 @@ public:
// List functions: see wxChoice
// Text field functions
wxString GetValue() const { return GetLabel(); }
wxString GetValue() const { return m_value; }
virtual void SetValue(const wxString& value);
// Clipboard operations
@@ -105,6 +109,16 @@ public:
protected:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// common part of all ctors
void Init() { m_selectionOld = -1; }
// the previous selection (see MSWCommand() to see why it is needed)
int m_selectionOld;
// the current selection (also see MSWCommand())
wxString m_value;
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
};