修改ComboBox有前导子串时,设置选择项不匹配的问题
This commit is contained in:
parent
d8f5e635fa
commit
eb7b79621c
|
@ -102,6 +102,24 @@ bool dlg_base::get_max_size(SIZE& dst, int cx, int cy)
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
int dlg_base::select_combo_text(HWND combo, const wchar_t* text)
|
||||||
|
{
|
||||||
|
int ind = SendMessageW(combo, CB_SELECTSTRING, -1, (LPARAM)text),
|
||||||
|
ret = ind;
|
||||||
|
|
||||||
|
while (ind >= 0)
|
||||||
|
{
|
||||||
|
wchar_t buf[256] = { 0 };
|
||||||
|
GetWindowTextW(combo, buf, _countof(buf) - 1);
|
||||||
|
if (wcsicmp(buf, text) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ret = ind;
|
||||||
|
ind = SendMessageW(combo, CB_SELECTSTRING, ret, (LPARAM)text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL dlg_base::handle_message(UINT msg, WPARAM wp, LPARAM lp)
|
BOOL dlg_base::handle_message(UINT msg, WPARAM wp, LPARAM lp)
|
||||||
{
|
{
|
||||||
|
@ -821,7 +839,7 @@ void dlg_page::set_ctrl_value(HWND ctrl, SANE_Value_Type type, void* val, bool o
|
||||||
if (IS_EDIT(cls))
|
if (IS_EDIT(cls))
|
||||||
SetWindowTextW(ctrl, text.c_str());
|
SetWindowTextW(ctrl, text.c_str());
|
||||||
else
|
else
|
||||||
SendMessageW(ctrl, CB_SELECTSTRING, 0, (LPARAM)text.c_str());
|
dlg_base::select_combo_text(ctrl, text.c_str());
|
||||||
}
|
}
|
||||||
else if (IS_UPDOWN_ARROW(cls))
|
else if (IS_UPDOWN_ARROW(cls))
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
|
|
||||||
static bool get_max_size(SIZE& dst, const SIZE& src); // return whether changed dst
|
static bool get_max_size(SIZE& dst, const SIZE& src); // return whether changed dst
|
||||||
static bool get_max_size(SIZE& dst, int cx, int cy); // return whether changed dst
|
static bool get_max_size(SIZE& dst, int cx, int cy); // return whether changed dst
|
||||||
|
static int select_combo_text(HWND combo, const wchar_t* text);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_ui_event_notify(void(__stdcall* notify)(int, void*, void*), void* param);
|
void set_ui_event_notify(void(__stdcall* notify)(int, void*, void*), void* param);
|
||||||
|
|
Loading…
Reference in New Issue