Overview of Ada GUI
Overview of Ada GUI
begin -- G_Click checks of handling them all from the same set of callbacks.
Output.Set_Text There is no need to worry about when or how frequently
(Text => "Greetings"); events occur.
end G_Click;
Widgets are created by functions that return the ID of the
procedure H_Click is new widget. Operations take the ID of the widget to act on,
-- Empty with heavy use of preconditions to make sure that
begin -- H_Click operations are not applied to inappropriate widgets. Events
Output.Set_Text (Text => "Hello"); from the event queue contain the ID of the widget that
end H_Click; generated the event.
with Ada_GUI;
procedure Luhn_Gen is
Input : Ada_GUI.Widget_ID;
Err : Ada_GUI.Widget_ID;
Checksum : Ada_GUI.Widget_ID;
Gen : Ada_GUI.Widget_ID;
Quit : Ada_GUI.Widget_ID;
procedure Generate;
-- Obtain input from the GUI and
-- calculate the checksum
procedure Generate is
subtype Digit is Character range '0' .. '9';
return Result;
end Reversed;
end if;
end loop All_Chars;
Sum : Natural := 0;
D : Natural;
begin -- Generate
Err.Set_Text (Text => "");
Err.Set_Visibility (Visible => False);
Checksum.Set_Text (Text => "");
if Value'Length = 0 then
Err.Set_Visibility (Visible => True);
Err.Set_Text (Text => Err_Msg);
return;
end if;
if I rem 2 = 1 then
D := 2 * D;
if D > 9 then
D := D - 9;
end if;
end if;
Sum := Sum + D;
end loop All_Digits;
Event : Ada_GUI.Next_Result_Info;
All_Events : loop
Event := Ada_GUI.Next_Event;
Ada_GUI.End_GUI;
exception -- Luhn_Gen
when E : others =>
Ada.Text_IO.Put_Line (Item => Ada.Exceptions.Exception_Information (E) );
end Luhn_Gen;