File: clist.adb

package info (click to toggle)
libgtkada 2.24.4dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,208 kB
  • ctags: 1,676
  • sloc: ada: 119,686; ansic: 4,719; sh: 3,003; makefile: 690; xml: 338; perl: 70
file content (35 lines) | stat: -rw-r--r-- 996 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

--  The procedure below shows how you can hide all the columns but one
--  in the clist.
--  Since Gtk_Clist prevents you to hide the last visible column, the following
--  code does not work:
--
--     --  Hide all the columns
--     for J in 0 .. Get_Columns (Clist) loop
--        Set_Column_Visibility (Clist, J, False);
--     end loop;
--
--     --  Show the one you want
--     Set_Column_Visibility (Clist, New_Column, True);
--
--  The following code should be used instead:

package body Clist is

   procedure Hide_All_But_One (Clist : access Gtk_Clist_Record'Class;
                               New_Column : Gint)
   is
   begin
      --  Make sure that at least one column is visible
      Set_Column_Visibility (Clist, New_Column, True);

      --  Hide all the other columns.
      for J in 0 .. Get_Columns (Clist) loop
         if J /= New_Column then
            Set_Column_Visibility (Clist, J, False);
         end if;
      end loop;
   end Hide_All_But_One;

end Clist;