PageControl cant't catch left mouse double click event? lazarus / 31-LCL ---------------------------------------------------------------------- canmao · 2013-11-21 14:50 Code: [Select]procedure TForm1.PageControl1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); var Index: Integer; begin    if (ssDouble in Shift) then    begin       if Button = mbLeft then       Index := PageControl1.IndexOfTabAt(X,Y);       PageControl1.Pages[Index].Free;    end; end;  Hi!everybody! i use code like these.but the sheet which i double clicked isn't closed.so i change code as below. Code: [Select]procedure TForm1.PageControl1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); var Index: Integer; begin       if Button = mbLeft then       Index := PageControl1.IndexOfTabAt(X,Y);       PageControl1.Pages[Index].Free; end;  it's worked.the sheet is closed.so where am i wrong? ---------------------------------------------------------------------- engkin · 2013-11-21 15:11 Did you miss to write begin/end after the second if? Code: [Select]procedure TForm1.PageControl1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); var Index: Integer; begin    if (ssDouble in Shift) then    begin       if Button = mbLeft then       begin         Index := PageControl1.IndexOfTabAt(X,Y);         PageControl1.Pages[Index].Free;       end;    end; end; Assuming it works, you could merge both ifs: Code: [Select]   if (ssDouble in Shift) and (Button = mbLeft) then ---------------------------------------------------------------------- canmao · 2013-11-21 15:30 Quote from: engkin on November 21, 2013, 04:11:29 pmDid you miss to write begin/end after the second if? Code: [Select]procedure TForm1.PageControl1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); var Index: Integer; begin    if (ssDouble in Shift) then    begin       if Button = mbLeft then       begin         Index := PageControl1.IndexOfTabAt(X,Y);         PageControl1.Pages[Index].Free;       end;    end; end; Assuming it works, you could merge both ifs: Code: [Select]   if (ssDouble in Shift) and (Button = mbLeft) then thanks for your replay! but i use two methods.merge ifs and add begin/end code(just copy your code ).they all didn't work. Code: [Select] if (ssDouble in Shift) and (Button = mbLeft)  then  i google it , it's worked on delphi.is it a bug?