Page 1 of 1
TsiBrowseForFolder - BrowseForComputer
Posted: Fri Dec 26, 2003 3:02 pm
by Malcolm
Hi
When setting siBrowseForFolder.Flags := [BrowseForComputer] and then selecting a computer, how does one access the selected 'computername'?
If this component does not do the buisness, does anyone know how else to get a computername?
Malcolm
Posted: Sat Dec 27, 2003 7:03 am
by isiticov
I suppose it would be helpful to make small fix in SiDialog.Pas file in order to get this to work. Just insert at line #1207 the following:
Code: Select all
if FSelectedDir = '' then
FSelectedDir := lpbi.pszDisplayName;
so the code will look like:
Code: Select all
....
try
SelectedPIDL := SHBrowseForFolder(lpbi);
if FSelectedDir = '' then
FSelectedDir := lpbi.pszDisplayName;
finally
Result := SelectedPIDL <> nil;
....
And use SelectedDir property to obtain name of selected computer.
Posted: Sat Dec 27, 2003 9:39 am
by Malcolm
Thanks, that works fine.
Will that be in the next release, or will I need to remember to patch it?
Malcolm
Posted: Sat Dec 27, 2003 3:39 pm
by isiticov
Of course this will be included in official release.
Posted: Tue Dec 30, 2003 9:16 am
by Malcolm
There is a small problem with this patch.
Because SiDialog.pas does not clear FSelectedDir before the browse any subsequent [BrowseForComputer] call will return the result of the previous operation (FSelectedDir is not blank).
I am now clearing the .SelectedDir property in my code before making the call but I wonder whether SiDialog.pas can/should do this in this case?
Posted: Tue Dec 30, 2003 11:54 am
by isiticov
SelectedDir property is used to indicate which folder should be selected when calling Execute method, so the clearing/changing this property should be performed by application not dialog itself.
Posted: Tue Dec 30, 2003 12:54 pm
by Malcolm
OK, noted, thanks.