Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12045 closed defect (fixed)

wxSpinCtrlDouble ignores mouse input after being disabled and re-enabled

Reported by: amz Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: wxSpinCtrlDouble Cc:
Blocked By: Blocking:
Patch: no

Description

As described in the summary, if you call Enable(false) and then Enable(true) on a wxSpinCtrlDouble control, it ceases responding to mouse events. Specifically:

  • Clicking on it won't make it take focus
  • Clicking on the spin buttons won't change the value of the field

However, keyboard operation still works; I can tab into it and manually enter values, as well as press up and down to "spin" the control. It also "looks" enabled.

wxSpinCtrl (which is implemented natively) works as intended.

I'm using the April 30th snapshot of wxWidgets (available from front page), compiled on Microsoft Visual Studio 2010, and running on Windows 7 Business.

This issue might be related to issue #12004.

I have reproduced the bug on the "widgets" sample, unified diff file is attached.

Attachments (1)

wxspinctrldouble-widgets-sample.diff download (511 bytes) - added by amz 5 years ago.
Unified diff file demonstrating the issue

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by amz

Unified diff file demonstrating the issue

comment:1 Changed 5 years ago by vadz

  • Status changed from new to confirmed

Yes, I can see this, will have a look, thanks for reporting.

comment:2 Changed 5 years ago by VZ

(In [64301]) Use GetWidgets() in the widgets samples instead of GetWidget2().

Add a function which can be overridden to return an arbitrary number of
widgets instead of having just GetWidget() and GetWidget2(): spin control page
already uses 3 widgets (and defines GetWidget3() which is never called) and we
could have even more in the future. Just use a generic solution which will
always work.

The practical consequence of this is that the "Enable/Disable" menu item now
also enables and disables the wxSpinCtrlDouble in the spin page, see #12045.

comment:3 Changed 5 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [64302]) Never enable wxSpinCtrlGenericBase window itself at underlying toolkit level.

We create wxSpinCtrlGenericBase window disabled at underlying toolkit level
(but enabled at the level of wxWidgets API, of course), but calling Disable()
and Enable() on it re-enabled it resulting in loss of mouse events under
Windows.

Don't re-enable it (again, at the low-level toolkit level only) in its
Enable() any more but keep this window itself always disabled.

Closes #12045.

comment:4 Changed 3 years ago by VZ

(In [70178]) Better fix for wxSpinCtrlGeneric enabling/disabling bug in wxMSW.

To really ensure that the window containing the components of wxSpinCtrlGeneric
is never enabled under MSW (as we want to avoid this to ensure that any input
always goes to its children and not the window itself, see #12045), override
DoEnable() and not Enable(). This takes care of the case when the control gets
implicitly disabled because its parent is.

Closes #13142.

Note: See TracTickets for help on using tickets.