Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread TDataSet - StateChange Event - Question
Wed, Oct 9 2013 9:15 AMPermanent Link

Walter Matte

Tactical Business Corporation


I have a Dataset named "User" ... why does TDataSet(Sender) fail?  It appears that sometimes the Sender has the Dataset and sometimes it is not assigned?

Is this correct?

procedure TfrmUser.UserStateChange(Sender: TObject);
begin
  case TDataset(Sender).State of
  dsClosed: begin
              imgAddBtn.visible := False;
              imgEditBtn.visible := False;
              imgSaveBtn.visible := False;
              imgCancelBtn.visible := False;
              imgDeleteBtn.visible := False;
            end;
  dsBrowse: begin
              imgAddBtn.visible := true;
              imgSaveBtn.visible := False;
              imgCancelBtn.visible := False;
              if TDataSet(Sender).RowCount >= 1 then
              begin
                imgEditBtn.visible := true;
                imgDeleteBtn.visible := true;
              end
              else
              begin
                imgEditBtn.visible := false;
                imgDeleteBtn.visible := false;
              end;
            end;
  dsInsert: begin
              imgAddBtn.visible := False;
              imgEditBtn.visible := False;
              imgSaveBtn.visible := True;
              imgCancelBtn.visible := True;
              imgDeleteBtn.visible := False;
            end;
  dsUpdate: begin
              imgAddBtn.visible := False;
              imgEditBtn.visible := False;
              imgSaveBtn.visible := True;
              imgCancelBtn.visible := True;
              imgDeleteBtn.visible := False;
            end;
  end;

end;

Walter
Wed, Oct 9 2013 4:21 PMPermanent Link

Walter Matte

Tactical Business Corporation


I made an error.... this is not an issue.  

Walter
Image