有没有加ToolBar.Parent := Self;?这一句。
另外可以给Toolbar.name和toolbutton.name赋值,这样出现例外也好找错。
给分请点管理。
另外可以给Toolbar.name和toolbutton.name赋值,这样出现例外也好找错。
给分请点管理。
解决方案 »
- 我又来提问了。。DBGRID 问题
- 我大学本科毕业,有一定的程序设计基础,但是我现在都不知道做什么工作好,请高手指点!
- 怎样添加一个需要调用的函数(此函数序自己写)
- 任务栏闪烁问题(急)
- 我是彩鸟!问最简单的delphi怎么写
- 200分求解!2个问题解一即可!高手进来!up有分!
- 谁来试一下
- 怎么样在OpenDialog或SaveDialog初始显示的时候用程序指定其文件名(如file.txt)?
- 怎么能获得网页中用户选中区域中的所有链接?
- 如何判断一个文件是不是zip文件???
- 我有一张光盘,(内含3个完整的不同版的winXP操作系统)!看一下所有文件大小,竟然有1个多G?这是为什么?
- 如何去掉网点
TStandardPanel.Parent := AOwner;
Thx!我知道问题出在ToolButton.Parent:=ToolBar一句,ToolButton一般必须有parent Window,而控件一般没有parent Window,所以我不知道如何处理,
大概要用MAPI吧。
有没有人知道详细情况的,答出者一定给分!
constructor TStandardToolBar.Create(AOwner: TComponent);
begin
TStandardPanel:=inherited Create(AOwner);
TStandardToolBar和TStandPanel那个是你要作的控件?
如果都是,请务必如下:
constructor TStandardPanel.create(AOwner: TComponent)
begin
inherited Create(AOwner);
Parent := AOwner;
end;constructor TStandardToolBar.create(AOwner: TComponent)
begin
inherited Create(AOwner);
Parent := AOwner;
end;
使用TToolButton.SetToolBar(YourToolBar)。
TStandardPanel:=inherited Create(self);你试试
begin
inherited Create(AOwner);
Parent := AOwner;FToolbar := TToolBar.Create(Self);
FToolbar.Parent := Self;
end;
Thx!Panel上放SpeedButton就没有问题,因为ToolButton无输入焦点,
而SpeedButton有,我认为这是区别,大概要处理W Message,不知如何处理。
也许你的初始化代码(有关Window handle的)放在此处。
procedure CreateParams(var Params: TCreateParams); override;
begin
inherited CreateParams(Params);
inherited Create(AOwner);
FToolbar := TToolBar.Create(Self);
FToolbar.Parent := Self;end;
procedure CreateParams(var Params: TCreateParams); override;
begin
inherited CreateParams(Params);
inherited Create(AOwner);
FToolbar := TToolBar.Create(Self);
FToolbar.Parent := Self;end;
Thx,能不能写详细点?inherited Create(AOwner);一句是不是在 constructor Create(AOwner: TComponent); override;中调用?
CreateParams(var Params: TCreateParams); override;中没有AOwner啊!还有FToolbar := TToolBar.Create(Self);
FToolbar.Parent := Self;
我全都放在Create(AOwner: TComponent); 中了,还是出现
Control '' has no parent window
错误。
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, ComCtrls;type
TStandardPanel = class(TPanel)
private
{ Private declarations }
FToolBar: TToolBar;
FToolButton: TToolButton;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [TStandardPanel]);
end;constructor TStandardPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.Width := 200;
Self.Height := 100;
//这句是必须的
Parent := TWincontrol(AOwner); FToolBar := TToolBar.Create(AOwner);
FToolbar.Parent := Self;
FToolButton := TToolButton.Create(AOwner);
FToolButton.Parent := FToolbar;
end;destructor TStandardPanel.Destroy;
begin
FToolButton.Free;
FToolBar.Free;
end;end.
Thanks very much?
点管理中的给分就可以将100分全给你吗?
请多关照!