]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/samples/ncurses2-demo_forms.adb
ncurses 6.4 - patch 20240414
[ncurses.git] / Ada95 / samples / ncurses2-demo_forms.adb
index 2cc99daef1eae81652e497b00b49a91a938f77e6..b2d72ba4c6f3fcbea61ae2c2691dbab3262e435f 100644 (file)
@@ -7,7 +7,8 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 2000,2004 Free Software Foundation, Inc.                   --
+-- Copyright 2020,2021 Thomas E. Dickey                                     --
+-- Copyright 2000-2011,2014 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            --
 --                                                                          --
 -- Permission is hereby granted, free of charge, to any person obtaining a  --
 -- copy of this software and associated documentation files (the            --
@@ -35,8 +36,8 @@
 ------------------------------------------------------------------------------
 --  Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
 --  Version Control
 ------------------------------------------------------------------------------
 --  Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
 --  Version Control
---  $Revision: 1.4 $
---  $Date: 2004/08/21 21:37:00 $
+--  $Revision: 1.9 $
+--  $Date: 2021/09/04 10:52:55 $
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with ncurses2.util; use ncurses2.util;
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with ncurses2.util; use ncurses2.util;
@@ -317,8 +318,9 @@ procedure ncurses2.demo_forms is
    function my_form_driver (f : Form; c : Key_Code) return Boolean is
       flag : constant Driver_Result := Driver (f, F_Validate_Field);
    begin
    function my_form_driver (f : Form; c : Key_Code) return Boolean is
       flag : constant Driver_Result := Driver (f, F_Validate_Field);
    begin
-      if c = Form_Request_Code'Last + 1
-        and flag = Form_Ok then
+      if c = Form_Request_Code'Last + 1 and
+         flag = Form_Ok
+      then
          return True;
       else
          Beep;
          return True;
       else
          Beep;
@@ -379,7 +381,7 @@ procedure ncurses2.demo_forms is
          Set_KeyPad_Mode (w, True);
       end if;
 
          Set_KeyPad_Mode (w, True);
       end if;
 
-      --  TODO if Post(f) /= Form_Ok then it's a procedure
+      --  TODO if Post(f) /= Form_Ok then it is a procedure
       declare
       begin
          Post (f);
       declare
       begin
          Post (f);
@@ -416,7 +418,7 @@ procedure ncurses2.demo_forms is
    end erase_form;
 
    finished : Boolean := False;
    end erase_form;
 
    finished : Boolean := False;
-   f : Field_Array_Access := new Field_Array (1 .. 12);
+   f : constant Field_Array_Access := new Field_Array (1 .. 12);
    secure : Field;
    myform : Form;
    w : Window;
    secure : Field;
    myform : Form;
    w : Window;
@@ -451,19 +453,19 @@ begin
    Refresh;
 
    --  describe the form
    Refresh;
 
    --  describe the form
-   f (1) := make_label (0, 15, "Sample Form");
-   f (2) := make_label (2, 0, "Last Name");
-   f (3) := make_field (3, 0, 1, 18, False);
-   f (4) := make_label (2, 20, "First Name");
-   f (5) := make_field (3, 20, 1, 12, False);
-   f (6) := make_label (2, 34, "Middle Name");
-   f (7) := make_field (3, 34, 1, 12, False);
-   f (8) := make_label (5, 0, "Comments");
-   f (9) := make_field (6, 0, 4, 46, False);
-   f (10) := make_label (5, 20, "Password:");
-   f (11) := make_field (5, 30, 1, 9, True);
-   secure := f (11);
-   f (12) := Null_Field;
+   f.all (1) := make_label (0, 15, "Sample Form");
+   f.all (2) := make_label (2, 0, "Last Name");
+   f.all (3) := make_field (3, 0, 1, 18, False);
+   f.all (4) := make_label (2, 20, "First Name");
+   f.all (5) := make_field (3, 20, 1, 12, False);
+   f.all (6) := make_label (2, 34, "Middle Name");
+   f.all (7) := make_field (3, 34, 1, 12, False);
+   f.all (8) := make_label (5, 0, "Comments");
+   f.all (9) := make_field (6, 0, 4, 46, False);
+   f.all (10) := make_label (5, 20, "Password:");
+   f.all (11) := make_field (5, 30, 1, 9, True);
+   secure := f.all (11);
+   f.all (12) := Null_Field;
 
    myform := New_Form (f);
 
 
    myform := New_Form (f);