문제

How can I do inverse selection in AdvStringGrid (TMS)?

도움이 되었습니까?

해결책

Assuming, that NGLN is right, you'll need to set the proper Disjunct...Select option in Grid.MouseActions to select the kind of selection you'll allow, and then you can call this procedure:

PROCEDURE InvertSelection(Grid : TAdvStringGrid);
  VAR
    C,R : Cardinal;

  BEGIN
    IF Grid.MouseActions.DisjunctCellSelect THEN
      FOR R:=Grid.FixedRows TO PRED(Grid.RowCount) DO FOR C:=Grid.FixedCols TO PRED(Grid.ColCount) DO Grid.SelectedCells[C,R]:=NOT Grid.SelectedCells[C,R]
    ELSE IF Grid.MouseActions.DisjunctRowSelect THEN
      FOR R:=Grid.FixedRows TO PRED(Grid.RowCount) DO Grid.RowSelect[R]:=NOT Grid.RowSelect[R]
    ELSE IF Grid.MouseActions.DisjunctColSelect THEN
      FOR C:=Grid.FixedCols TO PRED(Grid.ColCount) DO Grid.ColSelect[C]:=NOT Grid.ColSelect[C]
  END;

This will make all unselected rows/columns/cells selected and vice-versa.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top