从表面看不出问题所在
请发源码至
[email protected]

解决方案 »

  1.   

    Self.BringToFront这一句需要吗?
      

  2.   

    我安装了你的控件,没有问题,但是一旦运行就出错,提示没有找到Tedit这个类
      

  3.   

    安装不会有任何问题。
    没有找到TEdit那只是问题之一。只需要在Form上另放一个EditBox就行了。
    问题之二是Create出来的Edit根本就不接收DblClick事件!
      

  4.   

    你可以用vcl标准控件试一下,如果每问题就是你的控件有问题否则就是Delphi的问题
      

  5.   

    你的问题估计是DBLookupComboBox把Edit给挡住了。
    建议你从TCustomEdit或TEdit继承,自己动态创建DBLookupComboBox,再增加一个SpeedButton,模仿ComboBox中的按钮。
      

  6.   

    我faint,可千万别是Delphi的问题
      

  7.   

    我试了一下
    你的editbox的parent=nil
    这样当然不会显示出来更不会响应dblclick事件了
    因为你在EditDBComboBox的create创建了editbox
    这样因为在这个事件中EditDBComboBox的parent=nil所以
    editbox.parent:=nil
    改正中
      

  8.   

    ok
    改正完毕
    双击出现了faint对话框
    改正完毕
    小问题给你发回去
    给分吧最好多给点
      

  9.   

    多谢多谢!我们的mail服务器慢,收到后一定给分...
    这分都是你的确实他们的parent都是nil,我怎么没想到?
      

  10.   

    好了来了
    unit EditDBComboBox;interfaceuses
         Windows, Messages, SysUtils, Classes, Controls, DBCtrls,
         StdCtrls, Dialogs;Type    TEditDBComboBox = Class(TDBLookupComboBox)
        Private
            EditBox : TEdit;
            Procedure SetText(SText:String);
            Function GetText():String;
            Procedure ShowComboBox(Sender :TObject);
            Procedure HideComboBox(Sender :TObject);
        Protected
            Procedure WMSize(var Msg: TMessage); message WM_SIZE;
            Procedure WMMove(var Msg: TMessage); message WM_Move;
        Public
            Constructor Create(AOwner: TComponent); Override;
            Destructor Destroy; Override;
        Published
            Property theText: String read GetText write SetText;
        End;Procedure Register();implementation{ TEditDBComboBox }constructor TEditDBComboBox.Create(AOwner: TComponent);
    begin
        inherited;
        Self.EditBox := TEdit.Create(AOwner);
        With Self.EditBox Do
        Begin
            OnDblClick := Self.ShowComboBox;
            Parent:= twincontrol(Aowner);
            Left := Self.Left;
            Top := Self.Top;
            Width := Self.Width;
            Height := Self.Height;
            ReadOnly := True;
            Show;
        End;
        Self.OnClick := HideComboBox;
        Self.Visible := False;End;destructor TEditDBComboBox.Destroy;
    begin
        EditBox.Free;
        inherited;
    end;function TEditDBComboBox.GetText: String;
    begin
        Result := Self.Text;
    end;procedure TEditDBComboBox.HideComboBox(Sender :TOBject);
    begin
        Self.Hide;
        Self.EditBox.Text := Self.Text;
    end;procedure TEditDBComboBox.SetText(SText: String);
    begin
        Self.EditBox.Text := SText;
    end;procedure TEditDBComboBox.ShowComboBox(Sender: TObject);
    begin
        ShowMessage('faint');
        Self.BringToFront;
        EditBox.Hide;
        Self.DropDown;
    end;procedure TEditDBComboBox.WMMove(var Msg: TMessage);
    begin
        With Self.EditBox Do
        Begin
            Left := Self.Left;
            Top := Self.Top;
            Width := Self.Width;
            Height := Self.Height;
        End;
    end;procedure TEditDBComboBox.WMSize(var Msg: TMessage);
    begin
        With Self.EditBox Do
        Begin
            Left := Self.Left;
            Top := Self.Top;
            Width := Self.Width;
            Height := Self.Height;
        End;
    end;Procedure Register();
    Begin
      RegisterComponents('Samples', [TEditDBComboBox]);
    End;end.