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!