TABLE OF CONTENTS


Widgets/TtkEntry [ Packages ]

[ Top ] [ Widgets ] [ Packages ]

FUNCTION

 Provides code for manipulate Tk widget Entry

SOURCE

package Tcl.Tk.Ada.Widgets.TtkEntry with
   SPARK_Mode
is
   pragma Elaborate_Body;

TtkEntry/TtkEntry.Ttk_Entry [ Types ]

[ Top ] [ TtkEntry ] [ Types ]

FUNCTION

 This is a non-abstract type derived directly from Tk_Widget.
 Each of the derived widgets redefines the Create subprogram
 in order to create the correct type of widget.

SOURCE

   type Ttk_Entry is new Tk_Widget with private;

TtkEntry/TtkEntry.BBox [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Get size of bounding box of the selected character in the selected
 Ttk_Entry

SOURCE

   function BBox
     (TextEntry: in Ttk_Entry'Class; Index: in String) return String with
      Pre => Index /= "";

PARAMETERS

 EntryWidget - Ttk_Entry which will be queried
 Index       - Index of the character which bounding box will be
 taken

RESULT

 Four values: x1, y1 - coordinates of starting point of bounding box
 from top left, x2, y2 - coordinates of ending point from bottom right
 of bounding box.

EXAMPLE

      -- Get the bouding box for the first character in My_Entry entry
      Bounding_Box: constant String := BBox(My_Entry, "0");

COMMANDS

 TextEntry bbox index

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Create_(function) [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Creates a new Ttk_Entry in the specified interpreter.

SOURCE

   overriding function Create
     (pathName: in String; options: in String := "";
      Interp: in Tcl_Interp := Null_Interp) return Ttk_Entry with
      Global => null;

PARAMETERS

 pathName - Tk path (starts with dot) for the widget
 options  - Options which will be passed to the widget. Default value is
            empty
 Interp   - Tcl interpreter to which the widget will be created. If null,
            the widget will be created in the "contextual" interpreter.
            Default value is null.

RESULT

 Newly created Ttk_Entry

EXAMPLE

   -- Create a new entry with pathname .myentry and state readonly
   My_Entry: constant Ttk_Entry := Create(".myentry", "-state readonly");

SEE ALSO

 TtkEntry.Create_(procedure)

COMMANDS

 ttk::entry pathName ?options?

HISTORY

 8.6.2 - Added

TtkEntry/TtkEntry.Create_(procedure) [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Creates a new Ttk_Entry in the specified interpreter.

SOURCE

   overriding procedure Create
     (Widgt: out Ttk_Entry; pathName: in String; options: in String := "";
      Interp: in Tcl_Interp := Null_Interp) with
      Global => null;

PARAMETERS

 Widgt    - Ttk_Entry which will be created
 pathName - Tk path (starts with dot) for the widget
 options  - Options which will be passed to the widget. Default value is
            empty
 Interp   - Tcl interpreter to which the widget will be created. If null,
            the widget will be created in the "contextual" interpreter.
            Default value is null.

OUTPUT

 Newly created Ttk_Entry as parameter Widgt

EXAMPLE

     -- Create entry My_Entry with pathname .myentry and width 10 characters on the current Tcl interpreter
     declare
        My_Entry: Ttk_Entry;
     begin
        Create(My_Entry, ".myentry", "-width 10");
     end;

SEE ALSO

 TtkEntry.Create_(function)

COMMANDS

 ttk::entry pathName ?options?

HISTORY

 8.6.2 - Added

TtkEntry/TtkEntry.Delete [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Delete part of text from the selected entry

SOURCE

   procedure Delete
     (TextEntry: in Ttk_Entry; FirstIndex: in String;
      LastIndex: in String := "") with
      Pre'Class => FirstIndex /= "";

PARAMETERS

 TextEntry  - Ttk_Entry in which text will be deleted
 FirstIndex - Index of text from which delete will start. Index starts from 0
 LastIndex  - End index to which text will be deleted. If empty, delete only one
              character. Default is empty.

EXAMPLE

      -- Delete the whole text of My_Entry entry
      Delete(My_Entry, "0", "end");

COMMANDS

 TextEntry delete first ?last?

HISTORY

 8.6.3 - Added

TtkEntry/TtkEntry.Get [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Get entry's text.

SOURCE

   function Get(Widgt: in Ttk_Entry) return String;

PARAMETERS

 Widgt - Ttk_Entry from which text will be taken

RESULT

 Returns the entry's string.

EXAMPLE

      -- Get the text of My_Entry entry
      Text: constant String := Get(My_Entry);

COMMANDS

 Widgt get

HISTORY

 8.6.2 - Added

TtkEntry/TtkEntry.Get_Widget [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Get the existing Ttk_Entry widget

SOURCE

   overriding function Get_Widget
     (pathName: in String; Interp: in Tcl_Interp := Get_Context)
      return Ttk_Entry with
      Global => null;

PARAMETERS

 pathName - Tk path (starts with dot) for the widget
 Interp   - Tcl interpreter on which the widget exists. Can be empty.
            Default value is current Tcl interpreter

RESULT

 Existing Ttk_Entry widget

EXAMPLE

     -- Get entry widget with name .myentry on the current Tcl interpreter
     My_Entry: constant Ttk_Entry := Get_Widget(".myentry");

HISTORY

 8.6.9 - Added

TtkEntry/TtkEntry.ICursor [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Place insertion cursor in the selected Ttk_Entry just before the
 selected character

SOURCE

   procedure ICursor(TextEntry: in Ttk_Entry'Class; Index: in String) with
      Pre => Index /= "";

PARAMETERS

 TextEntry - Ttk_Entry in which insertion cursor will be placed
 Index     - Index of the character before which insertion cursor will be
             placed

EXAMPLE

   -- Place insertion cursor at the end of My_Entry entry
   ICursor(My_Entry, "end");

COMMANDS

 TextEntry icursor index

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Index [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Get numerical index of character from the selected Index

SOURCE

   function Index
     (TextEntry: in Ttk_Entry'Class; Index: in String) return String with
      Pre => Index /= "";

PARAMETERS

 TextEntry - Ttk_Entry which will be queried for index
 Index     - Index of character which numeric index will be taken

RESULT

 Numerical index of the selected character

EXAMPLE

      -- Get the index of the last character in My_Entry entry
      Character_Index: constant String := Index(My_Entry, "end");

COMMANDS

 TextEntry index index

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Insert [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Insert text at selected index to the selected Ttk_Entry

SOURCE

   procedure Insert
     (TextEntry: in Ttk_Entry; Index: in String; Text: in String) with
      Pre'Class => Index /= "" and Text /= "";

PARAMETERS

 TextEntry - Ttk_Entry to which text will be inserted
 Index     - Index in which position text will be inserted
 Text      - Text to insert

EXAMPLE

      -- Insert hello world text at start of My_Entry entry
      Insert(My_Entry, "0", "{hello world}");

COMMANDS

 TextEntry insert index text

HISTORY

 8.6.3 - Added

TtkEntry/TtkEntry.Selection_Clear [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Remove the selection from the selected Ttk_Entry

SOURCE

   procedure Selection_Clear(TextEntry: in Ttk_Entry'Class);

PARAMETERS

 TextEntry - Ttk_Entry in which the selection will be cleared

EXAMPLE

      -- Remove selection from My_Entry entry
      Selection_Clear(My_Entry);

COMMANDS

 TextEntry selection clear

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Selection_Present [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Check if any character is selected in the selected Ttk_Entry

SOURCE

   function Selection_Present(TextEntry: in Ttk_Entry'Class) return String;

PARAMETERS

 TextEntry - Ttk_Entry which will be queried for the selection

RESULT

 "1" if any character in TextEntry is selected, otherwise "0"

EXAMPLE

   -- Check if something is selected in My_Entry entry
   Check_Selection: constant String := Selection_Present(My_Entry);

COMMANDS

 TextEntry selection present

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Selection_Range [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Set the characters selection in the selected Ttk_Entry

SOURCE

   procedure Selection_Range
     (TextEntry: in Ttk_Entry'Class; StartIndex, EndIndex: in String) with
      Pre => StartIndex /= "" and EndIndex /= "";

PARAMETERS

 TextEntry  - Ttk_Entry in which the selection will be set
 StartIndex - Start index of character of the selection
 EndIndex   - End index of character of the selection

EXAMPLE

   -- Select the whole text of My_Entry entry
   Selection_Range(My_Entry, "0", "end");

COMMANDS

 TextEntry selection range startindex endindex

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Validate [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Force the Ttk_Entry to revalidate its value

SOURCE

   function Validate(TextEntry: in Ttk_Entry'Class) return String;

PARAMETERS

 TextEntry - Ttk_Entry which value will be validated

RESULT

 "1" if value of TextEntry is valid, otherwise "0"

EXAMPLE

      -- Revalidate My_Entry entry value
      Valid: constant String := Validate(My_Entry);

COMMANDS

 TextEntry validate

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.XView_(function) [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Get which horizontal fraction of the Ttk_Entry is visible

SOURCE

   function XView(TextEntry: in Ttk_Entry'Class) return String;

PARAMETERS

 TextEntry - Ttk_Entry which will be queried for visibility

RESULT

 Pair of elements: first element is the start of horizontal fraction of
 the TextEntry which is visible, second is the end of horizontal
 fraction of the TextEntry which is visible.

EXAMPLE

   -- Get the horizontal fraction of the My_Entry entry
   Horizontal_Fraction: constant String := XView(My_Entry);

SEE ALSO

 TtkEntry.XView_(procedure)

COMMANDS

 TextEntry xview

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.XView_(procedure) [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Adjusts the view in the window so that the character position given by
 index is displayed at the left edge of the window

SOURCE

   procedure XView(TextEntry: in Ttk_Entry'Class; Index: in String) with
      Pre => Index /= "";

PARAMETERS

 TextEntry - Ttk_Entry which will be adjusted
 Index     - Character index to which TextEntry will be adjusted.
             Character position starts from 0

EXAMPLE

   -- Set view of My_Entry entry to second character
   XView(My_Entry, "1");

SEE ALSO

 TtkEntry.XView_(function)

COMMANDS

 TextEntry xview index

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Xview_Move_To [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Adjusts the view in the window so that fraction of the total width of
 the Ttk_Entry is off-screen to the left.

SOURCE

   procedure Xview_Move_To
     (TextEntry: in Ttk_Entry'Class; Fraction: in String) with
      Pre => Fraction /= "";

PARAMETERS

 TextEntry - Ttk_Entry which view will be adjusted
 Fraction  - Fraction of the TextEntry to move. Must be between 0
             and 1

EXAMPLE

      -- Show the first half of the entry My_Entry
      Xview_Move_To(My_Entry, "0.5");

COMMANDS

 TextEntry xview moveto fraction

HISTORY

 8.6.5 - Added

TtkEntry/TtkEntry.Xview_Scroll [ Subprograms ]

[ Top ] [ TtkEntry ] [ Subprograms ]

FUNCTION

 Shift the view in the window on left or right according to Number and
 What.

SOURCE

   procedure Xview_Scroll
     (TextEntry: in Ttk_Entry'Class; Number, What: in String) with
      Pre => Number /= "" and (What = "units" or What = "pages");

PARAMETERS

 TextEntry - Ttk_Entry which view will be shifted
 Number    - The amount of What to shift the TextEntry
 What      - Type of amount to move. Can be "units" or "pages"

EXAMPLE

      -- Move the view in the My_Entry entry by 10 units to right
      Xview_Scroll(My_Entry, "10", "units");

COMMANDS

 TextEntry xview scroll number what

HISTORY

 8.6.5 - Added