回调过程,帮忙解释一下文中的源代码(鼠标单击行为)(100分)

L

loutian

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure wmlbuttonup(var message:twmlbuttonup);message wm_lbuttonup;
procedure tcontrol.wmlbuttonup(var message:twmlbuttonup);
begin
inherited;
if cscapturemouse in controlstyle then mousecapture:=false;
if csclicked in controlstate then
begin
exclude(fcontrolstate,csclicked);
if ptinrect(clientrect,smallpointtopoint(message.pos)) then
click;
end;
domouseup(message,mbleft);
end;

procedure tcontrol.click;
begin
if assigned(fonclick) and (action<> nil)
and(@fonclick<>@ action.inexcute)
then fonclick(self)
else if not (csdesigning in componentstate)
and(actionlink<> nil) then
actionlink.execute
else if assigned(fonclick) then
fonclick(self);
end;
 
帮帮忙解释一下
 
procedure tcontrol.wmlbuttonup(var message:twmlbuttonup);
begin
inherited;
if cscapturemouse in controlstyle then mousecapture:=false
//如果控件captureb了mouse释放它
if csclicked in controlstate then  //如果单击了mouse左键
begin
exclude(fcontrolstate,csclicked);//去掉单击了mouse左键标志,表示处理过
if ptinrect(clientrect,smallpointtopoint(message.pos)) then//如果mouse在control的客户区内
click
//调用click过程
end;
domouseup(message,mbleft)
//调用domouseup过程,
end;

procedure tcontrol.click;
begin
if assigned(fonclick) and (action<> nil) //如果存在onclick事件代码并且这个控件连接其它控件
and(@fonclick<>@ action.inexcute)  //并且control的onclick事件处理跟连接到这个control的control的连动代码不是同一个过程
then fonclick(self) //处理onclick事件
else if not (csdesigning in componentstate)//否则如果不在设计状态
and(actionlink<> nil) then  // //如果连接了其它control
actionlink.execute //执行它的execute
else if assigned(fonclick) then //否则,如果存在onclick
fonclick(self);  //处理onclick
end;


基本如此了
 
接受答案了.
 
顶部