View Issue Details

IDProjectCategoryView StatusLast Update
0020883LazarusLCLpublic2013-06-14 12:31
ReporterMartin Friebe Assigned ToPaul Ishenin  
Status closedResolutionfixed 
Product Version0.9.31 (SVN) 
Target Version1.2.0Fixed in Version1.1 (SVN) 
Summary0020883: w32 mouse extra button 4&5 do not call MouseUp
DescriptionOn w32 TComtrol's
    procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); virtual;
is not called when the extra btn is released

the check below tests MK_XBUTTON1 against the list of buttons/keys that are currently/still down. The released btn is never in that list. statesS


    The low-order word indicates whether various virtual keys *are* down.

    The high-order word indicates which button was double-clicked. It can be one of the following values.
    XBUTTON1 0x0001 The first X button was double-clicked.
    XBUTTON2 0x0002 The second X button was double-clicked.

According to my test the high order flags are present in single click. They appear to indicate which btn changed

Similar code exists for WHXButtonDown
This means: Press and hold Extra-1, then press Extra-2. This reports a 2nd down for extra-1
Additional Informationlcl\include\
line 2315

procedure TControl.WMXButtonUp(var Message: TLMXButtonUp);
  Btn: TMouseButton;
  if (Message.Keys and MK_XBUTTON1) <> 0 then
    Btn := mbExtra1
  if (Message.Keys and MK_XBUTTON2) <> 0 then
    Btn := mbExtra2
  if (csCaptureMouse in ControlStyle) and (Btn in CaptureMouseButtons) then
    {$IFDEF VerboseMouseCapture}
    DebugLn('TControl.WMMButtonUp ',Name,':',ClassName);
    MouseCapture := False;

  DoMouseUp(Message, Btn);
TagsNo tags attached.
Fixed in Revision41684
Attached Files


Paul Ishenin

2013-06-11 08:23

manager   ~0068208

XButtonDown depends on mouse you use. I think MS made those messages for their own MS mouse. I use A4Tech with extra buttons and also see no messages and as result no LCL handlers are called.

If you have not a MS mouse then I think you also see problems.

Martin Friebe

2013-06-11 14:28

manager   ~0068219

According to my tests the message is sent (even none microsoft mouse)

But in WMXButtonUp we test for
MK_XBUTTON1 = $20;

which is not present (the button is no longer down)

However the High order word of WParam is either 1 or 2
The high-order word indicates which button was double-clicked. It can be one of the following values.
Value Meaning
XBUTTON1 0x0001 The first X button was double-clicked.
XBUTTON2 0x0002 The second X button was double-clicked.

and that is what we should test for.

The same error is in WMXButtonDown
However, other WidgetSets may not set this flag.

The low order word is like [shift, ctrl] for keys. It has nothing to do with the current click. It is a list with the states of all buttons.

Therefore if you do
- Button4 down and hold
- Button5 down

then when button5 goes down, button 4 is also in the list, and the code in WMXButtonDown sends another button4 instead of button5

Paul Ishenin

2013-06-12 11:06

manager   ~0068234

Last edited: 2013-06-12 11:06

View 2 revisions

I have no mouse to test it but now code should work properly on both win32 and cocoa. Other widgetsets does pass XButton messages as I can see - they only set the shift state.

Please test with your mouse and close if it work properly.

Martin Friebe

2013-06-14 12:31

manager   ~0068296


Issue History

Date Modified Username Field Change
2011-12-11 22:17 Martin Friebe New Issue
2011-12-11 22:17 Martin Friebe LazTarget => -
2011-12-11 22:17 Martin Friebe Widgetset => Win32/Win64
2012-03-13 08:26 Zeljan Rikalo LazTarget - => 1.2
2012-03-13 08:26 Zeljan Rikalo Status new => acknowledged
2012-03-13 08:26 Zeljan Rikalo Target Version => 1.2.0
2013-06-11 08:23 Paul Ishenin Note Added: 0068208
2013-06-11 08:23 Paul Ishenin Assigned To => Paul Ishenin
2013-06-11 08:23 Paul Ishenin Status acknowledged => feedback
2013-06-11 14:28 Martin Friebe Note Added: 0068219
2013-06-11 14:28 Martin Friebe Status feedback => assigned
2013-06-12 11:06 Paul Ishenin Fixed in Revision => 41684
2013-06-12 11:06 Paul Ishenin Note Added: 0068234
2013-06-12 11:06 Paul Ishenin Status assigned => resolved
2013-06-12 11:06 Paul Ishenin Fixed in Version => 1.1 (SVN)
2013-06-12 11:06 Paul Ishenin Resolution open => fixed
2013-06-12 11:06 Paul Ishenin Note Edited: 0068234 View Revisions
2013-06-14 12:31 Martin Friebe Note Added: 0068296
2013-06-14 12:31 Martin Friebe Status resolved => closed