If I doubleclick on a DirectoryListBox, Delphi returns the directory above the clicked one. A second doubleclick on the same directory returns the wanted directory. How do I select the intended directory in one doubleclick?
In the OnDblClick event I use Dir:=DirectoryListBox1.Directory. What am I doing wrong? Anybody?
Regards Bo

1 Year
Discussion Span
Last Post by Bo_1

It is always a good idea to look at the source code in cases like this, if you have the VCL sources in your Delphi version. That way you can trace how the control responds to the double click.

Basically what is happening is that TDirectoryListBox fires off the onDblClick event before it changes the directory. This is so you can handle that event to do things for which you need to know which directory was selected before the change. If you want to know the directory after the change, handle the onChange event instead (or as well).


Thank You very much! I thought it was someting like this, but I have struggled many years with this. I'll try the solution.
Regards Bo


Tested and works very good, now I have learned me something new and essential.
Thank you very much, good to have Daniweb!
Regards Bo

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.