On Fri Jul 29 14:12:39 2022 +0000, Angelo Haller wrote:
I moved things around. So now the sequence is
- flush()
- comment describing the following test.
- hold_key(), keydown, etc.
The other idea I had was to replace all the code with a structure and loop over that. Something like:
struct kbd_selection_sequence { BOOL hold_shift; BOOL hold_control; UINT press_key; int selected_count; const struct message *sequence; }; struct kbd_selection_sequence sequence[] = { /* Select multiple items via SHIFT+DOWN */ {1, 0, VK_DOWN, 2, ownerdata_multiselect_select_0_to_1_odstatechanged_seq}, /* Select one item via SHIFT+UP */ {1, 0, VK_UP, 1, ownerdata_multiselect_select_0_modkey_odstatechanged_seq}, /* ... */ }; for (i = 0; i < ARRAY_SIZE(sequence); i++) { if (sequence[i].hold_shift) hold_key(VK_SHIFT); /* ... */ }
Maybe that would make things a little easier to read and possibly even repurpose for non LVS_OWNERDATA listviews?
Yeah, if you can structure them into a loop it would make it much clearer. I prefer TRUE/FALSE instead of 1/0 for BOOL. The test sequence can be marked as static const. You can also add a current key state to avoid calling hold_key() if a key is already being held.