Ver Mensaje Individual
  #1  
Antiguo 10-04-2010
Avatar de edgwin
edgwin edgwin is offline
Miembro
 
Registrado: abr 2006
Ubicación: Guadalajara Jal. Mex
Posts: 163
Reputación: 19
edgwin Va por buen camino
Propiedad Text en DBLookUpComboBox

Hola amigos del foro.

Estoy tratando de crear un componente personalizado heredado de DBLookUpComboBox y quiero agregarle la propiedad "Text".

Este es mi codigo:

Código Delphi [-]
unit DBUPCLookupComboBox;
 
interface
 
uses
  SysUtils, Classes, Controls, DBCtrls, Messages, Dialogs ;
 
type
  TDBUPCLookupComboBox = class(TDBLookupComboBox)

  private
    function GetText: TCaption;
    procedure SetText(const Value: TCaption);
  protected
    {}
  public
    {}
  published
    property Text: TCaption read GetText write SetText;
  end;
 
procedure Register;
 
implementation
 
function TDBUPCLookupComboBox.GetText: TCaption;
var
  Len: Integer;
begin
  Len := GetTextLen;
  SetString(Result, PChar(nil), Len);
  if Len <> 0 then GetTextBuf(Pointer(Result), Len + 1);
end;
 
procedure TDBUPCLookupComboBox.SetText(const Value: TCaption);
begin
  if GetText <> Value then SetTextBuf(PChar(Value));
end;
 
procedure Register;
begin
  RegisterComponents('UPC', [TDBUPCLookupComboBox]);
end;
end.

Pero cuando instalo y trato de aplicar algun texto a la propiedad "Text" simplemente no lo hace.

¿Alguien me puede ayudar?

Gracias!
Responder Con Cita