Jump to content


Popular Content

Showing content with the highest reputation on 06/24/2020 in all areas

  1. 1 point

    mouse position

    Thank you. This is one of the really old demos where lots of code is in TForm1.InitializeObject. When that is done, you run the risk of everything not being initialized when your code runs. Standard fix is to move the code to TForm1.InitializeForm: type TForm1 = class(TW3Form) private {$I 'Form1:intf'} FIsCapture: boolean; function MakeMouseEvent(label: TW3Label; name: string): TMouseEvent; function MouseToStr(shift: TShiftState; x, y: integer; scrXY: TPoint): string; protected procedure InitializeForm; override; procedure InitializeObject; override; end; implementation { TForm1} procedure TForm1.InitializeObject; begin inherited; {$I 'Form1:impl'} end; procedure TForm1.InitializeForm; procedure EndCapture; begin W3pnlSetCapture.Visible := true; W3pnlReleaseCapture.Visible := false; W3Panel2.OnMouseUp := nil; FIsCapture := false; end; begin inherited; OnMouseMove := MakeMouseEvent(W3lblFormCoords, 'Form'); W3Panel1.OnMouseMove := MakeMouseEvent(W3lblPanel1Coords, 'Panel1');
  • Create New...