Development/TMS Component

[TMS] AdvGrid ReadOnly Control

연탄집게 2012. 10. 18. 17:33

아.. 셀별로 readonly 걸어주는걸 몰라 한참 헤메었다..

OnEditCell() 이벤트를 이용하자..

 

procedure TFrmMat310n.AdvClGrid1CanEditCell(Sender: TObject; ARow,
  ACol: Integer; var CanEdit: Boolean);
begin

  if AdvClGrid1.cells[ GR1_LOCATION, ARow ] = '' then begin   // 신규모드이면 Location만 read only
    if ACol =  GR1_LOCATION then begin
      CanEdit := False;
    end
    else begin
      CanEdit := True;
    end;
  end
  else begin        // 수정모드이면 Location, level1, level2  read only
    case ACol  of
      GR1_LOCATION, GR1_LEVEL1, GR1_LEVEL2 : CanEdit := False;
    else
      CanEdit := True;
    end;
  end;

end;