TsiBrowseForFolder - BrowseForComputer

This forum designated to discuss the TsiLang Components Suite.
Post Reply
Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

TsiBrowseForFolder - BrowseForComputer

Post 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

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post 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 &#58;= SelectedPIDL <> nil;
....
And use SelectedDir property to obtain name of selected computer.

Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

Post by Malcolm »

Thanks, that works fine. :)

Will that be in the next release, or will I need to remember to patch it?

Malcolm

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Of course this will be included in official release.

Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

Post 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?

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post 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.

Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

Post by Malcolm »

OK, noted, thanks.

Post Reply