Author | Topic: Folder Selection Problem | |
---|---|---|
Carlos A Beling | Folder Selection Problem on Fri, 04 Dec 2020 21:00:10 -0300 Good NIght. Please why the folder selection made using Shell.Application:BrowseForFolder() does not recognizes the folder typed? Please see the attached example. Fraternally Beling test.zip | |
Andreas Gehrs-Pahl | Re: Folder Selection Problem on Sat, 05 Dec 2020 15:10:47 -0500 Carlos, >Please why the folder selection made using >Shell.Application:BrowseForFolder() does not recognizes the folder typed? >Please see the attached example. I'm not sure that I understand your question. If you select the TreeView and start typing, you can select a folder, which is Standard Windows Behavior (SWB). If you select the SLE, you can type in the folder name (with path), which is also SWB. In either case, if you select a folder through typing, with the cursor (arrow) keys, or the mouse, and then select the OK button, the highlighted (selected) folder is returned, unless you typed a different, valid (complete, and not relative!), path directly into the SLE. Now, there are a few issues with your code. For example, the Project.xpj file references a "CabGui.lib" file that doesn't exist (and isn't needed), so I had to remark that line out to get it to link. Also, your third call to the folder selection routine -- using the "cabSELECTFOLDER" #xTranslate preprocessor directive in line 73 -- doesn't return (or update) the "cDisplayName" variable, as you have remarked line (80) out. But adding a ";" (semicolon) to the end of line 78 and removing the "//" in front of line 80 will fix that. Also, when using preprocessor directives in your code, you should always add the /p (or -p) compiler option (to your project file), so you can check the *.ppo file to see what was actually compiled. I hope that helps, but if the above doesn't address your question, please explain your issue a little bit more verbose. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC | |
Carlos A Beling | Re: Folder Selection Problem on Tue, 08 Dec 2020 13:24:08 -0300 Hello Andreas: good day. Again many thanks and I am sorry by the bad code that I sent. What I intend is to get a complete valid path typed in the selection dialog box. It seems that the dialog box has not meaning for selection and its result it seems to be that always the first one item of the showed selection tree. Please see if the new one attached testing program can to be corrected for accomplishing this? Fraternally Beling On 05/12/2020 17:10, Andreas Gehrs-Pahl wrote: > Also, your third call > to the folder selection routine -- using the "cabSELECTFOLDER" #xTranslate > preprocessor directive in line 73 -- doesn't return (or update) the Test.zip | |
Carlos A Beling | Re: Folder Selection Problem - Correction on Wed, 09 Dec 2020 10:03:08 -0300 Good day. Translator problem. Sorry. Please consider the text below replacing the old one: <snipp old> It seems that the dialog box has not meaning for selection and its result it seems to be that always the first one item of the showed selection tree. </snip old> <new> It seems that the dialog box has not meaning for selection. The typed folder in the dialog box is ignored and always the first one item of the directory list is taken as selected item. </new> Fraternally Beling On 08/12/2020 13:24, Carlos A Beling wrote: > It seems that the dialog box has not meaning for selection and its > result it seems to be that always the first one item of the showed > selection tree. | |
Andreas Gehrs-Pahl | Re: Folder Selection Problem - Correction on Thu, 10 Dec 2020 22:54:22 -0500 Carlos, >It seems that the dialog box has not meaning for selection. >The typed folder in the dialog box is ignored and always the first one >item of the directory list is taken as selected item. That is incorrect. As I wrote in my first response, if you type a VALID and COMPLETE path, with a drive letter and everything -- NOT a RELATIVE path -- directly into the SLE, then that path is selected and returned. If the path entered into the SLE is INVALID, INCOMPLETE, or RELATIVE -- without a drive letter, etc. -- then the HIGHLIGHTED folder is selected and returned instead. Also, the "cDisplayName" value is the selected directory name, WITHOUT the entire PATH, while the "cFolderSelected" value is the entire selected path, with drive letter and everything. The "cDisplayName" value will only be a VALID directory, if it is located in the current directory of your application. If you want a different behavior, you need to write your own folder browser. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC | |
Carlos A Beling | Re: Folder Selection Problem - Correction on Fri, 11 Dec 2020 09:24:15 -0300 Hi Andreas. Good day. Again many thanks. Merry Christmas to you and all those you love. Fraternally Beling On 11/12/2020 00:54, Andreas Gehrs-Pahl wrote: > Carlos, > >> It seems that the dialog box has not meaning for selection. >> The typed folder in the dialog box is ignored and always the first one >> item of the directory list is taken as selected item. > > That is incorrect. As I wrote in my first response, if you type a VALID and > COMPLETE path, with a drive letter and everything -- NOT a RELATIVE path -- > directly into the SLE, then that path is selected and returned. > > If the path entered into the SLE is INVALID, INCOMPLETE, or RELATIVE -- > without a drive letter, etc. -- then the HIGHLIGHTED folder is selected and > returned instead. > > Also, the "cDisplayName" value is the selected directory name, WITHOUT the > entire PATH, while the "cFolderSelected" value is the entire selected path, > with drive letter and everything. The "cDisplayName" value will only be a > VALID directory, if it is located in the current directory of your > application. > > If you want a different behavior, you need to write your own folder browser. > > Andreas > | |
Jorge L. Borlando | Re: Folder Selection Problem - Correction on Mon, 14 Dec 2020 16:52:05 -0300 Carlos, https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfoa https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb762598(v=vs.85) if I have not understood correctly, your problem is solved with a pointer to your UDF to BrowseInfo:lpfn with ot4xb : BEGIN STRUCTURE browseinfo MEMBER HWND hwndOwner MEMBER LPSTR pidlRoot MEMBER LPSTR pszDisplayName MEMBER LPSTR lpszTitile MEMBER UINT ulFlags MEMBER LPSTR lpfn MEMBER LPARAM lParam MEMBER int iImage END STRUCTURE oBrinfo := browseInfo():New() <bla bla bla> oBrInfo:lpfn := _callback_BrowseForFolder() #define BFFM_INITIALIZED 1 #define BFFM_SELCHANGED 2 #define BFFM_SETSELECTION 0x466 #define BFFM_SETSTATUSTEXT 0x464 Function BrowseForFolder( hWnd, nMsg, lp ) Local nRet nRet := 0 if nMsg == BFFM_INITIALIZED @user32:SendMessageA(hWnd,BFFM_SETSELECTION,1,'D:\MY_FOLDER') @user32:SetForegroundWindow( hWnd) EndIF Return ( nRet ) With the xppcbk tool from Pablo Botella, compile these lines, generate the file browseforfolder.obj and add it to your project BEGIN CALLBACK BrowseForFolder AS INT PARAM LONG PARAM LONG PARAM LONG PARAM LONG END CALLBACK "Carlos A Beling" escribió en el mensaje de noticias:492ffd7c$21323244$c8c2@news.alaska-software.com... Good day. Translator problem. Sorry. Please consider the text below replacing the old one: <snipp old> It seems that the dialog box has not meaning for selection and its result it seems to be that always the first one item of the showed selection tree. </snip old> <new> It seems that the dialog box has not meaning for selection. The typed folder in the dialog box is ignored and always the first one item of the directory list is taken as selected item. </new> Fraternally Beling On 08/12/2020 13:24, Carlos A Beling wrote: > It seems that the dialog box has not meaning for selection and its result > it seems to be that always the first one item of the showed selection > tree. | |
Carlos A Beling | Re: Folder Selection Problem - Correction on Tue, 15 Dec 2020 10:33:34 -0300 Hi Jorge: good day. Many thanks. I tested the attached sample that is working fine. According to Mr Andreas it must to be specified in the dialog box the driver where the folder is located and it is not included in the sample. Now I am using the program that I posted in 08.12.2020 in this NG. Merry Christmas to you and all those that youlove. Fraternally Beling On 14/12/2020 16:52, Jorge L. Borlando wrote: > Carlos, > https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfoa > > https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb762598(v=vs.85) > > > if I have not understood correctly, your problem is solved with a > pointer to your UDF to BrowseInfo:lpfn > > with ot4xb : > BEGIN STRUCTURE browseinfo > MEMBER HWND hwndOwner > MEMBER LPSTR pidlRoot > MEMBER LPSTR pszDisplayName > MEMBER LPSTR lpszTitile > MEMBER UINT ulFlags > MEMBER LPSTR lpfn > MEMBER LPARAM lParam > MEMBER int iImage > END STRUCTURE > oBrinfo := browseInfo():New() > <bla bla bla> > oBrInfo:lpfn := _callback_BrowseForFolder() > > #define BFFM_INITIALIZED 1 > #define BFFM_SELCHANGED 2 > #define BFFM_SETSELECTION 0x466 > #define BFFM_SETSTATUSTEXT 0x464 > > Function BrowseForFolder( hWnd, nMsg, lp ) > Local nRet > nRet := 0 > if nMsg == BFFM_INITIALIZED > @user32:SendMessageA(hWnd,BFFM_SETSELECTION,1,'D:\MY_FOLDER') > @user32:SetForegroundWindow( hWnd) > EndIF > Return ( nRet ) > > With the xppcbk tool from Pablo Botella, compile these lines, generate > the file browseforfolder.obj and add it to your project > > BEGIN CALLBACK BrowseForFolder AS INT > PARAM LONG > PARAM LONG > PARAM LONG > PARAM LONG > END CALLBACK > > > > "Carlos A Beling" escribió en el mensaje de > noticias:492ffd7c$21323244$c8c2@news.alaska-software.com... > > Good day. > Translator problem. Sorry. > Please consider the text below replacing the old one: > <snipp old> > It seems that the dialog box has not meaning for selection and its > result it seems to be that always the first one item of the showed > selection tree. > </snip old> > > <new> > It seems that the dialog box has not meaning for selection. > The typed folder in the dialog box is ignored and always the first one > item of the directory list is taken as selected item. > </new> > > Fraternally > Beling > > > On 08/12/2020 13:24, Carlos A Beling wrote: >> It seems that the dialog box has not meaning for selection and its >> result it seems to be that always the first one item of the showed >> selection tree. > Dirselect.prg | |
Jorge L. Borlando | Re: Folder Selection Problem - Correction on Tue, 15 Dec 2020 19:37:54 -0300 Carlos, Great !!! best regards "Carlos A Beling" escribió en el mensaje de noticias:4a52f3b5$2898d936$2628@news.alaska-software.com... Hi Jorge: good day. Many thanks. I tested the attached sample that is working fine. According to Mr Andreas it must to be specified in the dialog box the driver where the folder is located and it is not included in the sample. Now I am using the program that I posted in 08.12.2020 in this NG. Merry Christmas to you and all those that youlove. Fraternally Beling On 14/12/2020 16:52, Jorge L. Borlando wrote: > Carlos, > https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfoa > > https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb762598(v=vs.85) > > > if I have not understood correctly, your problem is solved with a > pointer to your UDF to BrowseInfo:lpfn > > with ot4xb : > BEGIN STRUCTURE browseinfo > MEMBER HWND hwndOwner > MEMBER LPSTR pidlRoot > MEMBER LPSTR pszDisplayName > MEMBER LPSTR lpszTitile > MEMBER UINT ulFlags > MEMBER LPSTR lpfn > MEMBER LPARAM lParam > MEMBER int iImage > END STRUCTURE > oBrinfo := browseInfo():New() > <bla bla bla> > oBrInfo:lpfn := _callback_BrowseForFolder() > > #define BFFM_INITIALIZED 1 > #define BFFM_SELCHANGED 2 > #define BFFM_SETSELECTION 0x466 > #define BFFM_SETSTATUSTEXT 0x464 > > Function BrowseForFolder( hWnd, nMsg, lp ) > Local nRet > nRet := 0 > if nMsg == BFFM_INITIALIZED > @user32:SendMessageA(hWnd,BFFM_SETSELECTION,1,'D:\MY_FOLDER') > @user32:SetForegroundWindow( hWnd) > EndIF > Return ( nRet ) > > With the xppcbk tool from Pablo Botella, compile these lines, generate > the file browseforfolder.obj and add it to your project > > BEGIN CALLBACK BrowseForFolder AS INT > PARAM LONG > PARAM LONG > PARAM LONG > PARAM LONG > END CALLBACK > > > > "Carlos A Beling" escribió en el mensaje de > noticias:492ffd7c$21323244$c8c2@news.alaska-software.com... > > Good day. > Translator problem. Sorry. > Please consider the text below replacing the old one: > <snipp old> > It seems that the dialog box has not meaning for selection and its > result it seems to be that always the first one item of the showed > selection tree. > </snip old> > > <new> > It seems that the dialog box has not meaning for selection. > The typed folder in the dialog box is ignored and always the first one > item of the directory list is taken as selected item. > </new> > > Fraternally > Beling > > > On 08/12/2020 13:24, Carlos A Beling wrote: >> It seems that the dialog box has not meaning for selection and its >> result it seems to be that always the first one item of the showed >> selection tree. > |