Opened 11 years ago

Closed 10 years ago

#11461 closed defect (fixed)

Spin control constants overlap (SP_ARROW_KEYS == TE_AUTO_URL and SP_WRAP == TE_NOHIDESEL)

Reported by: philip Owned by:
Priority: normal Milestone:
Component: base Version: 2.8.x
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

When using a spin control in wxWidgets, it's impossible to set SP_ARROW_KEYS independently of TE_AUTO_URL. Ditto for SP_WRAP and TE_NOHIDESEL. The problem is that the former are both 4096 (0x1000) while the latter are both 8192 (0x2000). When a textbox and spin button are combined into one control, the constants overlap.

You can see it in this wxPython code:

spin_1 = wx.SpinCtrl(self, -1, style=wx.SP_ARROW_KEYS|wx.SP_WRAP)

assert(spin_1.GetWindowStyleFlag() & wx.SP_ARROW_KEYS)
assert(spin_1.GetWindowStyleFlag() & wx.TE_AUTO_URL)
assert(spin_1.GetWindowStyleFlag() & wx.SP_WRAP)
assert(spin_1.GetWindowStyleFlag() & wx.TE_NOHIDESEL)

It seems like an easy fix would be to just change the #defines for these constants so that they don't collide anymore.

Change History (1)

comment:1 Changed 10 years ago by VZ

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

(In [65847]) Change wxSP_XXX flags values to avoid clashes with wxTE_XXX.

wxSP_ARROW_KEYS conflicted with wxTE_AUTO_URL (which was probably not
important in practice as URLs don't appear in spin controls anyhow) and wxSPWR
conflicted with wxTE_NOHIDESEL (which could conceivably be a problem).

Change their values to reuse the bits of wxTE_CHARWRAP and wxTE_RICH2 neither
of which definitely makes sense for a spin control.

Closes #11461.

Note: See TracTickets for help on using tickets.