Opened 6 months ago

Closed 6 months ago

#15940 closed defect (fixed)

Programatically checking wxRearrangeList item does not update checked info in its order list

Reported by: PB Owned by:
Priority: normal Milestone:
Component: GUI-all Version: 3.0.0
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

When calling SetCheck() on wxRearrangeControl, its m_order list containing not only the order of its items but also their state is not updated; SetCheck() is a method inherited from wxCheckListBox.

How to reproduce (the debug build):

  1. Create a wxRearrangeControl and toggle an item selection programatically.
  2. Attempt to (un)check the same item manually in the UI.
  3. Assert pops up:

src\common\rearrangectrl.cpp(176): assert "(m_order[n] >= 0) == IsChecked(n)" failed in wxRearrangeList::OnCheck(): discrepancy between internal state and GUI

The patch modifying dialogs sample demonstrates the issues using wxRearrangeDialog. Run the patched sample, open the dialog (Ctrl+R) and click the checkbox of the first item to invoke the assert dialog.

I can test only on MSW, so I don't know if it works on other OSes.

Attachments (1)

dialogs.cpp.patch download (410 bytes) - added by PB 6 months ago.

Download all attachments as: .zip

Change History (2)

Changed 6 months ago by PB

comment:1 Changed 6 months ago by VZ

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

(In [75786]) Allow using wxRearrangeList::Check() to change state programmatically.

Previous this resulted in an assert and broken behaviour as it didn't update
the internally stored state. Do update it now and remove the assert as it
isn't possible to distinguish between user code calling Check() and wxGTK
doing it itself from wxCheckListBox implementation.

Closes #15940.

Note: See TracTickets for help on using tickets.