zoukankan      html  css  js  c++  java
  • TControl.WMLButtonUp的inherited的作用——是为了给子类控件新的处理消息的机会

    意外注意到这个小细节:

    procedure TControl.WMLButtonUp(var Message: TWMLButtonUp);
    begin
      inherited; // 注意,如果是直接点击Form1,会执行TCustomForm.DefaultHandler(var Message);相当于给子类控件提供了新的处理消息的机会
      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;

    够阴险的啊,为什么要这样做呢?是为了提前把子类的一切充分融入到VCL官方框架中?

  • 相关阅读:
    第五周上机作业
    第四周练习
    第八周上机练习
    第七周作业
    第七周上机练习
    第六周作业
    第六周上机练习
    第五周上机作业
    第四周作业
    第四周上机练习
  • 原文地址:https://www.cnblogs.com/findumars/p/4758554.html
Copyright © 2011-2022 走看看