Can I have multiple selections in wxGenericDirCtrl? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Nintendofreak88
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Mar 14, 2005 2:16 am

Can I have multiple selections in wxGenericDirCtrl?

Post by Nintendofreak88 » Tue Jan 10, 2006 3:22 am

Is there some way to have multiple selections in wxGenericDirCtrl? I've tried setting the wxTreeCtrl's style like this:

Code: Select all

myDirCtrl->GetTreeCtrl()->SetWindowStyle(wxMULTIPLE);
But, my program crashes as soon as it starts up. Any ideas why? :(

Nintendofreak88
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Mar 14, 2005 2:16 am

Post by Nintendofreak88 » Wed Jan 18, 2006 11:45 pm

My question hasn't been answered in quit a while... Does anyone have an idea? Should I submit it as a bug? :?

wxuser
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Feb 25, 2005 5:45 am
Location: India

Post by wxuser » Thu Jan 19, 2006 6:15 am

Is there some way to have multiple selections in wxGenericDirCtrl?
I am not sure either, but here are few comments.

regarding your code

Code: Select all

myDirCtrl->GetTreeCtrl()->SetWindowStyle(wxMULTIPLE);
See window styles for wxTreeCtrl its wxTR_MULTIPLE for multiple selection. but i dont know if this change would help.

One more way would be to have a look at how wxGenericDirCtrl gets the info from wxTreeCtrl and try to fix any problems there.

hope this helps

PS: If you solve this issue, please do post back with the fix so that others will know when they search

DavidHart
Site Admin
Site Admin
Posts: 4021
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Thu Jan 19, 2006 12:07 pm

(In case that doesn't help:)

I'm sure it's possible. In 2.4.2, it wasn't possible to get close enough to the treectrl even by subclassing, so I ended up copying most of the wxGenericDirCtrl code into my class. It was then easy to add:
treeStyle |= wxTR_MULTIPLE; treeStyle |= wxTR_EXTENDED;
before the tree was created with the style treeStyle.

In 2.6.2, there is a new member function, wxGenericDirCtrl::CreateTreeCtrl(), that allows you to recreate the tree as you wish. It's protected so you'll have to subclass.

David

Nintendofreak88
Knows some wx things
Knows some wx things
Posts: 28
Joined: Mon Mar 14, 2005 2:16 am

Post by Nintendofreak88 » Thu Jan 19, 2006 1:08 pm

See window styles for wxTreeCtrl its wxTR_MULTIPLE for multiple selection. but i dont know if this change would help.
Sorry, that was just a typo in my code above, I am using wxTR_MULTIPLE.
I'm sure it's possible. In 2.4.2, it wasn't possible to get close enough to the treectrl even by subclassing, so I ended up copying most of the wxGenericDirCtrl code into my class. It was then easy to add:
treeStyle |= wxTR_MULTIPLE; treeStyle |= wxTR_EXTENDED;
before the tree was created with the style treeStyle.

In 2.6.2, there is a new member function, wxGenericDirCtrl::CreateTreeCtrl(), that allows you to recreate the tree as you wish. It's protected so you'll have to subclass.
Thanks, it worked perfectly! :D

Post Reply