====== Adding Expand All and Collapse All Functionality ====== The next step is to add "Expand All" and "Collapse All" functionality, to be able to expand or collapse the outline. To do this: * Add a button control to the form called B_EXPAND and type Expand All in the [[text|Text property]]. Code the same QuickEvent parameters for the CLICK event (calling [[the_test_lb|TEST_LB()]] with '@SELF','CLICK') as for the B_POPULATE button in the previous step. * Add another button control called B_COLLAPSE, and type Collapse All in the Text property. Code the same QuickEvent call as for B_EXPAND. * Add the following code to [[the_test_lb|TEST_LB()]]. The code consists of additional [[case|CASE statements]] that detect which control is calling the function, and then sending the expand or collapse message to the list box. * expand the entire list (in this case there are a total of 3 levels) case ctrlName = 'B_EXPAND' Send_Message(WinId: '.LB_H', 'EXPAND', 0, 3) *collapse the entire list to the first level case ctrlName = 'B_COLLAPSE' Send_Message(WinId: '.LB_H', 'EXPAND', 0, 1) The buttons should expand or collapse the outline when clicked.