Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   MessageBox (https://www.clubdelphi.com/foros/showthread.php?t=3040)

Michel 19-08-2003 16:40:21

MessageBox
 
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...

Cita:

tengo entendido q para dar salto de linea en MessageBox es con #13
Pues antes de 13 debes poner #

Asi:

Código:

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....
Código:

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;


La franja horaria es GMT +2. Ahora son las 19:50:30.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi