User Tools

Site Tools


customising_20the_20browse_20for_20folder_20dialogue

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

customising_20the_20browse_20for_20folder_20dialogue [2018/03/31 13:19]
127.0.0.1 external edit
customising_20the_20browse_20for_20folder_20dialogue [2018/04/15 17:22] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Customising the Browse for Folder dialogue===== =====Customising the Browse for Folder dialogue=====
  
-//by Richard Russell, July 2009//\\ \\  The main [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwine.html#​browsefolder|Help documentation]] explains how you can use the Windows API to display a **Browse for Folder** dialogue box, allowing the user to select a folder (directory) for some purpose.\\ \\  Unfortunately the basic functionality of **SHBrowseForFolder** is not very flexible, so below are listed two functions, the first of which lets you specify the **root** folder that the browse operation starts from, and the second lets you specify the **initial** folder selection. In both cases the default folder (i.e. the one returned if you simply click on OK) is the specified folder, but the difference is that in the first case you cannot navigate '​above'​ that folder, whereas in the second case you can.\\ \\  The first function, **FNbrowseforfolderroot**,​ is called in the following context:\\ \\ +//by Richard Russell, July 2009//\\ \\  The main [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwine.html#​browsefolder|Help documentation]] explains how you can use the Windows API to display a **Browse for Folder** dialogue box, allowing the user to select a folder (directory) for some purpose.\\ \\  Unfortunately the basic functionality of **SHBrowseForFolder** is not very flexible, so below are listed two functions, the first of which lets you specify the **root** folder that the browse operation starts from, and the second lets you specify the **initial** folder selection. In both cases the default folder (i.e. the one returned if you simply click on OK) is the specified folder, but the difference is that in the first case you cannot navigate '​above'​ that folder, whereas in the second case you can.\\ \\  The first function, **FNbrowseforfolderroot**,​ is called in the following context: 
 + 
 +<code bb4w> ​
         title$ = "Set root selection"​         title$ = "Set root selection"​
         root$ = "​C:​\bbcbasic\windows\programs"​         root$ = "​C:​\bbcbasic\windows\programs"​
         folder$ = FNbrowseforfolderroot(title$,​ root$)         folder$ = FNbrowseforfolderroot(title$,​ root$)
-The second function, **FNbrowseforfolderinit**,​ is called in the following context:\\ \\ +</​code>​ 
 + 
 +The second function, **FNbrowseforfolderinit**,​ is called in the following context: 
 + 
 +<code bb4w>
         INSTALL @lib$+"​CALLBACK"​         INSTALL @lib$+"​CALLBACK"​
  
Line 11: Line 17:
         init$ = "​C:​\bbcbasic\windows\programs"​         init$ = "​C:​\bbcbasic\windows\programs"​
         folder$ = FNbrowseforfolderinit(title$,​ init$)         folder$ = FNbrowseforfolderinit(title$,​ init$)
-It would in principle be possible to combine the functions of the two routines, so that both the **root** and the **initial selection** may be specified, however that's not very likely to be required in practice.\\ \\  Here are the functions:\\ \\ +</​code>​ 
 + 
 +It would in principle be possible to combine the functions of the two routines, so that both the **root** and the **initial selection** may be specified, however that's not very likely to be required in practice.\\ \\  Here are the functions: 
 + 
 +<code bb4w>
         DEF FNbrowseforfolderroot(title$,​ root$)         DEF FNbrowseforfolderroot(title$,​ root$)
         LOCAL folder%, pathw%, pidl%, malloc%, bi{}         LOCAL folder%, pathw%, pidl%, malloc%, bi{}
Line 39: Line 49:
         ENDIF         ENDIF
         =$$folder%         =$$folder%
-\\ +
         DEF FNbrowseforfolderinit(title$,​ init$)         DEF FNbrowseforfolderinit(title$,​ init$)
         LOCAL folder%, pidl%, malloc%, bi{}         LOCAL folder%, pidl%, malloc%, bi{}
Line 73: Line 83:
         lParam% = FN_sendmessage(hwnd%,​ BFFM_SETSELECTION,​ TRUE, lpData%)         lParam% = FN_sendmessage(hwnd%,​ BFFM_SETSELECTION,​ TRUE, lpData%)
         = 0         = 0
 +</​code>​
customising_20the_20browse_20for_20folder_20dialogue.txt · Last modified: 2018/04/15 17:22 by richardrussell