Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#14792 closed enhancement (fixed)

wxGenericDirCtrl selected event EVT_DIRCTRL_CHANGED()

Reported by: troelsk Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: wxGenericDirCtrl Cc:
Blocked By: Blocking:
Patch: yes

Description

Currently it is not obvious how to/that you can get selection events (from the tree control embedded inside wxGenericDirCtrl)
Patch: Make it obvious

Attachments (2)

event.patch download (4.2 KB) - added by troelsk 18 months ago.
Trunk
event2.patch download (770 bytes) - added by troelsk 18 months ago.
Event details

Download all attachments as: .zip

Change History (7)

Changed 18 months ago by troelsk

Trunk

comment:1 Changed 18 months ago by vadz

  • Status changed from new to confirmed

Nice, thanks, I'll commit it soon.

But currently the event is sent even for the changes done by the program (which, BTW, resulted in a crash on startup of the widgets sample if the wxDirCtrl page was the initially selected one, as we received an event before m_dirCtrl was initialized). I'm not sure if it's really a good idea, perhaps the code of the control should be modified to ignore the changes from the program itself?

comment:2 Changed 18 months ago by VZ

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

(In [72842]) Added wxEVT_COMMAND_DIRCTRL_CHANGED for wxDirCtrl selection changes.

This makes it much simpler to react to the changes in the control, update the
sample to show it.

Closes #14792.

comment:3 Changed 18 months ago by troelsk

Great, thanks.

Not something I need myself, but maybe Veto() should be taken into account,

wxGenericDirCtrl::OnTreeSelChange()
{
    ....
    if (changedEvent.IsAllowed())
    {
        event.Skip();
    }
    else
    {
        event.Veto();
    }
}

Changed 18 months ago by troelsk

Event details

comment:4 Changed 18 months ago by troelsk

Argh, also forget SetEventObject(). Added patch.

comment:5 Changed 18 months ago by VZ

(In [72912]) Minor improvements to wxEVT_COMMAND_DIRCTRL_CHANGED generation.

Set the event object for this event. Also don't skip the original tree event
if the wxEVT_COMMAND_DIRCTRL_CHANGED event was handled and disallowed.

Closes #14792.

Note: See TracTickets for help on using tickets.