Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Como Lograr el Efecto PopUp Menu del Messenger???? (https://www.clubdelphi.com/foros/showthread.php?t=26860)

AGAG4 05-11-2005 19:45:41

Como Lograr el Efecto PopUp Menu del Messenger????
 
Uso D6

Estoy investigando como lograr hacer el efecto que hace el PopUp Menu del Messenger, por ejemplo, cuando en la barra de herramientas se abre una Ventana como una Persiana y Desaparece con el mismo EFECTO, encontre varios componentes en la pagina de Torry's pero son formas que no se pueden modificar, lo que quiero es posicionar la forma en la altura de la barra de herramientas del lado del reloj y darle el efecto de una persiana y meterle en la forma lo que yo quiera, como se le podría dar ese mismo efecto a una forma y posicionarlo al lado del reloj sin importar la resolución con que cuente la Computadora????

Agradezco cualquier sugerencia.

Héctor Randolph 05-11-2005 20:06:52

Prueba con este hilo tal vez sea útil.

También puedes buscar en el foro con respecto a la función AnimateWindow

Un saludo

lpmlpm 05-11-2005 20:07:10

En los componentes que vienen con la JVCL viene uno que se llama DesktopAlert que le configuras por propiedades la posición en la que ha de aparecer la ventana... puedes revisar los fuentes para ver como lo hace...

vtdeleon 05-11-2005 20:08:06

Saludos

Existe un componetne llamado: tmsnpopup.

No estoy seguro si es esto lo que queires

dec 05-11-2005 20:17:14

Hola,

A ver qué les parece:

Código Delphi [-]
uses
   Unit2;
 
 procedure TForm1.Button1Click(Sender: TObject);
 var
   i: integer;
   topeTop: integer;
 begin
   Form2.Top := Screen.Height + Form2.Height;
   Form2.Left := Screen.Width - Form2.Width - 4;
   topeTop := Screen.Height - Form2.Height - 35;
   Form2.Show;
   i := Form2.Top;
   while (i >= topeTop) do
   begin
     Form2.Top := i;
     Dec(i, 1);
     //Dec(i, 2);
     //Dec(i, 3);
   end;
 end;

vtdeleon 05-11-2005 20:47:39

Saludos

El código de dec estaría bien para quien tenga la barra de tama~o 35. Pues yo utilizo algunos themes (en Xp) y la barra de tareas no es siempre de ese tama~o.
Guiandome del codigo de dec (si me lo permite:p)
Código Delphi [-]
procedure TForm1.btn1Click(Sender: TObject);
var
  BarraTar:TRect;
  topeTop, i: integer;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @BarraTar, 0);
  Form2.Top := BarraTar.Bottom;
  Form2.Left :=   BarraTar.Right - Form2.Width - 4;
  topeTop := BarraTar.Bottom-form2.Height;
  Form2.Show;
  i := Form2.Top;
  while (i >= topeTop) do
  begin
    Form2.Top := i;
    Dec(i, 1);
  end;
end;

AGAG4 05-11-2005 20:59:26

oki
 
Voy a probar sus sugerencias y con respecto a tvDeleon el efecto que quiero es como lo hace el componente tmsnpopup ya lo estoy revisando para ver que le puedo añadir....

Que tengan Buen día.

dec 05-11-2005 21:17:11

Hola,

Se agradece la sugerencia Troy, la incorporé a esto que copio aquí ahora... que más vale no lo hiciera, porque se va a ver en qué paro... ;)

Código Delphi [-]
 procedure MsgPopup(const msg:
 string; const wait: integer);
 var
   i,max: integer;
   lbMsg:  TLabel;
   fmMsg:   TForm;
   panel:   TRect;
 begin
   fmMsg := TForm.Create(nil);
   try
     with fmMsg do
     begin
       Width  := 350;
       Height := 110;
       Color := clWhite;
       Caption:=' '+msg;
       SystemParametersInfo
       (48, 0, @panel,  0);
       Top := panel.Bottom;
       BorderStyle := bsToolWindow;
       FormStyle   :=  fsStayOnTop;
       lbMsg:=TLabel.Create(fmMsg);
       Left := panel.Right-fmMsg.Width-2;
       max :=panel.Bottom-fmMsg.Height-2;
       with lbMsg do
       begin
         Top  := 30;
         Left := 10;
         Height:=30;
         Parent  := fmMsg;
         AutoSize :=false;
         Caption  :=  msg;
         Font.Size :=  14;
         Font.Name := 'Arial';
         Font.Color  := clRed;
         Alignment:= taCenter;
         Font.Style:=[fsBold];
         Width := fmMsg.Width;
       end;
       Show;
       i := Top;
       while(i>=max)do
       begin
         Top := i;
         Dec(i,2);
         Refresh ;
       end;
     end;
   finally
     Sleep(wait);
     fmMsg.Free;;
   end;
 end;

