解决方案 »
- 数据库查询的问题
- 我要做一个可以打开.org文件并且按照相应位置把16进制的信息显示出来!但不知如何入手请各位指教!
- 看了很多想关帖子,还是不找不到方法,再求助了: DBGrid/DBGridEh picklist有没有下拉事件
- 关于通信控件的效率
- 请问如何根据已经打开的Adoconnection和Adoquery,生成该数据库的DDL
- 升星了,散分高兴一下
- 多媒体播放源码求助
- 救命呀!再不来要死人呀!
- 哪儿有delphi c/s 版的补丁?请帮助提供。谢谢
- 哪位帮我翻译一下这编电力技术文档,非常感谢!!!!
- 睡一场觉醒来,问题不见了.小笨猫再次紧急再求救: 有关ini文件的错!
- 请问怎样打开其它的form,例如在form1中打开form2然后再关闭form1
没有找到TEdit那只是问题之一。只需要在Form上另放一个EditBox就行了。
问题之二是Create出来的Edit根本就不接收DblClick事件!
建议你从TCustomEdit或TEdit继承,自己动态创建DBLookupComboBox,再增加一个SpeedButton,模仿ComboBox中的按钮。
你的editbox的parent=nil
这样当然不会显示出来更不会响应dblclick事件了
因为你在EditDBComboBox的create创建了editbox
这样因为在这个事件中EditDBComboBox的parent=nil所以
editbox.parent:=nil
改正中
改正完毕
双击出现了faint对话框
改正完毕
小问题给你发回去
给分吧最好多给点
这分都是你的确实他们的parent都是nil,我怎么没想到?
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.