Ticket #14790 (closed enhancement: fixed)

Opened 7 months ago

Last modified 7 months ago

wxGenericDirCtrl item data accessor

Reported by: troelsk Owned by:
Priority: low Milestone:
Component: GUI-generic Version: 2.9-svn
Keywords: wxGenericDirCtrl Cc:
Blocked By: Patch: yes
Blocking:

Description

Spare the users from wxDirItemData* casts.
Patch:
One const public method and, for internal use, a non-const private version.

Attachments

getitemdata.patch download (5.4 KB) - added by troelsk 7 months ago.
Trunk
getitempath.patch download (2.5 KB) - added by troelsk 7 months ago.
GetPath(wxTreeItemId)
getitemdata3.patch download (2.5 KB) - added by troelsk 7 months ago.
private GetItemData()

Change History

Changed 7 months ago by troelsk

Trunk

  Changed 7 months ago by vadz

I don't know this code at all but should we really expose this (undocumented) wxDirItemData? What can you do with it exactly?

I'm, of course, fine with applying the non-public part of the patch.

  Changed 7 months ago by vadz

  • priority changed from normal to low

  Changed 7 months ago by troelsk

Undocumented indeed, and looks somewhat unfinished. But this, the item data cast, is the only way to find out which items the user is clicking, from your Connect(),

Connect(GetTreeCtrl()->GetId(), wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler(DirCtrl::OnTreeSelChange));

More:
 https://www.google.dk/search?q=wxGenericDirctrl+events

  Changed 7 months ago by vadz

I really think there should be a separate control-specific event for this instead. But failing that, adding a simple accessor for a path from wxTreeItemId would IMHO still be preferable because wxDirItemData should really have been private in the first place.

Changed 7 months ago by troelsk

GetPath(wxTreeItemId)

follow-up: ↓ 6   Changed 7 months ago by troelsk

Ok, patch updated, with "a simple accessor for a path from wxTreeItemId"

I really think there should be a separate control-specific event for this instead

+1 Very much in favour

in reply to: ↑ 5   Changed 7 months ago by vadz

Replying to troelsk:

Ok, patch updated, with "a simple accessor for a path from wxTreeItemId"

Perfect, thanks!

I really think there should be a separate control-specific event for this instead


+1 Very much in favour

I'd apply any patches implementing this. I don't know this control at all, to be honest, but it just seems completely logical to have control-specific events for something as complex/high-level as this. TIA!

  Changed 7 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [72819]) Add wxDirCtrl::GetPath().

This allows to retrieve the directory being affected by wxTreeCtrl event.

Closes #14790.

Changed 7 months ago by troelsk

private GetItemData()

  Changed 7 months ago by troelsk

Updated private GetItemData() patch

  Changed 7 months ago by VZ

(In [72841]) No changes, just some cleanup in wxGenericDirCtrl code.

Use GetItemData() helper to only write a cast to wxDirItemData in this
function instead of repeating it many times.

See #14790.

Note: See TracTickets for help on using tickets.