vtdeleon 05-11-2005 21:21:45

Saludos
Cita:

Empezado por dec
... la incorporé a esto que copio aquí ahora... que más vale no lo hiciera, porque se va a ver en qué paro... ;)

Si tiene que ver con las dudas qeu has tenido en estos (creo) 3 dias, me lo imagino ;).
Tu trayectoria en el CLUB podria delatarte :cool:

Qeu será??:rolleyes: :p:p

dec 05-11-2005 21:31:19

Hola,

No es nada en especial Troy, me refería a que bien pudiera coger un libro... :p

Código Delphi [-]
 {··············································}
 {······························· dec - 20005 ··}
 {··············································}
 {·} unit UMsgPopup; interface {················}
 {·} uses Forms,{···}StdCtrls, {················}
 {·} Windows,Classes,Graphics; {················}
 {·} procedure MsgPopup(const msg: {············}
 {·} string; const wait: integer); {············}
 {·} implementation {···························}
 {·} procedure MsgPopup(const msg: {············}
 {·} string; const wait: integer); {············}
 {·} var {······································}
 {·····} i,max: integer; {······················}
 {·····} lbMsg:{}TLabel; {······················}
 {·····} fmMsg:{·}TForm; {······················}
 {·····} panel:{·}TRect; {······················}
 {·} begin {····································}
 {···} fmMsg := TForm.Create(nil); {············}
 {···} try {····································}
 {·····} with fmMsg do {························}
 {·····} begin {································}
 {·······} Width  := 350; {·····················}
 {·······} Height := 110; {·····················}
 {·······} Color := clWhite; {··················}
 {·······} Caption:=' '+msg; {··················}
 {·······} SystemParametersInfo {···············}
 {·······} (48, 0, @panel,  0); {···············}
 {·······} Top := panel.Bottom; {···············}
 {·······} BorderStyle := bsToolWindow; {·······}
 {·······} FormStyle{·}:=  fsStayOnTop; {·······}
 {·······} lbMsg:=TLabel.Create(fmMsg); {·······}
 {·······} Left := panel.Right-fmMsg.Width-2; {·}
 {·······} max :=panel.Bottom-fmMsg.Height-2; {·}
 {·······} with lbMsg do {······················}
 {·······} begin {······························}
 {·········} Top{}:= 30; {······················}
 {·········} Left := 10; {······················}
 {·········} Height:=30; {······················}
 {·········} Parent{}:= fmMsg; {················}
 {·········} AutoSize :=false; {················}
 {·········} Caption{}:=  msg; {················}
 {·········} Font.Size :={}14; {················}
 {·········} Font.Name := 'Arial'; {············}
 {·········} Font.Color{}:= clRed; {············}
 {·········} Alignment:= taCenter; {············}
 {·········} Font.Style:=[fsBold]; {············}
 {·········} Width := fmMsg.Width; {············}
 {·······} end ; {······························}
 {·······} Show; {······························}
 {·······} i := Top; {··························}
 {·······} while(i>=max)do {····················}
 {·······} begin {······························}
 {·········} Top := i; {························}
 {·········} Dec(i,2); {························}
 {·········} Refresh ; {························}
 {·······} end; {·······························}
 {·····} end; {·································}
 {···} finally {································}
 {·····} Sleep(wait); {·························}
 {·····} fmMsg.Free;; {·························}
 {···} end; {···································}
 {·} end; {·····································}
 {.} end. {·····································}
 {························ www.ClubDelphi.com ··}
 {··············································}

