Question1:
函数中定义的参数:Control:TWincontrol.函数体中的Control as TListbox怎么解 释???还有:Sender as TEdit,Sender as Tcomponent也是一样的吗?
而比如:Functionname(Sender:Tobject)中的Sender 指的又是什么??Question2:
Item:=TMenuItem.Create(Self)和self.handle中的Self指的是什么?Question3:
在一个函数的末尾有个:inherited;语句又是什么意思..多谢指教!!!
函数中定义的参数:Control:TWincontrol.函数体中的Control as TListbox怎么解 释???还有:Sender as TEdit,Sender as Tcomponent也是一样的吗?
而比如:Functionname(Sender:Tobject)中的Sender 指的又是什么??Question2:
Item:=TMenuItem.Create(Self)和self.handle中的Self指的是什么?Question3:
在一个函数的末尾有个:inherited;语句又是什么意思..多谢指教!!!
(sender as TEdit).Text:=(source as TListBox)
.Items[(source as TListBox).ItemIndex];上面的代码怎么把它转换成用CB实现??关键是:sender as TEdit 这些内容怎么转??
self一般指当前和C++中的THIS指针类似
inherited;是指缺省继承父类
函数中定义的参数:Control:TWincontrol.函数体中的Control as TListbox怎么解 释???还有:Sender as TEdit,Sender as Tcomponent也是一样的吗?
as 操作符代表的是类型强制转换,
Control as TListbox意思是把Control这个变量的类型强制转换成TListbox类型。而比如:Functionname(Sender:Tobject)中的Sender 指的又是什么??
Sender是这个方法的一个参数啊,如果该方法是对象的一个事件方法,则一般代表的是对象本
身,这和调用时传递有关,注意我指的是一般而言。
Question2:
Item:=TMenuItem.Create(Self)和self.handle中的Self指的是什么?
self是一全局指针变量,指向当前类实例化后的对象指针,只能在类中使用,常用的是窗体类
中使用,作控件使经常用到。Question3:
在一个函数的末尾有个:inherited;语句又是什么意思..inherited是继乘的意思,代表的意思是调用父类的同名方法
一般该方法在父类或上层父类中定义成虚方法才能这样调用
多谢指教!!!