]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/samples/sample-keyboard_handler.adb
ncurses 5.8 - patch 20110319
[ncurses.git] / Ada95 / samples / sample-keyboard_handler.adb
index 92b9ccd4635d3d951bba9643dfa3debb0866f558..da61051c3b9b1bf40d5853039cbcfd34969e8145 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 1998 Free Software Foundation, Inc.                        --
+-- Copyright (c) 1998-2006,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            --
 --                                                                          --
 -- Permission is hereby granted, free of charge, to any person obtaining a  --
 -- copy of this software and associated documentation files (the            --
@@ -34,9 +34,9 @@
 -- authorization.                                                           --
 ------------------------------------------------------------------------------
 --  Author:  Juergen Pfeifer, 1996
 -- authorization.                                                           --
 ------------------------------------------------------------------------------
 --  Author:  Juergen Pfeifer, 1996
---  Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
 --  Version Control
 --  Version Control
---  $Revision: 1.8 $
+--  $Revision: 1.15 $
+--  $Date: 2011/03/19 12:09:02 $
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with Ada.Strings; use Ada.Strings;
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with Ada.Strings; use Ada.Strings;
@@ -70,7 +70,6 @@ package body Sample.Keyboard_Handler is
 
       function Command return Real_Key_Code;
 
 
       function Command return Real_Key_Code;
 
-
       function Command return Real_Key_Code
       is
          function My_Driver (F : Form;
       function Command return Real_Key_Code
       is
          function My_Driver (F : Form;
@@ -96,6 +95,9 @@ package body Sample.Keyboard_Handler is
          is
             Ch : Character;
          begin
          is
             Ch : Character;
          begin
+            if P = Null_Panel then
+               raise Panel_Exception;
+            end if;
             if C in User_Key_Code'Range and then C = QUIT then
                if Driver (F, F_Validate_Field) = Form_Ok  then
                   K := Key_None;
             if C in User_Key_Code'Range and then C = QUIT then
                if Driver (F, F_Validate_Field) = Form_Ok  then
                   K := Key_None;
@@ -103,7 +105,7 @@ package body Sample.Keyboard_Handler is
                end if;
             elsif C in Normal_Key_Code'Range then
                Ch := Character'Val (C);
                end if;
             elsif C in Normal_Key_Code'Range then
                Ch := Character'Val (C);
-               if (Ch = LF or else Ch = CR) then
+               if Ch = LF or else Ch = CR then
                   if Driver (F, F_Validate_Field) = Form_Ok  then
                      declare
                         Buffer : String (1 .. Positive (Columns - 11));
                   if Driver (F, F_Validate_Field) = Form_Ok  then
                      declare
                         Buffer : String (1 .. Positive (Columns - 11));
@@ -172,7 +174,7 @@ package body Sample.Keyboard_Handler is
       Set_Timeout_Mode (Win, Delayed, 30000);
       loop
          K := Get_Keystroke (Win);
       Set_Timeout_Mode (Win, Delayed, 30000);
       loop
          K := Get_Keystroke (Win);
-         if K = Key_None then  -- a timeout occured
+         if K = Key_None then  -- a timeout occurred
             Update_Header_Window;
          elsif K = 3 and then not In_Command  then  -- CTRL-C
             K := Command;
             Update_Header_Window;
          elsif K = 3 and then not In_Command  then  -- CTRL-C
             K := Command;