Fórum Como mudar o Caption dos botoes de uma Messagedlg ? #186354
05/10/2003
0
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
Curtir tópico
+ 0Posts
05/10/2003
Mmtoor
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
06/10/2003
Beppe
ButtonNames[mbOK] := ´Desejo o Teste´; ButtonNames[mbCancel] := ´Não desejo o teste´;
Gostei + 0
06/10/2003
Beppe
Gostei + 0
06/10/2003
Beppe
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
08/10/2003
Adonis
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)