TABLE OF CONTENTS


TkAda/Dialogs [ Packages ]

[ Top ] [ TkAda ] [ Packages ]

FUNCTION

 Provides code for manipulate Tk dialogs widgets

SOURCE

package Tcl.Tk.Ada.Dialogs with
   SPARK_Mode
is

Dialogs/Dialogs.DialogButtons [ Types ]

[ Top ] [ Dialogs ] [ Types ]

FUNCTION

 Array used to set buttons in dialogs

SOURCE

   type DialogButtons is array(Positive range <>) of Unbounded_String;

HISTORY

 8.6.1 - Added

Dialogs/Dialogs.Choose_Color [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create dialog which allow the user select color.

SOURCE

   function Choose_Color(Options: in String := "") return String;

PARAMETERS

 Options - Tk options which will be passed to the dialog. Default value
           is empty string

RESULT

 Name of selected color or empty string if color was not selected

EXAMPLE

   -- Get the name of the color from dialog created with title Color and
   -- with main window as a parent
   Color: constant String := Choose_Color("-title {Color} -parent .");

COMMANDS

 tk_chooseColor options

HISTORY

 8.6.6 - Added

Dialogs/Dialogs.Choose_Directory [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create dialog which allow the user select directory.

SOURCE

   function Choose_Directory(Options: in String := "") return String;

PARAMETERS

 Options - Tk options which will be passed to the dialog. Default value
           is empty string

RESULT

 Name of selected directory or empty string if directory was not selected

EXAMPLE

   -- Get the name of the selected directory which must exists and dialog
   -- has title Choose Directory and it parent is a main window
   Directory_Name : constant String := Choose_Directory("-mustexists true -title {Choose Directory} -parent .");

COMMANDS

 tk_chooseDirectory options

HISTORY

 8.6.1 - Added

Dialogs/Dialogs.Dialog_(function) [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create the dialog from selected Tk_Toplevel widget. This function is not
 allowed in SPARK. use Dialogs.Dialog_(procedure) instead.

SOURCE

   function Dialog
     (Widget: in out Tk_Toplevel; Title, Text, Bitmap: in String;
      Default: in Integer; Buttons: in DialogButtons) return Integer with
      SPARK_Mode => Off,
      Pre =>
      (Title /= "" and Text /= "" and Bitmap /= "" and
       Default <= Buttons'Length);

PARAMETERS

 Widget  - Tk_Toplevel widget which will be used as the dialog.
 Title   - Title of the dialog
 Text    - Text to display in the dialog
 Bitmap  - Tk bitmap name to show in dialog
 Default - Default button in dialog. Buttons counts from 0. If less than
           0 no button will be set as default.
 Buttons - Array with text to show on buttons. One element is one button

RESULT

 Index of button which was clicked or -1 if no button was clicked.

OUTPUT

 Parameter Widget as a newly created dialog

EXAMPLE

   -- Create dialog from My_Dialog widget with title MyDialog, text My
   -- Dialog Text, bitmap question, default first button and buttons
   -- Yes and No
   Buttons: constant DialogButtons := array(To_Unbounded_String("Yes"), To_Unbounded_String("No"));
   Response: constant String := Dialog(My_Dialog, "MyDialog", "{My Dialog Text}", "question", 0, Buttons);

SEE ALSO

 Dialogs.Dialog_(procedure)

COMMANDS

 tk_dialog window title text bitmap default string string

HISTORY

 8.6.1 - Added

Dialogs/Dialogs.Dialog_(procedure) [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create the dialog from selected Tk_Toplevel widget.

SOURCE

   procedure Dialog
     (Widget: in out Tk_Toplevel; Title, Text, Bitmap: in String;
      Default: in Integer; Buttons: in DialogButtons;
      ButtonPressed: out Integer) with
      Pre =>
      (Title /= "" and Text /= "" and Bitmap /= "" and
       Default <= Buttons'Length);

PARAMETERS

 Widget  - Tk_Toplevel widget which will be used as the dialog.
 Title   - Title of the dialog
 Text    - Text to display in the dialog
 Bitmap  - Tk bitmap name to show in dialog
 Default - Default button in dialog. Buttons counts from 0. If less than
           0 no button will be set as default.
 Buttons - Array with text to show on buttons. One element is one button

OUTPUT

 Parameter Widget as a newly created dialog and ButtonPressed as a Index
 of the buton which was clicked or -1 if no button was clicked

EXAMPLE

      -- Create dialog from My_Dialog widget with title MyDialog, text My
      -- Dialog Text, bitmap question, default first button and buttons
      -- Yes and No
      Buttons: constant DialogButtons := array(To_Unbounded_String("Yes"), To_Unbounded_String("No"));
      Result: Integer;
      Dialog(My_Dialog, "MyDialog", "{My Dialog Text}", "question", 0, Buttons, Result);

SEE ALSO

 Dialogs.Dialog_(function)

COMMANDS

 tk_dialog window title text bitmap default string string

HISTORY

 8.6.12 - Added

Dialogs/Dialogs.FontChooser_Configure_(function) [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Get the selected option value or values of all options for the font
 chooser dialog

SOURCE

   function FontChooser_Configure(Option: in String := "") return String;

PARAMETERS

 Option - Name of the font chooser option to get. Can be empty. Default
          value is empty

RESULT

 Value for the selected option or list of pairs name value of all
 available options

EXAMPLE

      -- Check if fontchooser dialog is visible
      if FontChooser_Configure("-visible") then
      -- Get the all available options for fontchooser dialog
      Options: constant String := FontChooser_Configure;

SEE ALSO

 Dialogs.FontChooser_Configure_(procedure)

COMMANDS

 tk fontchooser configure ?-option?

HISTORY

 8.6.6 - Added

Dialogs/Dialogs.FontChooser_Configure_(procedure) [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Set the selected option for the font chooser dialog

SOURCE

   procedure FontChooser_Configure(Options: in String) with
      Pre => Options /= "";

PARAMETERS

 Options - Tk font chooser options with values to set

EXAMPLE

      -- Set a main window as parent and title Choose Font for the
      -- font chooser
      FontChooser_Configure("-parent . -title {Choose Font}");

SEE ALSO

 Dialogs.FontChooser_Configure_(function)

COMMANDS

 tk fontchooser configure -option value -option value ...

HISTORY

 8.6.6 - Added

Dialogs/Dialogs.FontChooser_Hide [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Hide the font chooser dialog

SOURCE

   procedure FontChooser_Hide;

EXAMPLE

   -- Hide fontchooser dialog
   FontChooser_Hide;

COMMANDS

 tk fontchooser hide

HISTORY

 8.6.6 - Added

Dialogs/Dialogs.FontChooser_Show [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the font chooser dialog

SOURCE

   procedure FontChooser_Show;

EXAMPLE

   -- Show fontchooser dialog
   FontChooser_Show;

COMMANDS

 tk fontchooser show

HISTORY

 8.6.6 - Added

Dialogs/Dialogs.Get_Open_File [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create dialog which allow the user select file to open.

SOURCE

   function Get_Open_File(Options: in String := "") return String;

PARAMETERS

 Options - Tk options which will be passed to the dialog. Default value
           is empty string

RESULT

 Name of selected file or empty string if no file was selected

EXAMPLE

   -- Get the name of the selected file from dialog which parent is set to
   -- a main window, title to Open File and initial dir to current directory
   File_Name: constant String := Get_Open_File("-parent . -title {Open File} -initialdir .");

COMMANDS

 tk_getOpenFile ?option value ...?

HISTORY

 8.6.1 - Added

Dialogs/Dialogs.Get_Save_File [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create dialog which allow the user select file to save.

SOURCE

   function Get_Save_File(Options: in String := "") return String;

PARAMETERS

 Options - Tk options which will be passed to the dialog. Default value
           is empty string

RESULT

 Name of selected file or empty string if no file was selected

EXAMPLE

   -- Get the name of the selected file from dialog which parent is set to
   -- a main window, title to Save File As and confirm overwrite an
   -- existing file
   File_Name: constant String := Get_Save_File("-parent . -title {Sve File As} -confirmoverwrite true");

COMMANDS

 tk_getSaveFile ?option value ...?

HISTORY

 8.6.1 - Added

Dialogs/Dialogs.MessageBox [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create message window and show it to user

SOURCE

   function MessageBox(Options: in String := "") return String;

PARAMETERS

 Options - Tk options which will be passed to the dialog. Default value
           is empty string

RESULT

 Symbolic name of the clicked button

EXAMPLE

   -- Show dialog with a main window as parent, text Hello, icon info and
   -- button Ok
   Answer := constant String := MessageBox("-parent . -message {Hello} -icon info -type ok");

COMMANDS

 tk_messageBox ?option value ...?

HISTORY

 8.6.1 - Added