Opened 13 months ago

Closed 5 months ago

Last modified 5 months ago

#15543 closed defect (fixed)

wxColourProperty with wxPGEditor_ComboBox editor--have to hit Cancel twice when cancelling custom color

Reported by: snowleopard2 Owned by: VZ
Priority: normal Milestone:
Component: wxPropertyGrid Version: dev-latest
Keywords: wxColourProperty wxPropertyGrid wxSystemColourProperty Cc:
Blocked By: Blocking:
Patch: yes

Description

In the propgrid sample, expand the "ColourProperty" property (on the last page), which is a wxColourProperty with wxPGEditor_ComboBox as its editor.

Select "Custom" and when the color dialog appears, hit Cancel. Note that the dialog appears a second time, so you have to cancel it a second time.

Attachments (1)

Fixes-retrieving-the-value-of-custom-color.patch download (2.0 KB) - added by awi 5 months ago.
Fixes retrieving color value from wxSystemColourProperty.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 months ago by awi

  • Keywords wxSystemColourProperty added
  • Patch set
  • Version changed from 2.9.5 to dev-latest

It seems this issue can be also reproduced in the propgrid sample taking the following steps:

  1. Select any predefined color in any colour selector, e.g. in "Cell Colour".
  2. Select "Custom" colour in this selector and when the dialog box appears hit Cancel.
  3. Dialog box reappears.

This issue is caused by improper querying for the color in the event handler. Color picker is invoked twice: when the current value is retrieved from the control and when the event is actually processed.
First action is unnecessary.
Patch fixing this issue is attached.

Changed 5 months ago by awi

Fixes retrieving color value from wxSystemColourProperty.

comment:2 Changed 5 months ago by vadz

Thanks a lot for fixing this!

I do wonder about wxPG_PROPERTY_SPECIFIC though, this looks like a gross hack to me. Would it make sense to replace it with something better, more clearly separating the user-initiated action from a simple query? Of course, perhaps I'm missing some deeper reason(s) for doing it like this...

comment:3 Changed 5 months ago by VZ

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

In 76593:

Avoid showing the colour selection dialog twice in wxPropertyGrid.

Selecting "Custom" in a colour property cell resulted in the colour selection
dialog being shown twice if it was cancelled the first time.

Fix this by using wxPG_PROPERTY_SPECIFIC to indicate that the value is just
being queried and the user shouldn't be asked to enter it, as it is already in
the other places.

Closes #15543.

comment:4 Changed 5 months ago by VZ

In 76597:

Avoid showing the colour selection dialog twice in wxPropertyGrid.

Selecting "Custom" in a colour property cell resulted in the colour selection
dialog being shown twice if it was cancelled the first time.

Fix this by using wxPG_PROPERTY_SPECIFIC to indicate that the value is just
being queried and the user shouldn't be asked to enter it, as it is already in
the other places.

Closes #15543.

Note: See TracTickets for help on using tickets.