Ir ao conteúdo
  • Cadastre-se

Dificuldade no fluxograma


Posts recomendados

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, Buttons, StdCtrls;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    btn_Incluir: TButton;
    btn_Alterar: TButton;
    btn_Excluir: TButton;
    grp1: TGroupBox;
    lbl1: TLabel;
    edt_Num: TEdit;
    Label1: TLabel;
    Cbb_Tipo: TComboBox;
    Label2: TLabel;
    edt_Area: TEdit;
    Label3: TLabel;
    Edit_Ano: TEdit;
    Label4: TLabel;
    Edit_Prop: TEdit;
    Label5: TLabel;
    Edit_Iptu: TEdit;
    Label6: TLabel;
    cbb_Reformas: TComboBox;
    lbl2: TLabel;
    lbl3: TLabel;
    lbl4: TLabel;
    lbl5: TLabel;
    lbl6: TLabel;
    lbl7: TLabel;
    lbl8: TLabel;
    lbl9: TLabel;
    lbl10: TLabel;
    btn_Salvar: TButton;
    procedure btn_IncluirClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btn1Click(Sender: TObject);
    procedure btn_AlterarClick(Sender: TObject);
    procedure btn_SalvarClick(Sender: TObject);
    procedure btn_ExcluirClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  cont, linha : Integer;     // Declarado variavel cont para controle de Linhas

  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
var
  posicao :Integer;
begin
  posicao := StringGrid1.Row;
  ShowMessage(IntToStr(posicao));
end;

procedure TForm1.btn_AlterarClick(Sender: TObject);
begin
  edt_Num.Text   := StringGrid1.Cells[0,StringGrid1.Row];
  Cbb_Tipo.ItemIndex  := StrToInt(StringGrid1.Cells[1,StringGrid1.Row]);
  edt_Area.Text  := StringGrid1.Cells[3,StringGrid1.Row];
  Edit_Ano.Text  := StringGrid1.Cells[4,StringGrid1.Row];
  Edit_Prop.Text := StringGrid1.Cells[5,StringGrid1.Row];
  Edit_Iptu.Text := StringGrid1.Cells[6,StringGrid1.Row];
  cbb_Reformas.ItemIndex := StrToInt(StringGrid1.Cells[7,StringGrid1.Row]);

  btn_Incluir.Enabled := False;
  btn_Alterar.Enabled := False;
  btn_Excluir.Enabled := False;
  btn_Salvar.Enabled  := True;

  linha := StringGrid1.Row;  // Recebe o Numero da linha para alteração

end;

procedure TForm1.btn_ExcluirClick(Sender: TObject);
begin
  if Application.MessageBox(PChar('Tem Certeza que deseja Excluir a Propriedade Nº [ ' + StringGrid1.Cells[0,StringGrid1.Row] + ' ]  ? '),
                         Pchar(' Confirmação '), MB_ICONQUESTION + MB_YESNO ) = ID_YES then
                         begin
                           StringGrid1.Cells[0,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[1,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[2,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[3,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[4,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[5,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[6,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[7,StringGrid1.Row] := ' -- ';
                           StringGrid1.Cells[8,StringGrid1.Row] := ' -- ';

                           ShowMessage(' Propriedade Excluida com Sucesso !! ');

                           edt_Num.SetFocus;
                         end;
end;

procedure TForm1.btn_IncluirClick(Sender: TObject);
begin
  { Alimenta o stringGrid com os Valores dos campos }

  if edt_Num.Text = '' then
    begin
      ShowMessage(' Prencha os campos, antes de Incluir !!! ');
      edt_Num.SetFocus
    end
  else
    begin
      StringGrid1.Cells[0,cont] := edt_Num.Text;
      StringGrid1.Cells[1,cont] := IntToStr(Cbb_Tipo.ItemIndex);
      StringGrid1.Cells[2,cont] := Cbb_Tipo.Text;
      StringGrid1.Cells[3,cont] := edt_Area.Text;
      StringGrid1.Cells[4,cont] := Edit_Ano.Text;
      StringGrid1.Cells[5,cont] := Edit_Prop.text;
      StringGrid1.Cells[6,cont] := Edit_Iptu.text;
      StringGrid1.Cells[7,cont] := IntToStr(cbb_Reformas.ItemIndex);
      StringGrid1.Cells[8,cont] := cbb_Reformas.Text;

      //------------------------------------------------//

      { Limpa os campos apos a inserção }

      edt_Num.Text   := '';
      Cbb_Tipo.ItemIndex := -1;
      edt_Area.Text  := '';
      Edit_Ano.Text  := '';
      Edit_Prop.Text := '';
      Edit_Iptu.Text := '';
      cbb_Reformas.ItemIndex := -1;

      edt_Num.SetFocus;    // Foca no campo Numero apos a inserção

      Inc(cont);           // Incrementa a Variavel Contador para controle de Linhas

      btn_Alterar.Enabled := True;  // Habilita os botão
      btn_Excluir.Enabled := True;

    end;
end;

procedure TForm1.btn_SalvarClick(Sender: TObject);
begin
  if edt_Num.Text = '' then
    begin
      ShowMessage(' Prencha os campos, antes de Incluir !!! ');
      edt_Num.SetFocus
    end
  else
    begin
      StringGrid1.Cells[0,linha] := edt_Num.Text;
      StringGrid1.Cells[1,linha] := IntToStr(Cbb_Tipo.ItemIndex);
      StringGrid1.Cells[2,linha] := Cbb_Tipo.Text;
      StringGrid1.Cells[3,linha] := edt_Area.Text;
      StringGrid1.Cells[4,linha] := Edit_Ano.Text;
      StringGrid1.Cells[5,linha] := Edit_Prop.text;
      StringGrid1.Cells[6,linha] := Edit_Iptu.text;
      StringGrid1.Cells[7,linha] := IntToStr(cbb_Reformas.ItemIndex);
      StringGrid1.Cells[8,linha] := cbb_Reformas.Text;

      //------------------------------------------------//

      { Limpa os campos apos a inserção }

      edt_Num.Text   := '';
      Cbb_Tipo.ItemIndex := -1;
      edt_Area.Text  := '';
      Edit_Ano.Text  := '';
      Edit_Prop.Text := '';
      Edit_Iptu.Text := '';
      cbb_Reformas.ItemIndex := -1;

      btn_Incluir.Enabled := True;
      btn_Alterar.Enabled := True;
      btn_Excluir.Enabled := True;
      btn_Salvar.Enabled  := False;

      edt_Num.SetFocus;    // Foca no campo Numero apos a inserção

      ShowMessage(' Alteração efetuada com Sucesso !!! ');
    end;


end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  cont := 0; // Zera a Variavel (Cont) no FormCreate
end;
end.

Estou com dificuldade em desenvolver o fluxograma alguém pode me ajudar?

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...