Ver Mensaje Individual
  #1  
Antiguo 18-11-2013
Comandant Comandant is offline
Miembro
NULL
 
Registrado: ago 2012
Ubicación: Salta
Posts: 34
Reputación: 0
Comandant Va por buen camino
TNotifyEvent y TMouseEvent

Hola a todos una vez más necesito de su ayuda para poder asignar un procedimiento a un evento por ej:

Código Delphi [-]
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure ImageEvent(Sender: TObject );
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    bImage : array of TImage;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.ImageEvent(Sender: TObject);
begin
  ShowMessage('asd');
end;

procedure Button1Click(Sender: TObject);
  h   : Integer;
begin
  setLength(bImage, High(bImage)+2);

  h := High(bImage);
  bImage[h] := TImage.Create(nil);

  with bImage[h] do begin
    Width  := 75;
    Height := 45;
    Name:= Format('B%d', [h]) ;
    OnClick := ImageEvent;
    OnMouseDown:= ImageEvent;//Aqui es el problema que tengo
    Parent  := Self;
    Picture.Bitmap.LoadFromFile('c:/clubdelphi.bmp');
  end;
end;

Como verán en el evento onClick puedo asignarle un procedimiento ahora para el evento OnMouseDown no y me pregunto si hay alguna forma. O de ultima capturar el evento cuando se clickiea en un objeto del tipo TImage. Saludos y gracias
Responder Con Cita