TkTable js Object

TkTable js Object


  • interp
  • path_name
  • widget_obj

A container for holding information about a TkTable table widget. This one is tricky too. It is built with 5 tables. The outermost is used to hold four other tables:

  • top_left_table
  • top_right_table
  • bottom_left_table
  • bottom_right_table

This is necessary for being able to have title rows and title cols which are not scrolled. Top_left_table has the part in the top left corner with the row parts and col parts, which are never scrolled. Top_right_table has the title row parts, which are only scrolled horizontally when the table is scrolled. bottom_left_table has the title cols, which are only scrolled vertically when the table is scrolled, and bottom right table contains the rows and columns which are visible and can be scrolled horizontally and vertically.

Here are also the scrollbars and when scrolling depending on the direction either the top_right_table is scrolled accordingly or the bottom_left_table. This is done by setting the scrollLeft or scrollTop attribute of these tables to the same value as the corresponding value of the bottom_right_table when scrolling the bottom_right_table. With that trick it looks like both tables are scrolling synchronous.

When calculating the position and table of a cell title rows and title cols have to be taken in account on deciding which of the four tables holds the desired cell. And for giving back the index of a cell has to be done the same way for getting the absolute index of the cell.

When the -command option is used, every cell gets attached the click event and in the event handler the command script is called with the pah name of the table and the index of the cell in nn,nn syntax are passed as parameters to the script.

(Part of Tk Widgets in Javascript Paper)