Table widget

Example of Code
{
  ...
  scrolled_table =
    XtVaCreateManagedWidget ("scrolledTable",
			     scrolledTableWidgetClass, parent_widget,
			     XtNallowHoriz,   True,
			     NULL);


  logo_widget =
    XtCreateManagedWidget ("tableLogo",
			   logoWidgetClass, scrolled_table,
			   NULL, 0);
  

  stuff_widget =
    XtVaCreateManagedWidget ("tableStuff",
			     tableWidgetClass, scrolled_table,
			     XtNliteral,      True,
			     XtNcolumns,      5,
			     XtNrows,         120,
		             NULL);

  XawTableSetColumnWidth (stuff_widget, 0, 4);
  XawTableSetColumnWidth (stuff_widget, 1, 10);
  XawTableSetColumnWidth (stuff_widget, 2, 8);

  title_widget =
    XtVaCreateManagedWidget ("tableTitle",
                             tableWidgetClass, scrolled_table,
			     XtNliteral,      False,
			     XtNcolumns,      5,
			     XtNrows,         1,
		             XtNeditable,     False,
		             NULL);

  XtVaGetValues (stuff_widget, XtNrowHeight, &row_height, NULL);

  number_widget =
    XtVaCreateManagedWidget ("tableNumber",
			     tableWidgetClass, scrolled_table,
		             XtNliteral,      True,
			     XtNeditable,     False,
		             XtNcolumns,      1,
		             XtNrows,         120,
                             XtNrowHeight,    row_height,
		             NULL);

  XtAddCallback(stuff_widget, XtNchangedColumnWidth, 
		ChangedColumnWidth, title_widget);

  XtAddCallback(stuff_widget, XtNchangedRowHeight, 
		ChangedRowHeight, number_widget);

....

}

static void ChangedColumnWidth (widget, client_data, call_data)
    Widget    widget;
    XtPointer client_data;
    XtPointer call_data;
{
  Widget title = (Widget)client_data;
  XawTableCallbackStruct* table_struct = (XawTableCallbackStruct*) call_data;
  int column_width;

  column_width = XawTableGetColumnPixelWidth (stuff_widget,
					      table_struct->column);

  XawTableSetColumnWidth (title, table_struct->column, column_width);
}


/* ARGSUSED */
static void ChangedRowHeight (widget, client_data, call_data)
    Widget    widget;
    XtPointer client_data; /* unused */
    XtPointer call_data;
{
  Widget number = (Widget)client_data;
  int row_height;

  XtVaGetValues (widget, XtNrowHeight, &row_height, NULL);
  XtVaSetValues (number, XtNrowHeight, row_height, NULL);
}



Vladimir T. Romanovski
romsky@hp1.oea.ihep.su