with Main_Window;
with The_Other_Window;
with Mcc.Common_Dialogs;
with Mcc.Gui.Widget.Text_Entry;
with Mcc.Gui.Widget.Button.Radio;
package body Main_Callback is

   -------------------
   -- display_other --
   -------------------

   procedure Display_Other(Obj : in out mcc.gui.widget.button.button'class) is
   begin
      The_Other_Window.Generate_Window;
   end Display_Other;

   --------------
   -- go_rapid --
   --------------

   procedure Go_Rapid(Obj : in out mcc.gui.widget.button.button'class) is
      Selected : Mcc.Gui.Widget.Button.Radio.Radio_Pointer;
      Result : Integer;
      type enum is (tom,fred,mary);
      Enum_Value : enum;
      use type Mcc.Gui.Widget.Button.Radio.Radio_Pointer;
   begin
      Result := Mcc.Gui.Widget.Text_Entry.Get_Text(
         Obj => Main_Window.My_Entry);

      Selected := Mcc.Gui.Widget.Button.Radio.Get_Selected(
         Main_Window.Group);

      if Selected = Main_Window.Tom'Access then
         Enum_Value := tom;
      elsif Selected = Main_Window.Fred'Access then
         Enum_Value := fred;
      else
         Enum_Value := mary;
      end if;

      Mcc.Common_Dialogs.Ok_Box(
         "Value was" &
         Enum'Image(Enum_Value) &
         integer'image(result));
   exception
      when others =>
         Mcc.Common_Dialogs.OK_Box(
            "exception");
         Mcc.Gui.Widget.Text_Entry.Set_Text(
            Obj  => Main_Window.My_Entry,
            Text => "Enter a number");
         Mcc.Gui.Widget.Text_Entry.Highlight(
            Obj  => Main_Window.My_Entry);
   end Go_Rapid;

end Main_Callback;
