Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#14790 closed enhancement (fixed)

wxGenericDirCtrl item data accessor

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

Description

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

Attachments (3)

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

Download all attachments as: .zip

Change History (12)

Changed 21 months ago by troelsk

Trunk

comment:1 Changed 21 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.

comment:2 Changed 21 months ago by vadz

  • Priority changed from normal to low

comment:3 Changed 21 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

comment:4 Changed 21 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 21 months ago by troelsk

GetPath(wxTreeItemId)

comment:5 follow-up: Changed 21 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

comment:6 in reply to: ↑ 5 Changed 21 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!

comment:7 Changed 21 months ago by VZ

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

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

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

Closes #14790.

Changed 21 months ago by troelsk

private GetItemData()

comment:8 Changed 21 months ago by troelsk

Updated private GetItemData() patch

comment:9 Changed 21 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.