How do I read mouse button state in a MouseMove eventt? lazarus / 21-General ---------------------------------------------------------------------- 741 · 2025-08-01 19:43 The MouseMove event appears to only get called if no buttons are pressed. I am considering setting a global variable when the button is pressed, but that feels like bad style. procedure TfrmMain.pbxGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var    aButton: Word; begin   //Decide which cell we are in   cellX := X DIV gridSizX;   cellY := (pbxFieldPro.Height - Y) DIV gridSizY; //Want 'Y' "going upwards"   sbrImagZ.Panels[4].Text := Format('pbxField: (x:%d, y:%d) --> Cell = (%d, %d)', [X, Y, cellX, cellY]); //PROBLEM: If mouse button is down we do not see the move event[?]. On release we see the move, but then the button is zero   aButton := GetMouseButtons;   sbrImagZ.Panels[0].Text := Format('Button = $%2X', [aButton]);   if MouseLeftButton = GetMouseButtons then   begin //##############Never get here UNTIL button released#####################      pbxFieldProMouseDown(pbxFieldPro, mbLeft, Shift, X, Y);   end;//if end;//pbxGridMouseMove ---------------------------------------------------------------------- jamie · 2025-08-01 22:24 Mouse Move works for me no matter what button I hold down, it still gets called. What widget are you on? and btw.. is 741 anything to do with the LM741 op-amp ? Jamie ---------------------------------------------------------------------- 741 · 2025-08-02 10:06 Hi "What widget are you on?". Not sure how to find the answer to that (!) I will admit I am not a regular Lazarus user (I used to code with Delphi lots some years ago though). Yes, the famous 741 op-amp  Please can you post your code where MouseMove is seen, even when the left button is continually down? Regards Stephen ---------------------------------------------------------------------- Sieben · 2025-08-02 10:25 With mouse events the Shift parameter also holds information about the mouse buttons: https://www.freepascal.org/docs- html/rtl/classes/tshiftstate.html ---------------------------------------------------------------------- 741 · 2025-08-02 10:35 Very interesting - thank you