lento manu 02-01-2008 18:49:10

Lo mismo, sin bloquear aplicación
 
Siendo haber descubierto este hilo tan tarde, pero en fin, ¡encuentras cuándo buscas! La suerte es que estaba aquí y con otro tema que había encontrado de Marco Cantu, he fabricado una nueva solución, sin que se bloquee la aplicación por el 'sleep'.

También he adaptado el mensaje diferenciándolo del Caption del form y dimensionando varias líneas.
El botton2 usa la Unit de Dec.
Gracias a todos por vuestras aportaciones.

Os pego el codigo de mi form por si a alguien le pueda valer:
Código Delphi [-]
unit Pal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;


type TMiTimer = class(TTimer)              // derivamos de TTimer
    private
       procedure Evento(Sender: TObject);  // nuevo procedimiento == declaración OnTimer
    end;


type
  TfPal = class(TForm)
    Button1: TButton;
    Button2: TButton;

    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure MsgPopup(const titulo, msg:string; const wait: integer);
    
  end;

var
  fPal: TfPal;
  //Timer:TMiTimer;
  Timer: TMiTimer;
  fmMsg: TForm;

implementation

uses UMsgPopup;

   //procedimiento TMiTimer:

   procedure TMiTimer.Evento(Sender: TObject);
   begin
       FreeAndNil(fmMsg);
   end;

{$R *.dfm}


procedure TfPal.MsgPopup(const titulo, msg:string; const wait: integer);
var
   i,max: integer;
   lbMsg: TLabel;
   panel: TRect;
   L: byte;
   function Lineas(const msg: string): byte;
   var
       I,C: Byte;
       S: string;
   begin
       I:= 0;
       S:= msg;
       C:= pos(#13,S);
       while C > 0 do
       begin
          Inc(I);
          S:= Copy (S, C+1, length(S));
          C:= pos(#13,S);
       end;
   result:= I;
   end;
begin
   fmMsg := TForm.Create(nil);
   try
      with fmMsg do
      begin
          Width := 350;
          L:= Lineas(msg);
          if  L = 0 then
             Height := 110
          else
             Height:= 70 + 60 * L;
          Color := clWhite;
          Caption:=' '+ titulo;
          SystemParametersInfo(48, 0, @panel, 0);
          Top := panel.Bottom;
          BorderStyle := bsToolWindow;
          FormStyle := fsStayOnTop;
          lbMsg:=TLabel.Create(fmMsg);

          //añadimos objeto Timer con nuevo Evento
          Timer:= TMiTimer.Create(fmMsg);
          Timer.Enabled:= False;
          Timer.Interval:= wait;

          Left := panel.Right-fmMsg.Width-2;
          max :=panel.Bottom-fmMsg.Height-2;
          with lbMsg do
          begin
              Top := 30;
              Left := 10;
              Height:=30;
              Parent := fmMsg;
              //AutoSize a True para imprimir multilinea:
              AutoSize := True;
              Caption := msg;
              Font.Size := 14;
              Font.Name := 'Arial';
              Font.Color := clRed;
              Alignment:= taCenter;
              Font.Style:=[fsBold];
              Width := fmMsg.Width;
          end;

          Show;
          i := Top;
          while(i>=max)do
          begin
              Top := i;
              Dec(i,2);
              Refresh ;
          end;
      end;
   finally
      //Sleep(wait);
      //fmMsg.Free;
      //para evitar la aplicación se bloquee;
      Timer.Enabled:= True;
      Timer.OnTimer := Timer.Evento;
   end;
end;

procedure TfPal.Button1Click(Sender: TObject);
var
   Mensaje: string;
begin
    Mensaje:= 'Mensaje desde fPal'+#13+
              'por 5 seg' +#13+
              'y tres líneas';
    MsgPopup('Mensaje Título', Mensaje , 5000);
end;

procedure TfPal.Button2Click(Sender: TObject);
var
   Mensaje: string;
begin
    Mensaje:= 'Mensaje desde Unit'+#13+
              'sólo 3 seg y 2 líneas';
    Msn('Mensaje Título', Mensaje , 3000);
end;

end.

¡Feliz año!


La franja horaria es GMT +2. Ahora son las 04:04:40.

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