Mouse Button State lazarus / 31-LCL ---------------------------------------------------------------------- simsee · 2016-12-10 12:22 In a GUI context, inside an event handler procedure of a TCustomControl component, I should know the state of mouse buttons. I know that Mouse.CursorPos allows to get the position and that mouse unit of RTL don't work in graphic mode. I can't use classic eventi as OnClick, OnMouseUp, OnMouseDown because I'm already inside another event handler procedure. So, how can I do? Thanks! ---------------------------------------------------------------------- Leledumbo · 2016-12-10 14:10 Create a variable maintaining the mouse state yourself (set, boolean array, whatever, you choose). Inside the "classic" events, mark corresponding states in the variable. In another event, check them. ---------------------------------------------------------------------- simsee · 2016-12-10 14:30 I used a global boolean variable as a flag, that is set to True by OnMouseDown event handler and to False by OnMouseUp. I asked to the forum because I did not know if there were better solutions. Thanks again! ---------------------------------------------------------------------- Blaazen · 2016-12-10 17:18 The same way you call Mouse.CursorPos you can call function GetKeyShiftState (unit Controls) and test if mouse buttons are pushed (ssLeft, ssMiddle, ssRight). ---------------------------------------------------------------------- simsee · 2016-12-10 19:17 Thanks Blaazen. I looked at this unit, but I have not noticed this function, which unfortunately is not documented ...