1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding Samples --
5 -- Sample.Form_Demo.Handler --
11 -- The ncurses Ada95 binding is copyrighted 1996 by --
12 -- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
14 -- Permission is hereby granted to reproduce and distribute this --
15 -- binding by any means and for any fee, whether alone or as part --
16 -- of a larger distribution, in source or in binary form, PROVIDED --
17 -- this notice is included with any such distribution, and is not --
18 -- removed from any of its header files. Mention of ncurses and the --
19 -- author of this binding in any applications linked with it is --
20 -- highly appreciated. --
22 -- This binding comes AS IS with no warranty, implied or expressed. --
23 ------------------------------------------------------------------------------
26 ------------------------------------------------------------------------------
27 with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
28 with Sample.Form_Demo.Aux;
29 with Sample.Explanation; use Sample.Explanation;
31 package body Sample.Form_Demo.Handler is
33 package Aux renames Sample.Form_Demo.Aux;
35 procedure Drive_Me (F : in Form;
36 Title : in String := "")
43 Aux.Geometry (F, L, C, Y, X);
44 Drive_Me (F, Y, X, Title);
47 procedure Drive_Me (F : in Form;
48 Lin : in Line_Position;
49 Col : in Column_Position;
50 Title : in String := "")
52 Pan : Panel := Aux.Create (F, Title, Lin, Col);
53 V : Cursor_Visibility := Normal;
54 Handle_CRLF : Boolean := True;
57 Set_Cursor_Visibility (V);
58 if Aux.Count_Active (F) = 1 then
63 K : Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF);
66 if (K = 13 or else K = 10) and then not Handle_CRLF then
73 when Unknown_Request =>
74 if My_Driver (F, K, Pan) then
81 Set_Cursor_Visibility (V);
85 end Sample.Form_Demo.Handler;