[RESOLVED]

[RESOLVED]

Hello all,

Is there any way to prevent the click on button of an TDBLookupComboBox to instead call a form that I want and prevent the dropdown list to open too?

Comments

  1. The final thing I want is a DBLookupCombo, that I could link on a TForm or a Frame, instead dropdown, like that EditBtn with DB and a lookup field

    ReplyDelete
  2. Resolved creating a new component descedant of TLookupComboBox:

    unit GDBLookupComboBox;

    interface

    uses
    Classes, DBCtrls;

    type
    TDropDownEvent = procedure (Sender: TObject; var Handled: Boolean) of object;

    TDBLookupNoComboBox = class(TDBLookupComboBox)
    private
    FOnDropDown: TDropDownEvent;
    public
    procedure DropDown; override;
    published
    property OnDropDown : TDropDownEvent read FOnDropDown write FOnDropDown;
    end;

    procedure Register;

    implementation

    { TDBLookupNoComboBox }

    procedure Register;
    begin
    RegisterComponents('Ext Comp', [TDBLookupNoComboBox]);
    end;

    procedure TDBLookupNoComboBox.DropDown;
    var
    vHandled : Boolean;
    begin
    if Assigned(FOnDropDown) then
    begin
    vHandled := True;
    FOnDropDown(Self, vHandled);
    if vHandled then
    Exit;
    end;

    inherited;
    end;

    end.

    ReplyDelete

Post a Comment