]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/samples/sample-menu_demo.adb
ncurses 5.9 - patch 20140426
[ncurses.git] / Ada95 / samples / sample-menu_demo.adb
index a0ebf6952e144fbb99787f976272485917c02133..80cd94b1d4e5f286b27dd486901b7d30a5d930fd 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 1998 Free Software Foundation, Inc.                        --
+-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              --
 --                                                                          --
 -- Permission is hereby granted, free of charge, to any person obtaining a  --
 -- copy of this software and associated documentation files (the            --
@@ -35,7 +35,8 @@
 ------------------------------------------------------------------------------
 --  Author:  Juergen Pfeifer, 1996
 --  Version Control
---  $Revision: 1.13 $
+--  $Revision: 1.19 $
+--  $Date: 2011/03/23 00:44:12 $
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
@@ -105,6 +106,12 @@ package body Sample.Menu_Demo is
                              P : Panel) return Boolean
          is
          begin
+            if M = Null_Menu then
+               raise Menu_Exception;
+            end if;
+            if P = Null_Panel then
+               raise Panel_Exception;
+            end if;
             To_Change := No_Change;
             if K in User_Key_Code'Range then
                if K = QUIT then
@@ -147,7 +154,7 @@ package body Sample.Menu_Demo is
                         O : Item_Option_Set;
                      begin
                         for J in I'Range loop
-                           Get_Options (I (J), O);
+                           Get_Options (I.all (J), O);
                            O.Selectable := True;
                            if Hide_Long then
                               case J is
@@ -156,7 +163,7 @@ package body Sample.Menu_Demo is
                                  when others => null;
                               end case;
                            end if;
-                           Set_Options (I (J), O);
+                           Set_Options (I.all (J), O);
                         end loop;
                      end;
                      return False;
@@ -297,7 +304,6 @@ package body Sample.Menu_Demo is
             end if;
          end loop;
          Set_Spacing (M);
-         Flip_State := True;
 
          Pop_Environment;
          pragma Assert (Get_Index (Items (M, 1)) = Get_Index (I (1)));
@@ -331,9 +337,9 @@ package body Sample.Menu_Demo is
          Null_Item);
       M : Menu := New_Menu (Itm);
 
-      U1 : User_Data_Access := new User_Data'(4711);
+      U1 : constant User_Data_Access := new User_Data'(4711);
       U2 : User_Data_Access;
-      U3 : User_Data_Access := new User_Data'(4712);
+      U3 : constant User_Data_Access := new User_Data'(4712);
       U4 : User_Data_Access;
 
       function My_Driver (M : Menu;
@@ -372,14 +378,14 @@ package body Sample.Menu_Demo is
       Set_Pad_Character (M, '|');
 
       MUD.Set_User_Data (M, U1);
-      IUD.Set_User_Data (Itm (1), U3);
+      IUD.Set_User_Data (Itm.all (1), U3);
 
       Mh.Drive_Me (M);
 
       MUD.Get_User_Data (M, U2);
       pragma Assert (U1 = U2 and U1.all = 4711);
 
-      IUD.Get_User_Data (Itm (1), U4);
+      IUD.Get_User_Data (Itm.all (1), U4);
       pragma Assert (U3 = U4 and U3.all = 4712);
 
       Pop_Environment;