DirList Single ClickAuthor: Dave Date: 07.08.16 - 2:27am Its pretty rare than I use the VB6 dirlist control. It feels a bit old but it is easy to use. This morning I am creating a replacement for the Windows BrowseFolder dialog and using the default VB directory list control as part of it. One behavior that I dont really care for in it is that it requires you to double click on a folder in order to select it. I find myself selecting the wrong directory on occasion because it looks selected in the control, yet it is not really the actively selected directory. The question: is there an easy way to have the control auto select the folder you click on with a single click instead of a double click without subclassing? Answer: yes its easy Private Declare Sub mouse_event Lib "user32" ( _ ByVal dwFlags As Long, _ ByVal dX As Long, _ ByVal dY As Long, _ ByVal cButtons As Long, _ ByVal dwExtraInfo As Long) Private Const LEFTDOWN = &H2, LEFTUP = &H4 Private ignoreAutomation As Boolean Private Sub Dir1_Click() If ignoreAutomation Then ignoreAutomation = False Else ignoreAutomation = True mouse_event LEFTDOWN, 0&, 0&, 0&, 0& mouse_event LEFTUP, 0&, 0&, 0&, 0& DoEvents mouse_event LEFTDOWN, 0&, 0&, 0&, 0& mouse_event LEFTUP, 0&, 0&, 0&, 0& End If End Sub Comments: (3)On 08.21.16 - 12:20pm Aurel Cortez wrote:
On 08.22.16 - 6:47am Dave wrote:
On 08.28.16 - 7:55am Aurel Cortez wrote:
|
About Me More Blogs Main Site |
|||