Como mudar o Caption dos botoes de uma Messagedlg ?
tenho uma Messagedlg assim:
if Messagedlg(´Confirma Teste de Impressora ?´,mtWarning,mbOk,mbCancel],0) = mrOK then begin
TestaImpressora.Click;
end;
Nos dois botoes aparecem os captions: OK e Cancela.
Só que eu queria os captions com:
´Desejo o Teste´ e ´Não desejo o teste´
Como fazer isto?
Diante mao ja´ agradeco a ajuda.
if Messagedlg(´Confirma Teste de Impressora ?´,mtWarning,mbOk,mbCancel],0) = mrOK then begin
TestaImpressora.Click;
end;
Nos dois botoes aparecem os captions: OK e Cancela.
Só que eu queria os captions com:
´Desejo o Teste´ e ´Não desejo o teste´
Como fazer isto?
Diante mao ja´ agradeco a ajuda.
Adonis
Curtidas 0
Respostas
Mmtoor
05/10/2003
Ou vc traduz os arquivos necessários dentro do diretório LIB no delphi ou utiliza o messagebox, por exemplo
var RESP:INTEGER;
begin
RESP:=MessageBoxEx(HANDLE,´Dejesa continuar?´,´COnfirmação´,MB_YESNO,LANG_PORTUGUESE);
CASE RESP OF
IDYES:SHOWMESSAGE(´Programa continua!´);
IDNO:SHOWMESSAGE(´Não continua!´);
END;
var RESP:INTEGER;
begin
RESP:=MessageBoxEx(HANDLE,´Dejesa continuar?´,´COnfirmação´,MB_YESNO,LANG_PORTUGUESE);
CASE RESP OF
IDYES:SHOWMESSAGE(´Programa continua!´);
IDNO:SHOWMESSAGE(´Não continua!´);
END;
GOSTEI 0
Beppe
05/10/2003
Só isso:
ButtonNames[mbOK] := ´Desejo o Teste´; ButtonNames[mbCancel] := ´Não desejo o teste´;
GOSTEI 0
Beppe
05/10/2003
Perai, já mando o correto...
GOSTEI 0
Beppe
05/10/2003
function MessageTest(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; X, Y: Integer): Integer; var Sum: Integer; begin with CreateMessageDialog(Msg, DlgType, Buttons) do try if X >= 0 then Left := X; if Y >= 0 then Top := Y; if (Y < 0) and (X < 0) then Position := poScreenCenter; with TButton(FindChildControl(´OK´)) do begin Caption := ´Desejo o Teste´; Sum := Canvas.TextWidth(Caption) + 32; Width := Sum; end; with TButton(FindChildControl(´Cancel´)) do begin Caption := ´Não desejo o Teste´; Left := Sum + 32; Width := Canvas.TextWidth(Caption) + 32; Inc(Sum, Width); end; Inc(Sum, 64); if Width < Sum then Width := Sum; Result := ShowModal; finally Free; end; end;
Chame assim:
MensagemTeste(´teste´, mtConfirmation, mbOKCancel, 0, -1, -1, ´´);
Credo... agora tive que suar, mas consegui.
Faça o ajuste fino por si mesmo.
GOSTEI 0
Adonis
05/10/2003
agradeco as ajudas acima... :D
GOSTEI 0