1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

New function dlg_editbox_select_range.

This manipulates the selection inside an edit box, to select a
specific range of characters in the contained text. The idea is that
you can use it as a means of error highlighting, if the user has
entered something invalid in that edit box and you want to draw their
attention to the specific location of the part you're unhappy with.
This commit is contained in:
Simon Tatham
2022-06-25 13:00:06 +01:00
parent e8a8c2535d
commit 1a568e3535
3 changed files with 31 additions and 0 deletions

View File

@ -2217,6 +2217,14 @@ char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
return GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
}
void dlg_editbox_select_range(dlgcontrol *ctrl, dlgparam *dp,
size_t start, size_t len)
{
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
assert(c && c->ctrl->type == CTRL_EDITBOX);
SendDlgItemMessage(dp->hwnd, c->base_id+1, EM_SETSEL, start, start+len);
}
/* The `listbox' functions can also apply to combo boxes. */
void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp)
{