1
2--  The procedure below shows how you can hide all the columns but one
3--  in the clist.
4--  Since Gtk_Clist prevents you to hide the last visible column, the following
5--  code does not work:
6--
7--     --  Hide all the columns
8--     for J in 0 .. Get_Columns (Clist) loop
9--        Set_Column_Visibility (Clist, J, False);
10--     end loop;
11--
12--     --  Show the one you want
13--     Set_Column_Visibility (Clist, New_Column, True);
14--
15--  The following code should be used instead:
16
17package body Clist is
18
19   procedure Hide_All_But_One (Clist : access Gtk_Clist_Record'Class;
20                               New_Column : Gint)
21   is
22   begin
23      --  Make sure that at least one column is visible
24      Set_Column_Visibility (Clist, New_Column, True);
25
26      --  Hide all the other columns.
27      for J in 0 .. Get_Columns (Clist) loop
28         if J /= New_Column then
29            Set_Column_Visibility (Clist, J, False);
30         end if;
31      end loop;
32   end Hide_All_But_One;
33
34end Clist;
35
36