PDA

Ver la Versión Completa : MessageBox


Michel
19-08-2003, 16:40:21
Amigos foreros tengo entendido q para dar salto de linea en MessageBox es con #13

que tiene de malo estoo


application.MessageBox(Pchar(lcTX.GetText('sDelete')) + 13#10+ Pchar(lcTX.GetText('sDelete1')),
Pchar(lcTX.GetText('sCaption')),MB_IconInformation);

si alguien me puede decir alguna sugerencia gracias

lcTX.GetText('sDelete') = Tiene un String generado por mi
lcTX.GetText('sDelete1') = Tiene un String generado por mi

GRACIAS

jhonny
19-08-2003, 17:24:15
Pues segun lo que yo veo, pues tu lo haz dicho todo...

tengo entendido q para dar salto de linea en MessageBox es con #13

Pues antes de 13 debes poner #

Asi:


application.MessageBox(Pchar(lcTX.GetText('sDelete')) + #13#10+ Pchar(lcTX.GetText('sDelete1')),
Pchar(lcTX.GetText('sCaption')),MB_IconInformation);


Espero te sirva


:D

delphi.com.ar
19-08-2003, 18:53:58
Particularmente yo me he hecho mi propia versión de la función que no hace mas que llamar a MessageBox, y recibe strings en sus parámetros... Sinceramente la hice porque yo era un programador de VB, y estaba muy acostumbrado a MsgBox....
function MsgBox(AMessage: String; AType: Integer = MB_OK; ACaption: String = ''): Integer;
begin
if ACaption = '' Then
ACaption := Application.Title ;

Result := MessageBox(GetActiveWindow, PChar(AMessage), PChar(ACaption), AType);
end;

function MsgBoxFmt(AMessage : String; Params: array of const; AType : Integer = MB_OK; ACaption : String = #0): Integer;
begin
Result := MsgBox(Format(AMessage, Params), AType, ACaption);
end;


Saludos!

Julià T.
19-08-2003, 20:58:54
como delphi.com.ar, yo también me hice mis funciones para simplificar

Const
SInfo='Información';
SError='Error';

//muestra un mensaje de error
function ShowError(Cad:string):boolean;
begin
Application.MessageBox(Pchar(Cad),SError,MB_OK + MB_ICONERROR);
Result:=false;
end;

//muestra un mensaje de información
function ShowInfo(Cad:string):boolean;
begin
Application.MessageBox(Pchar(Cad),SInfo,MB_OK + MB_ICONEXCLAMATION);
Result:=false;
end;