My Assistant
![]() ![]() |
|
|
Dec 7 2006, 11:56 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 112 |
I have a button on my form that runs the BrowseforFolder module. This allows the user to access photos in a folder on their computer. I would like to disable two buttons on the mainform so the user can not click on them while having the browse for folder window open. I have succeeded on disabling the two buttons by calling a mouse down procedure, but have been unsuccessful on enabling the two buttons when either the user selects OK or CANCEL on the browse for folder window. I have tried the On Activate and On Got Focus procedures for the main form. Nothing seems to work. Any suggestions?
|
|
|
|
Dec 7 2006, 12:00 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Hi,
what BrowseForFolder module do you mean? Normally you would open up a dialog to browse through directories and these dialogs are normally modal meaning that nothing else can be selected/touched until either OK or CANCEL was pressed. HTH Good luck |
|
|
|
Dec 7 2006, 12:44 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 112 |
Option Compare Database
Option Explicit '************** Code Start ************** 'This code was originally written by Terry Kreft. 'It is not to be altered or distributed, 'except as part of an application. 'You are free to use it in any application, 'provided the copyright notice is left unchanged. ' 'Code courtesy of 'Terry Kreft Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _ "SHGetPathFromIDListA" (ByVal pidl As Long, _ ByVal pszPath As String) As Long Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _ "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _ As Long Private Const BIF_RETURNONLYFSDIRS = &H1 Public Function BrowseFolder(szDialogTitle As String) As String Dim X As Long, BI As BROWSEINFO, dwIList As Long Dim szPath As String, wPos As Integer Dim szRetPath As String With BI .hOwner = hWndAccessApp .lpszTitle = szDialogTitle .ulFlags = BIF_RETURNONLYFSDIRS End With dwIList = SHBrowseForFolder(BI) szPath = Space$(512) X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath) If X Then wPos = InStr(szPath, Chr(0)) szRetPath = VBA.Left$(szPath, wPos - 1) Else szRetPath = "" End If BrowseFolder = szRetPath End Function '*********** Code End ***************** |
|
|
|
Dec 7 2006, 12:50 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Have you tried clicking anything while the dialog is open? As mentioned it is modal and won't allow anything to be clicked until it is closed. Also keep in mind that this will only return the directory path and not any file information from within the directories.
HTH Good luck |
|
|
|
Dec 7 2006, 12:53 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 112 |
I am able to click on the main form and move it around. I can even close the main form and the browse for folder window is still open.
|
|
|
|
Dec 7 2006, 12:55 PM
Post
#6
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
You most likely have the pop up property of this form set then. Either change that or just set the visible property of the form to false before you open the browse dialog.
HTH Good luck |
|
|
|
Dec 7 2006, 01:02 PM
Post
#7
|
|
|
UtterAccess Addict Posts: 112 |
The form is not set as a pop up, but I will try setting the visible property to false. How would I set the visible property back to true though?
|
|
|
|
Dec 7 2006, 01:05 PM
Post
#8
|
|
|
UtterAccess Addict Posts: 112 |
One other thing I noticed when opening the browse for folder window is that it shows up in my task bar at the bottom of the screen.
|
|
|
|
Dec 7 2006, 01:47 PM
Post
#9
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Hi,
are you sure it is not set to pop up? Open the form's property dialog...go to the other tab...and make sure pop up is set to NO. The form should NOT be available for selection if the browse dialog appears. HTH Good luck |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 06:26 PM |