Erro com End´s... não sei o q está errado
12/01/2006
0
Não sei onde está o erro.
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
Case Form_login.Edit1.Text = ´user´ of
if Key = VK_DELETE then //Del
if application.MessageBox(´Foi detectado o pressionamento da tecla DEL o registro será fechado!?´,´Confirme´,
mb_Ok + mb_iconquestion + mb_defbutton1) = idOk then
Dm.Tb_Tabelao.Post OR
if Key = 8 then //BackSpace
if application.MessageBox(´Foi detectado o pressionamento da tecla Backspace o registro será fechado!?´,´Confirme´,
mb_Ok + mb_iconquestion + mb_defbutton1) = idOk then
Dm.Tb_Tabelao.Post or
if (ssShift in Shift) and (Key = VK_TAB) then
Dm.Tb_Tabelao.Post
// DEL, Backspace e Shift+TAB
end;
end;
Obrigado.
Magão_sfa
Posts
12/01/2006
Michael
Não sei se o problema está relacionado a [b:b06502bbe1]ends[/b:b06502bbe1], mas de qualquer forma vc não pode usar o comando [b:b06502bbe1]case [/b:b06502bbe1]desse jeito.
[b:b06502bbe1]Case [/b:b06502bbe1]só trabalha com tipos ordinais. Veja:
case DiaDaSemana of 1: Dia := ´Domingo´; 2: Dia := ´Segunda´; 3: Dia := ´Terça´; ... end;
Outra coisa: vc não pode usar or do jeito que fez. Não entendi muito bem o que seu código deve fazer, mas acho q assim fica melhor:
const Mensagem = ´Foi detectado o pressionamento da tecla ¬d e o registro será fechado´; begin if Form_login.Edit1.Text = ´user´ then case Key of VK_DELETE, VK_BACKSPACE: if (Application.MessageBox(PAnsiChar(Format(Mensagem, [Key]), ...) = IdOk) then Dm.Tb_Tabelao.Post; VK_TAB: if ssShift in Shift then Dm.Tb_Tabelao.Post; end;
Veja que eu só reescrevi seu código de uma maneira mais legível. Mas vc pode melhorá-lo mais ainda.
Ah, não testei as alterações que realizei.
[]´s
13/01/2006
Aasn
O problema está nos ´OR´, substitua-os por ELSE nas sentenças.
Ex.:
if AASN = ´lindo´ then
begin
showmessage(´VERDADE´);
...
end
else if AASN = ´feio´ then
begin
showmessage(´FALSO´);
...
end
else if AASN = ´maravilhoso´ then
begin
showmessage(´VERDADE VERDADEIRA´);
...
end;
[]´s
AASN
13/01/2006
Dedi
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;Shift: TShiftState); const msg1 = ´Foi detectado o pressionamento da tecla DEL o registro será fechado!?´; msg2 = ´Foi detectado o pressionamento da tecla Backspace o registro será fechado!?´; begin if Form_login.Edit1.Text = ´user´ then begin if Key = VK_DELETE then begin if application.MessageBox(msg1,´Confirme´,mb_Ok + mb_iconquestion + mb_defbutton1) = idOk then Dm.Tb_Tabelao.Post; end else if Key = 8 then begin//BackSpace if application.MessageBox(msg2,´Confirme´,mb_Ok + mb_iconquestion + mb_defbutton1) = idOk then Dm.Tb_Tabelao.Post; end else if (ssShift in Shift) and (Key = VK_TAB) then begin Dm.Tb_Tabelao.Post; end; end; end;
Clique aqui para fazer login e interagir na Comunidade :)