native dirctrl which looks like the tree of windows explorer??

2 views
Skip to first unread message

Martin Schulz

unread,
Oct 19, 2003, 11:27:05 AM10/19/03
to wx-u...@lists.wxwindows.org
Hi,

Is there any native dirctrl which looks like the tree of windows
explorer?/
Just like the one which dirdialog contains???

Or how to modify the code (wxDirDialog) to embed the directory tree into
a frame??

BROWSEINFO bi;
bi.hwndOwner = parent ? GetHwndOf(parent) : NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = NULL;
#ifdef __WXWINCE__
bi.lpszTitle = m_message.mb_str();
#else
bi.lpszTitle = m_message.c_str();
#endif
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)m_path.c_str(); // param for the
callback

//…..
// do show the dialog
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);

If someone gives me some useful hints, maybe I can try to embed it into
wxGenericTree!!

Best regards,
Martin


John Labenski

unread,
Oct 19, 2003, 12:24:17 PM10/19/03
to wx-u...@lists.wxwindows.org
Martin Schulz wrote:
> Hi,
>
> Is there any native dirctrl which looks like the tree of windows
> explorer?/
> Just like the one which dirdialog contains???

Is this what you're looking for? See the window on the left, you can put
the dir selector above the file selector as you see or to the left. The
files can be viewed as list, icons, or just as a tree with the files.

http://www.lehigh.edu/~jrl1/wxwindows/Plotto/plotto.png

The source is wxWidgets/src/filebrws.cpp(h) in here

http://www.lehigh.edu/~jrl1/wxwindows/Plotto/plotto_101303_alpha_src.zip

You must use wxWindows CVS HEAD since the file browser part is the list
control used for the wxGenericFileDialog which has been made into a
public class (used to be hidden in src/generic/filedlgg.cpp).

Regards,
John Labenski


Martin Schulz

unread,
Oct 19, 2003, 2:41:07 PM10/19/03
to wx-u...@lists.wxwindows.org, jr...@lehigh.edu
Hi John,

>Is this what you're looking for? See the window on the left, you can
put
>the dir selector above the file selector as you see or to the left. The
>files can be viewed as list, icons, or just as a tree with the files.

Thanks for reply.
I only need the tree part.
I want to have for example, the folder my computer, network folders and
desktop folder etc. displayed.
I have downloaded your application. But as I can see it uses generic
tree, which doesn't display the folders I mentioned.

Thanks for help,
Martin


Martin Schulz

unread,
Oct 19, 2003, 3:43:18 PM10/19/03
to wx-u...@lists.wxwindows.org, jr...@lehigh.edu
Hi John,
>Oh, I see. It looks like the wxDirDialog for msw (src/msw/dirdlg.cpp)
>just uses the native dir dialog.
I have tried to just paste the code of (src/msw/dirdlg.cpp) in to the
minmal sample.
But it only shows the directory tree in a dialog, and not inside the
minimal frame.
And I also changed the parent, but without success.


BROWSEINFO bi;
bi.hwndOwner = parent ? GetHwndOf(parent) : NULL;
bi.pidlRoot = NULL;\
bi.pszDisplayName = NULL;
#ifdef __WXWINCE__
bi.lpszTitle = m_message.mb_str();
#else
bi.lpszTitle = m_message.c_str();
#endif
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)m_path.c_str(); // param for the
callback
//...

// do show the dialog
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);


>You mean wxGenericDirCtrl? (include/wx/generic/dirctrlg.h)
Oops, yes.

>To extend it, see the function (src/generic/dirctrlg.cpp)
Ok.

>Hopefully getting the file list for these fake "drives" will work the
>same as for real drives. If thats true then it should be simple. I
>suppose you'll need to check what win95 does for backwards
compatibility
>since IIRC it didn't have it.
Will , actually I am a newbie, so I don't have any idea from IIRC.
I have been programming only with gtk and wxwindows.

>Also I suggest making your changes to the
>CVS HEAD since the wxGenericDirCtrl has gone though quite a few changes

>and is quite different than in 2.4.x.
Sure, I am using cvs.

Thanks for help,
Martin


John Labenski

unread,
Oct 20, 2003, 5:10:00 PM10/20/03
to wx-u...@lists.wxwindows.org
Martin Schulz wrote:
>>I think you'll have to duplicate the code it uses to display the other
>>directories. If only MS was open source... see their devel site and
>>hopefully there'll be some functions to help you.
>
> Oh I see.
> Now I am starting with to include all the network folders. But
> unfortunately using the function of wxwindows GetLogicalDriveStrings, I
> don't get the paths of the network folders.
> Is there no function which can show me the paths of network folders
> (also under linux)??

GetLogicalDriveStrings just gets the real drives.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getlogicaldrivestrings.asp

You can go up a few levels, but I don't see anything about the location
of My Documents (a search for that turns of all kinds of crap) or
network drives.

A list of their file system functions

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mslu/winprog/unicode_layer_file_system_functions.asp

There's nothing there so you'll just have to dig around in msdn.

Good luck,
John Labenski


Reply all
Reply to author
Forward
0 new messages