非常超值的问题,需要了解CBuilder和Delphi的

albeta 2003-09-05 02:52:12
TButton Button1;
...
if Assigned(Button1) then
begin
....
end

里头的Asssigned()在CBuilder里头怎么表示啊
...全文
52 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Maple119 2003-09-06
  • 打赏
  • 举报
回复
这些都是DELHI的语法格式吗???为什么我看不明白....

Assigned函数我经常用过.是用来判断一个指针是否为有效(空值);
比如:
IF Not Assigned(Form1) Then Application.CreateForm(Form1, TForm1);
Form1.Show;

注:如果不在Form1的ONClose或者OnDestroy里写上一行代码: Form1:= Nil;那么,当Form1释放之后,再次去执行上述的代码时,第二行会出错.
albeta 2003-09-06
  • 打赏
  • 举报
回复
TButton *Button;
Button = new TButton(Form1);
delete Button;
if(Button)
{
.....
}
....
楼上的朋友,如果这样。。。。。,恐怕就有问题哦。
cmain83 2003-09-06
  • 打赏
  • 举报
回复
每次注销一个指针变量后
最好再赋一个空值..

CB 中 Button1 = NULL;
DELPHI 中 Button1 := NIL;

zjqyb 2003-09-06
  • 打赏
  • 举报
回复
TButton *Button;
Button = new TButton(Form1);
delete Button;
Button =NULL;//最好加上
zjqyb 2003-09-06
  • 打赏
  • 举报
回复
TButton *Button1=NULL;
...
if(Button1)
{
...
}
hexenzhou 2003-09-05
  • 打赏
  • 举报
回复
Button1只是一个指针,在CB里其值只要不是NULL就是有效的。

TButton *Button1
...
if(Button1)
{
...
}

IORILI 2003-09-05
  • 打赏
  • 举报
回复
没用过 帮你UP
deeply 2003-09-05
  • 打赏
  • 举报
回复
gz

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