CheckListBox...

Delphi

10/03/2004

Alguém sabe como usar o CheckListBox para marcar como
True campos Boolean, depois que vários Items do CheckList
for marcado?

Mui Obrigada,


Valchiria

Valchiria

Curtidas 0

Respostas

Fabio.hc

Fabio.hc

10/03/2004

Tente assim:

Ex:
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
   for i:=0 to CheckListBox1.Items.Count - 1 do
      begin

      ...
      query1campo.value:=CheckListBox1.Checked[i];
      ...

      end;
end;



GOSTEI 0
Valchiria

Valchiria

10/03/2004

Tente assim: Ex:
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
   for i:=0 to CheckListBox1.Items.Count - 1 do
      begin

      ...
      query1campo.value:=CheckListBox1.Checked[i];
      ...

      end;
end;


É quase isto que preciso... só que são vários campos nas tabelas que vão receber valores diferentes de acordo com o CkeckListBox, se estiver checked ou não.

Algo como assim, só que não consegui ainda...

procedure Tcad_empresa_cliente.CheckListBox1Exit(Sender: TObject);
var i : Integer;
begin
module.tb_emprecli.edit;
for i:=0 to CheckListBox1.Items.Count - 1 do
begin
module.tb_emprecliPadarias.Value := CheckListBox1.Checked[i];
module.tb_emprecliSupermercados.Value := CheckListBox1.Checked[i];
module.tb_emprecliPostoGasolina.Value := CheckListBox1.Checked[i];
module.tb_emprecliPapelarias.Value := CheckListBox1.Checked[i];
module.tb_emprecliFarmacias.Value := CheckListBox1.Checked[i];
module.tb_emprecliDentista.Value := CheckListBox1.Checked[i];
module.tb_emprecliLaboratorio.Value := CheckListBox1.Checked[i];
module.tb_emprecliClinicas.Value := CheckListBox1.Checked[i];
module.tb_emprecliOpticas.Value := CheckListBox1.Checked[i];
end;
end;


GOSTEI 0
Fabio.hc

Fabio.hc

10/03/2004

Pelo que entendi, tente assim:

procedure Tcad_empresa_cliente.CheckListBox1Exit(Sender: TObject);
begin
   module.tb_emprecli.edit;
   module.tb_emprecliPadarias.Value      := CheckListBox1.Checked[1];
   module.tb_emprecliSupermercados.Value := CheckListBox1.Checked[2];
   module.tb_emprecliPostoGasolina.Value := CheckListBox1.Checked[3];
   module.tb_emprecliPapelarias.Value    := CheckListBox1.Checked[4];
   module.tb_emprecliFarmacias.Value     := CheckListBox1.Checked[5];
   module.tb_emprecliDentista.Value      := CheckListBox1.Checked[6];
   module.tb_emprecliLaboratorio.Value   := CheckListBox1.Checked[7];
   module.tb_emprecliClinicas.Value      := CheckListBox1.Checked[8];
   module.tb_emprecliOpticas.Value       := CheckListBox1.Checked[9];
   module.tb_emprecli.post;
end;



GOSTEI 0
Valchiria

Valchiria

10/03/2004

Pelo que entendi, tente assim:
procedure Tcad_empresa_cliente.CheckListBox1Exit(Sender: TObject);
begin
   module.tb_emprecli.edit;
   module.tb_emprecliPadarias.Value      := CheckListBox1.Checked[1];
   module.tb_emprecliSupermercados.Value := CheckListBox1.Checked[2];
   module.tb_emprecliPostoGasolina.Value := CheckListBox1.Checked[3];
   module.tb_emprecliPapelarias.Value    := CheckListBox1.Checked[4];
   module.tb_emprecliFarmacias.Value     := CheckListBox1.Checked[5];
   module.tb_emprecliDentista.Value      := CheckListBox1.Checked[6];
   module.tb_emprecliLaboratorio.Value   := CheckListBox1.Checked[7];
   module.tb_emprecliClinicas.Value      := CheckListBox1.Checked[8];
   module.tb_emprecliOpticas.Value       := CheckListBox1.Checked[9];
   module.tb_emprecli.post;
end;


Mui Obrigada pela atenção, mas no meu caso o que ajudou mesmo foi eu usar o DBCTRLGRID + DBCHECKBOX e depois configurar o DBCTRLGRID para Rowcount = 1 em suas propriedades...

Até Mais,


GOSTEI 0
POSTAR