File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Small Win32 programs written in C, for learning.
66| --- | --- |
77| ` hello.c ` | A message box. |
88| ` textbox.c ` | A window with a multiline edit control that follows the window size. |
9- | ` list.c ` | A list box, buttons, freehand drawing and a double-buffered window. |
9+ | ` list.c ` | A list box, buttons (also Enter and Delete) , freehand drawing and a double-buffered window. |
1010| ` shape_list.h ` | Window-free helpers for the shape list used by ` list.c ` . |
1111| ` backbuffer.h ` | GDI helpers for the off-screen buffer, shapes and repainting. |
1212
Original file line number Diff line number Diff line change @@ -103,6 +103,22 @@ int main(int argc, char **argv) {
103103 failed = 1 ;
104104 }
105105
106+ /* Delete in the list box removes the selected item like the button, and nothing without a selection */
107+ SendMessage (listBox , LB_SETCURSEL , 0 , 0 );
108+ PostMessage (listBox , WM_KEYDOWN , VK_DELETE , 0 );
109+ Sleep (300 );
110+ if (ListCount () != 2 ) {
111+ puts ("FAIL: Delete did not remove the selected item" );
112+ failed = 1 ;
113+ }
114+ SendMessage (listBox , LB_SETCURSEL , (WPARAM )- 1 , 0 );
115+ PostMessage (listBox , WM_KEYDOWN , VK_DELETE , 0 );
116+ Sleep (300 );
117+ if (ListCount () != 2 ) {
118+ puts ("FAIL: Delete without a selection removed an item" );
119+ failed = 1 ;
120+ }
121+
106122 /* a full list tells the user why Add does nothing */
107123 while (ListCount () < 100 ) {
108124 SetWindowText (edit , "item" );
You can’t perform that action at this time.
0 commit comments