Opened 6 years ago

Closed 6 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: wxOSX-Carbon Version:
Keywords: Cc: dianders, csomor
Blocked By: Blocking:
Patch: no

Description

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)

to:

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

...you will see that the text ends up red rather than going back to black.

Change History (2)

comment:1 Changed 6 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 ...

thanks,

Stefan

comment:2 Changed 6 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

Thanks,

Stefan

Note: See TracTickets for help on using tickets.