Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-06-2008
madmai madmai is offline
Miembro
 
Registrado: oct 2005
Posts: 117
Poder: 19
madmai Va por buen camino
Sender en un componente creado

He creado un componente que se componen de un padre (Tpanel) y dentro tiene un speedbutton, el boton ocupa toda la superficie del panel, le he dado un evento al componente que es el click del speedbuton, pues bien quiero que cuando se pulse el speedbuton se active el sender del panel del evento on click del panel pero no se como hacerlo, mi idea es que cuanto utilizo Tpanel(sender) en el codigo de mi programa no me hace caso por que lo que estoy haciendo es click en el speedbutton y no en el panel, no se si me entendeis pero estoy abierto a ideas, gracias de antemano un saludfo
Responder Con Cita
  #2  
Antiguo 14-06-2008
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Poder: 28
Lepe Va por buen camino
tienes razón, no te entiendo.

algo de código ayudaría, (sobre todo para saber como tienes definido el evento y cómo lo lanzas).

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita
  #3  
Antiguo 14-06-2008
madmai madmai is offline
Miembro
 
Registrado: oct 2005
Posts: 117
Poder: 19
madmai Va por buen camino
Este es el componente

Código Delphi [-]
unit PButon;

interface  uses   SysUtils, Classes, Controls, ExtCtrls,Buttons, Types, Graphics;  type   TPButon = class(TPanel)
  private     FSmallBitmap:TBitmap;     FBigOnclick:TNotifyEvent;     FBigLabel:String;
    FSmallOnclick:TNotifyEvent;
    FTag:Integer;

    procedure SetSmallBitmap (Value:TBitMap);
    procedure settag (Value:Integer);
    Procedure SetOnClick (Value: TNotifyEvent);
    Procedure SmallSetOnClick (Value: TNotifyEvent);
    procedure SetBigLabel (Value:String);
    Function GetSmallBitmap:TBitMap;
    procedure Resize; override;
    { Private declarations }   protected     { Protected declarations }   public     Big,Small:TSpeedbutton;     constructor Create(AOWner: TComponent); override;
    Destructor Destroy; override;
    { Public declarations }   published     property BigOnClick:TNotifyEvent read FBigOnclick write SetOnClick;
    property SmallOnClick:TNotifyEvent read FSmallOnclick write SmallSetOnClick;
    property SmallPicture:TBitmap read GetsmallBitmap write SetSmallBitmap;
    property BigCaption:String read FBigLabel write setBigLabel;
    property PanelTag:Integer read FTag write settag;
    { Published declarations }   end;

procedure Register;

implementation  procedure Register;
begin   RegisterComponents('Samples', [TPButon]);
end;

procedure TPbuton.settag(Value:Integer);
begin   FTag:=Value; end;
procedure TPButon.SetBigLabel (Value:String);
begin    FBigLabel:=value;   repaint; end;
procedure TPButon.SetSmallBitmap (Value:TBitMap);
begin   FSmallBitmap:=Value;   small.Glyph:=FSmallBitmap; end;
function TPButon.GetSmallBitmap:Tbitmap;
begin   Result:=small.Glyph; end;

Procedure  TPButon.SetOnClick (Value: TNotifyEvent);
begin     FBigOnClick:=Value;   Big.OnClick:=FBigOnClick;  end;
Procedure  TPButon.SmallSetOnClick (Value: TNotifyEvent);
begin   FSmallOnClick:=Value;   Small.OnClick:=FSmallOnClick;  end;

constructor TPButon.Create(AOWner: TComponent);
var   posicion : TPoint;  begin   //dfalñkds
   inherited Create(AOWner);
  FTag:=0;
  caption:='';
  width := 75;
  height:= 16;
  bevelouter := bvNone;
  posicion.X := Left;
  posicion.Y := Top;
  Big := TSpeedButton.create(Self);
  Big.Parent := Self;
  big.ClientToParent(posicion);
  big.Flat := True;
  Big.Width := width;
  Big.Height := Height;
  Small := TSpeedButton.Create(Self);
  Small.Parent := Self;
  small.ClientToParent(posicion);
  small.Flat := True;
  small.Width :=  big.Height div 2;
  small.Height := big.Height;
  small.Top := big.Top;
  small.Left := left + width - small.Width;
  BigCaption:=FBigLabel;
  small.NumGlyphs:=1;
  big.NumGlyphs:=1;
  caption:='';
  resize;

end;
procedure TPButon.Resize;
begin   inherited;
  caption:='';
  big.Height := height;
  big.Width := width;
  small.Width :=  big.Height div 2 + 2;
  small.Height := big.Height;
  small.Top:=big.Top;
  small.Left := big.Left + big.Width - small.Width;

end;

destructor TPButon.Destroy;
begin   big.Free;   small.Free;  inherited;
end;

end.

y luego cuando utilizo en mi programa el tpanel(sender) no hace caso imagino por que yo estoy utlizando el sender del bigonclick y no el del panel

gracias de antemano

Última edición por dec fecha: 14-06-2008 a las 11:10:28.
Responder Con Cita
  #4  
Antiguo 14-06-2008
Avatar de eduarcol
[eduarcol] eduarcol is offline
Miembro Premium
 
Registrado: ago 2003
Ubicación: En los estados Zulia y Merida de Venezuela
Posts: 4.151
Poder: 25
eduarcol Va por buen camino
si sabes que el sender te devuelve especificamente esta clase podrias hacer algo como:

Código Delphi [-]
TPanel(TSpeedButton(Sender).Parent)
__________________
...Yo naci en esta ribera del arauca vibr@d0r
Soy hermano de la espuma,
de la garza, de la rosa y del sol...
Viva Venezuela
Responder Con Cita
  #5  
Antiguo 14-06-2008
madmai madmai is offline
Miembro
 
Registrado: oct 2005
Posts: 117
Poder: 19
madmai Va por buen camino
muchas gracias me ha funcionado tengo que perfeccionar cosas en el programa pero era lo que queria otra vez gracias.
Responder Con Cita
  #6  
Antiguo 15-06-2008
madmai madmai is offline
Miembro
 
Registrado: oct 2005
Posts: 117
Poder: 19
madmai Va por buen camino
Una cosa mas

Como podria añadirle la propiedad transparent al panel gracias de antemano?
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Distinguir el objeto sender en un evento vejerf Varios 5 12-02-2007 14:20:15
Sender as... modulay OOP 4 06-02-2006 17:22:53
Sender que no envia.... Phacko Varios 5 30-03-2005 17:52:58
Sobre la variable Sender yusnerqui OOP 5 25-10-2004 16:12:24
NombreProcedure(Sender/owner/etc ...)?? Giniromero OOP 7 10-10-2003 18:45:35


La franja horaria es GMT +2. Ahora son las 19:54:27.


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
Copyright 1996-2007 Club Delphi