X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=Ada95%2Fsamples%2Fsample-keyboard_handler.adb;h=5a671fa7e8aa9de98068c86a339ad943335713cd;hb=4a864172ab2e7d301d9db9e80fb4c617e3ed7b6e;hp=1d7a85a189980009037300aa9bb4bfba6acf276f;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1;p=ncurses.git diff --git a/Ada95/samples/sample-keyboard_handler.adb b/Ada95/samples/sample-keyboard_handler.adb index 1d7a85a1..5a671fa7 100644 --- a/Ada95/samples/sample-keyboard_handler.adb +++ b/Ada95/samples/sample-keyboard_handler.adb @@ -7,7 +7,8 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright 2020 Thomas E. Dickey -- +-- Copyright 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 -- @@ -33,10 +34,11 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ --- Author: Juergen Pfeifer 1996 +-- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.5 $ --- Binding Version 00.93 +-- $Revision: 1.17 $ +-- $Date: 2020/02/02 23:34:34 $ +-- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; @@ -69,7 +71,6 @@ package body Sample.Keyboard_Handler is function Command return Real_Key_Code; - function Command return Real_Key_Code is function My_Driver (F : Form; @@ -95,6 +96,9 @@ package body Sample.Keyboard_Handler is 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; @@ -102,13 +106,13 @@ package body Sample.Keyboard_Handler is 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)); Cmdc : String (1 .. 8); begin - Get_Buffer (Fld => FA (2), Str => Buffer); + Get_Buffer (Fld => FA.all (2), Str => Buffer); Trim (Buffer, Left); if Buffer (1) /= ' ' then Cmdc := To_Upper (Buffer (Cmdc'Range)); @@ -154,8 +158,8 @@ package body Sample.Keyboard_Handler is end if; end loop; Enum_Field := Create (Enum_Info, True); - Set_Field_Type (FA (2), Enum_Field); - Set_Background (FA (2), Normal_Video); + Set_Field_Type (FA.all (2), Enum_Field); + Set_Background (FA.all (2), Normal_Video); Fh.Drive_Me (Frm, Lines - 3, 0); Delete (Frm); @@ -171,7 +175,7 @@ package body Sample.Keyboard_Handler is 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;