TABLE OF CONTENTS
- 1. Table/Table
- 1.1. Table/Table.Headers_Array
- 1.2. Table/Table.Width_Array
- 1.3. Table/Table.Table_Widget
- 1.4. Table/Table.Empty_Table
- 1.5. Table/Table.No_Headers
- 1.6. Table/Table.No_Width_Array
- 1.7. Table/Tabel.Add_Commands
- 1.8. Table/Table.Add_Button
- 1.9. Table/Table.Add_Check_Button
- 1.10. Table/Table.Add_Pagination
- 1.11. Table/Table.Add_Progress_Bar
- 1.12. Table/Table.Clear_Table
- 1.13. Table/Table.Create_Table
- 1.14. Table/Table.Get_Column_Number
- 1.15. Table/Table.Is_Checked
- 1.16. Table/Table.Toggle_Checked_Button
- 1.17. Table/Table.Update_Headers_Command
- 1.18. Table/Table.Update_Table
Table/Table [ Packages ]
FUNCTION
Provides code for create and manipulate more advanced table widget
SOURCE
package Table is
Table/Table.Headers_Array [ Types ]
FUNCTION
Used to store the titles for columns in the selected table
SOURCE
type Headers_Array is array(Positive range <>) of Unbounded_String;
Table/Table.Width_Array [ Types ]
FUNCTION
Used to store width of Table_Widget columns
SOURCE
type Width_Array is array(Positive range <>) of Positive;
Table/Table.Table_Widget [ Records ]
FUNCTION
Store data for each created table
SOURCE
type Table_Widget(Amount: Positive) is record Canvas: Tk_Canvas; Columns_Width: Width_Array(1 .. Amount) := (others => 1); Row: Positive := 1; Row_Height: Positive := 1; Scrollbar: Ttk_Scrollbar; end record;
PARAMETERS
Canvas - Tk_Canvas which is used as table Columns_Width - The array with the width for each column in the table Row - The current row of the table Row_Height - The height of each row Scrollbar - The vertical Ttk_Scrollbar associated with the table
Table/Table.Empty_Table [ Constants ]
[ Top ] [ Table ] [ Constants ]
FUNCTION
Empty table widget with default values and one column
SOURCE
Empty_Table: constant Table_Widget := (Amount => 1, others => <>);
Table/Table.No_Headers [ Constants ]
[ Top ] [ Table ] [ Constants ]
FUNCTION
Array of headers with one empty header
SOURCE
No_Headers: constant Headers_Array := (1 => Null_Unbounded_String);
Table/Table.No_Width_Array [ Constants ]
[ Top ] [ Table ] [ Constants ]
FUNCTION
Empty table width array
SOURCE
No_Width_Array: constant Width_Array := (1 => 1);
Table/Tabel.Add_Commands [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Add Tcl commands related to the Table_Widget
SOURCE
procedure Add_Commands with Import => True, Convention => C, External_Name => "addAdaTableCommands";
HISTORY
6.6 - Added 7.1 - Renamed to Add_Commands
Table/Table.Add_Button [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Add button item to the selected Table_Widget
SOURCE
procedure Add_Button (Table: in out Table_Widget; Text, Tooltip, Command: String; Column: Positive; New_Row: Boolean := False; Color: String := "") with Pre => Table.Row_Height > 1 and Command'Length > 0;
PARAMETERS
Table - The Table_Widget in which button will be added Text - The text displayed on the button Tooltip - The tooltip show when user hover mouse over button Command - Tcl command which will be executed when button was clicked Column - The column in which the button will be added New_Row - If True, increase current number of row in the Table_Widget. Default value is False. Color - The color of the text on button which will be added. If empty, use default interface color. Default value is empty.
OUTPUT
Updated Table parameter Table_Widget
HISTORY
5.7 - Added 7.1 - Renamed to Add_Button
Table/Table.Add_Check_Button [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Add check button item to the selected Table_Widget
SOURCE
procedure Add_Check_Button (Table: in out Table_Widget; Tooltip, Command: String; Checked: Boolean; Column: Positive; New_Row, Empty_Unchecked: Boolean := False) with Pre => Table.Row_Height > 1;
PARAMETERS
Table - The Table_Widget in which button will be added Tooltip - The tooltip show when user hover mouse over button Command - Tcl command which will be executed when button was clicked. If empty, the button will be disabled Checked - If True, the button will be checked Column - The column in which the button will be added New_Row - If True, increase current number of row in the Table_Widget. Default value is False. Empty_Unchecked - If True, don't show image when the checkbox is unchecked. Default value is False.
HISTORY
6.0 - Added 7.1 - Renamed to Add_Check_Button 7.8 - Added Empty_Unchecked parameter
Table/Table.Add_Pagination [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Add pagination buttons to the bottom of the table
SOURCE
procedure Add_Pagination (Table: Table_Widget; Previous_Command, Next_Command: String := "") with Pre => Table.Row_Height > 1;
PARAMETERS
Table - The Table_Widget to which buttons will be added Previous_Command - The Tcl command which will be executed by the previous button. If empty, button will not be shown. Default value is empty Next_Command - The Tcl command which will be executed by the next button. If empty, button will not be shown. Default value is empty
HISTORY
5.9 - Added 7.1 - Renamed to Add_Pagination 7.6 - Added default values for Previous_Command and Next_Command
Table/Table.Add_Progress_Bar [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Add progress bar item to the selected Table_Widget
SOURCE
procedure Add_Progress_Bar (Table: in out Table_Widget; Value: Natural; Max_Value: Positive; Tooltip, Command: String; Column: Positive; New_Row, Invert_Colors: Boolean := False) with Pre => Table.Row_Height > 1 and Value <= Max_Value;
PARAMETERS
Table - The Table_Widget in which progress bar will be added Value - The current value of the progress bar Max_Value - The maximum value of the progress bar Tooltip - The tooltip show when user hover mouse over progress bar Command - Tcl command which will be executed when the row in which the the progress bar is was clicked Column - The column in which the progress bar will be added New_Row - If True, increase current number of row in the Table_Widget. Default value is False. Invert_Colors - Invert colors of the progress bar (small amount green, max red instead of small amount red and max green)
OUTPUT
Updated Table parameter Table_Widget
HISTORY
5.7 - Added 7.1 - Renamed to Add_Progress_Bar
Table/Table.Clear_Table [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Clear data from the table
SOURCE
procedure Clear_Table(Table: in out Table_Widget) with Pre => Table.Row_Height > 1;
PARAMETERS
Table - The Table_Widget which will be cleared
OUTPUT
Cleared Table parameter Table_Widget
HISTORY
5.7 - Added 7.1 - Renamed to Clear_Table
Table/Table.Create_Table [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Create a new table and columns headers in it
SOURCE
function Create_Table (Parent: String; Headers: Headers_Array; Scrollbar: Ttk_Scrollbar := Get_Widget(pathName => "."); Command, Tooltip_Text: String := "") return Table_Widget with Pre => Parent'Length > 0 and Headers'Length > 0, Post => Create_Table'Result.Row_Height > 1;
PARAMETERS
Parent - The Tk path for the parent widget Headers - The titles for the table headers Scrollbar - Ttk_Scrollbar associated with the table. If empty then create a new scrollbars. Default value is empty. Command - The Tcl command executed when the player press the table header. If empty, no command is executed. Default value is empty Tooltip - The tooltip show when the player hover mouse over the table header. Can be empty. Default value is empty
RESULT
The newly created Table_Widget
HISTORY
5.7 - Added 6.4 - Added Command parameter 7.1 - Renamed to Create_Table
Table/Table.Get_Column_Number [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Get the number of the Table_Widget column for the selected X axis coordinate
SOURCE
function Get_Column_Number (Table: Table_Widget; X_Position: Natural) return Positive;
PARAMETERS
Table - The Table_Widget which column will be taken X_Position - The X axis coordinate from which the column will be count
RESULT
The number of the column for the selected coordinate. The number starts from 1.
HISTORY
6.4 - Added
Table/Table.Is_Checked [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Check if the selected checkbutton is checked or not
SOURCE
function Is_Checked (Table: Table_Widget; Row, Column: Natural) return Boolean;
PARAMETERS
Table - The Table_Widget in which the checkbutton will be checked Row - The row number in which the checkbutton will be checked Column - The column number in which the checkbutton will be checked
RESULT
True if the selected checkbutton is checked, otherwise False
HISTORY
7.8 - Added
Table/Table.Toggle_Checked_Button [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Toggle the state of the selected checkbutton in the table Table - The Table_Widget in which the checkbutton will be toggled Row - The row number in which the checkbutton will be toggled Column - The column number in which the checkbutton will be toggled
SOURCE
procedure Toggle_Checked_Button(Table: Table_Widget; Row, Column: Natural);
HISTORY
7.8 - Added
Table/Table.Update_Headers_Command [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Update the Tcl command executed when the player clicked on Table_Widget headers
SOURCE
procedure Update_Headers_Command(Table: Table_Widget; Command: String);
PARAMETERS
Table - The Table_Widget in which headers will be updated Command - The Tcl command to execute. If empty, the command will be removed
HISTORY
6.5 - Added
Table/Table.Update_Table [ Subprograms ]
[ Top ] [ Table ] [ Subprograms ]
FUNCTION
Update size and coordinates of all elements in the selected table
SOURCE
procedure Update_Table (Table: Table_Widget; Grab_Focus: Boolean := True) with Pre => Table.Row_Height > 1;
PARAMETERS
Table - The Table_Widget which elements will be resized if needed Grab_Focus - If true, grab the keyboard focus for the table
HISTORY
5.7 - Added 6.7 - Added option to set focus on table 7.1 - Renamed to Update_Table