unit MFSubStatus;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ImgList, Grids, StdCtrls, SRVControl, SRVComboBox;

type
  TfrmSubStatus = class(TForm)
    cmbSubStatus: TSRVComboBox;
    txtComment: TEdit;
    dgSubStatus: TDrawGrid;
    ilSubStatus: TImageList;
    btnOK: TButton;
    btnCanel: TButton;
    procedure dgSubStatusDrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure dgSubStatusSelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure cmbSubStatusChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmSubStatus: TfrmSubStatus;

implementation

uses MFChat;

{$R *.dfm}

procedure TfrmSubStatus.dgSubStatusDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
     index : Integer;
begin
  index := ARow * dgSubStatus.ColCount + ACol;
  ilSubStatus.Draw(dgSubStatus.Canvas,
                   (Rect.Right + Rect.Left - ilSubStatus.Width) div 2,
                   (Rect.Bottom + Rect.Top - ilSubStatus.Height) div 2,
                   index);
end;

procedure TfrmSubStatus.dgSubStatusSelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  cmbSubStatus.LockChange;
  cmbSubStatus.ItemIndex := ARow * dgSubStatus.ColCount + ACol;
  cmbSubStatus.UnlockChange;
end;

procedure TfrmSubStatus.cmbSubStatusChange(Sender: TObject);
var
     index : Integer;
begin
  index := cmbSubStatus.ItemIndex;
  dgSubStatus.Row := index div dgSubStatus.ColCount;
  dgSubStatus.Col := index mod dgSubStatus.ColCount;
end;

end.

