Opened 13 months ago

Closed 4 months ago

#15597 closed defect (fixed)

Synchronize colour names between wxPropertyGrid and wxColourDatabase

Reported by: antont Owned by: AW
Priority: low Milestone:
Component: wxPropertyGrid Version: 3.0.0
Keywords: simple Cc:
Blocked By: Blocking:
Patch: no


When the value of a wxColourProperty is used to initialize a wxColour, some of the colour names are not recognized.

The colour names in gs_cp_es_normcolour_labels (advprops.cpp) are not compatible with the names that are used to initialize a wxColour, in wxColourDatabase::Initialize, e.g.
"Lime" vs "GREEN"
"Fuchsia" vs "MAGENTA"
"Aqua" vs "CYAN"
"Maroon" (128,0,0) vs "MAROON" (142,35,107)

Run propgrid sample, go to a wxColourProperty (not wxSystemColourProperty) - e.g. Colour under FontDataProperty, click [...] button, enter (0,255,0): string value is set to "Lime". That string is not recognized when you try to use it to initialize a wxColour. Enter "red" in the edit box: colour is changed to red. Enter "lime" in the edit box: colour is changed to lime, but an error message appears in the Log Message window:
wxColour::Set - couldn't set to colour string 'lime'

Attachments (1)

advprops.cpp.patch download (1.4 KB) - added by antont 13 months ago.
patch - proposed fix

Download all attachments as: .zip

Change History (6)

Changed 13 months ago by antont

patch - proposed fix

comment:1 Changed 12 months ago by vadz

Thanks, I'm going to apply this patch for now but the real solution would be to avoid redefining the colours already present in wxColourDatabase here, I see absolutely no good reason for doing it (if anybody really wants to use "lime", we could add it to the list of the recognized colours). If you can make another patch doing this, it would be very welcome. TIA!

comment:2 Changed 12 months ago by VZ

(In [75066]) Remove wxPropertyGrid colours not recognized by wxColour.

Don't use colour names which can't be used to successfully initialize

This is not the best solution, we probably should add these names to the
colour database instead, but for now it's better than getting errors when
trying to use these colours for colour properties in wxPropertyGrid.

See #15597.

comment:3 Changed 12 months ago by vadz

  • Keywords simple added
  • Patch unset
  • Priority changed from normal to low
  • Status changed from new to confirmed
  • Summary changed from wxColourProperty colour names are not compatible with the names in wxColourDatabase to Synchronize colour names between wxPropertyGrid and wxColourDatabase
  • Version changed from 2.9-svn to 3.0.0-rc1

I'm intentionally leaving this ticket opened, albeit at lower priority.

comment:4 Changed 11 months ago by vadz

  • Version changed from 3.0.0-rc1 to 3.0.0

Just changing version as these tickets are still present in 3.0.0. final.

comment:5 Changed 4 months ago by AW

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

In 76893:

Allow use of all wxPG colours.

wxPG-specific colours are added to the colour database when wxColourProperty is created (already existing colours are not overwritten by wxPG ones).
Original list of wxPG colours was restored.

Closes #15597.

Note: See TracTickets for help on using tickets.