[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Highlighting the current row in a TextEditor



Hello All,

I'm heading towards getting a popup menu to allow various actions on a
selected row of my TextEditor canvas. To begin with I'm trying to highlight
the selected row and de-select the previously selected row. The following
works fine if the row is in the first page of output but as soon as
scrolling kicks in the values go awry - the text retrieved by getLine isn't
the same as the text being overwritten by DrawAttrText.

  void myTextEditor::TextMouseDown(int row, int col, int button) {
    if (button == 3) {
      char line[100];
      // Un-highlight previously selected row ...
      getLine(line, 100, row_prev+1);
      GotoRC(row_prev, 0);
      DrawText(line);
      HideTextCursor();
      // Now highlight current row ...
      getLine(line, 100, row+1);
      GotoRC(row ,0);
      DrawAttrText(line, ChBlue);
      HideTextCursor();
      row_prev = row;
    }
  }

If anybody can see my mistake or suggest a better way of achieving a similar
result I'd be very grateful.

Dan Osborne
Specialist Business Solutions Ltd.


Reply to: