diff options
Diffstat (limited to 'CPP/Windows/Control')
| -rw-r--r-- | CPP/Windows/Control/ComboBox.cpp | 9 | ||||
| -rw-r--r-- | CPP/Windows/Control/ComboBox.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp index 8da487d..2e9c8cb 100644 --- a/CPP/Windows/Control/ComboBox.cpp +++ b/CPP/Windows/Control/ComboBox.cpp | |||
| @@ -63,4 +63,13 @@ LRESULT CComboBox::GetLBText(int index, UString &s) | |||
| 63 | } | 63 | } |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | LRESULT CComboBox::AddString_SetItemData(LPCWSTR s, LPARAM lParam) | ||
| 67 | { | ||
| 68 | const LRESULT index = AddString(s); | ||
| 69 | // NOTE: SetItemData((int)-1, lParam) works as unexpected. | ||
| 70 | if (index >= 0) // optional check, because (index < 0) is not expected for normal inputs | ||
| 71 | SetItemData((int)index, lParam); | ||
| 72 | return index; | ||
| 73 | } | ||
| 74 | |||
| 66 | }} | 75 | }} |
diff --git a/CPP/Windows/Control/ComboBox.h b/CPP/Windows/Control/ComboBox.h index 2a60b8a..224efca 100644 --- a/CPP/Windows/Control/ComboBox.h +++ b/CPP/Windows/Control/ComboBox.h | |||
| @@ -21,6 +21,8 @@ public: | |||
| 21 | LRESULT AddString(LPCWSTR s); | 21 | LRESULT AddString(LPCWSTR s); |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | LRESULT AddString_SetItemData(LPCWSTR s, LPARAM lParam); | ||
| 25 | |||
| 24 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ | 26 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ |
| 25 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } | 27 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } |
| 26 | LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } | 28 | LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } |
