wx.GenericDirCtrl change highlight colors?

I’m using the wx.GenericDirCtrl widget. I’m using SelectPath to highlight a give node. But the highlight color I can barely see. How can I change the highlight color?

Thank you…

Can someone tell me why only the first directory example (attached as a zip file) shows files, while the other two do not?

Thank you…

GenericDirCtrl.zip (1003 Bytes)

In the second example you are explicitly setting style=wx.DIRCTRL_DIR_ONLY
which actually specifies “Only show directories, and not files”.

In the third example, you are using:

filter="Php (*.php)|*.php | Txt (*.txt)|*.txt | Python (*.py)|*.py | All (*.*)|*.*")

This has space characters between the wildcard extensions and the vertical bar delimiter characters. The code is including the space characters in the patterns it’s trying to match and thus not finding any files that match.

If you change it to the following it should work:

filter="Php (*.php)|*.php| Txt (*.txt)|*.txt| Python (*.py)|*.py| All (*.*)|*.*")

Thank you very much Richard…!!!

My original post had to do with highlighting a node.

I saw a Stackoverflow post here Stackoverflow that has node highlighting (see attachment). I’m using dir when I create my GenericDirCtrl but I see extremely faint highlighting using windows 10. Can I change that highlighting so I can actually see it?

What I see in my app:

Thank you…

I don’t have any Windows machines to test on, but on my PC running Linux Mint 20.1, I notice that the highlight colour changes when I change the desktop theme.

You can access the tree control in the GenericDirCtrl using dir3.GetTreeCtrl() but I haven’t found anyway to programmatically override its highlight colour.

I think it would be possible if the GenericDirCtrl used a wx.lib.agw.customtreectrl.CustomTreeCtrl instead of a wx.TreeCtrl as the CustomTreeCtrl class has a SetHilightFocusColour() method.

I changed my Themes but did not see any difference. OK so I can’t change the highlight color of a folder.

Thank you again!!!

I had a look at wx.lib.agw.customtreectrl.CustomTreeCtrl

It looks to be more robust than the GenericDirCtrl. I’m thinking about switching over to using it.