Opened 10 years ago

Closed 10 years ago

#4826 closed defect (fixed)

Can't change wxTextCtrl color back to black

Reported by: dianders Owned by: csomor
Priority: normal Milestone: 2.8.8
Component: old wxOSX/Carbon port Version:
Keywords: Cc: dianders, csomor
Blocked By: Blocking:
Patch: no


Calling SetForegroundColour() on a wxTextCtrl doesn't do anything if you are trying to set the color to black.

This is easy to see in the wxPythonDemo by modifying the TextCtrl demo.

Modify the init from:

t1 = wx.TextCtrl(self, -1, "Test it out and see", size=(125, -1))
wx.CallAfter(t1.SetInsertionPoint, 0)


t1 = wx.TextCtrl(self, -1, "Test it out and see", size=(125, -1))
origColor = t1.GetForegroundColour()
wx.CallAfter(t1.SetInsertionPoint, 0) will see that the text ends up red rather than going back to black.

Change History (2)

comment:1 Changed 10 years ago by csomor

ok, you are running into a (well meant ;-) barrier I introduced in wxMacControl::SetFont to avoid people changing the native color of a control - which eg is 90 % black or to a non-native 100 % black, when all they meant to do was 'set to default', because in that case the OS itself doesn't eg gray out the content when it's inactive ... so the 'non-native' look becomes very obvious. At the moment I'd suggest using a 99.5 % black (1,1,1), and I'll have to add an override at the textcontrol level ...



comment:2 Changed 10 years ago by csomor

  • Milestone set to 2.8.8
  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in 2.8 branch and trunk



Note: See TracTickets for help on using tickets.