EditTable Widget WebFAQ - Q15


  /*****************************************************
   Suppose you want have the value in cell(1,1) increased
   by one if pressed the key "." once when that cell is
   selected.
  *****************************************************/
  :
  :
  static char my_translations[] =
    "&ltKey>. :                             IncrementAction()";

  static void
  IncrementAction(Widget widget, XEvent *event, String *params, int *num_params)
  {
  int col, row;
  int *int_ptr;

  XintEditTableGetCellPointerPosition(widget, &col, &row);
  if (col == 1 && row == 1) {
     int_ptr = (int*)XintEditTableGetCellData(widget, col, row);
     (*int_ptr)++;
     XintEditTableFillCell(widget, col, row, int_ptr);
    }
  }

  static XtActionsRec app_actions[] = {
     {"IncrementAction", (XtActionProc) IncrementAction}
  };
  :
  :
  /* in main() */
  :
  XtAppAddActions(app_context, app_actions, XtNumber(app_actions));
  :
  /* in CreateTargetWidget() */
  :
  :
  XintEditTableSetCellBackground(Table, 1, 1, 1, 1,
                                 XintLoadColor(XtDisplay(Table), "green"));
                               /* mark the specific cell by changing its br color */

  XtOverrideTranslations(Table, XtParseTranslationTable(my_translations));
  :
  :


Click here for the Image
Back to EditTable FAQ

© INT 1996.
@3L &col, &row); if (col == 1 && row == 1) { int_ptr = (int*)XintEditTableGetC