Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TShellTreeView.SetPath ineffective?

0 views
Skip to first unread message

Neil J. Rubenking

unread,
Sep 19, 2001, 2:19:39 PM9/19/01
to
Try this. Drop a TShellTreeView component (from the Samples page) on a
form, along with an edit box and a button. In the tree's OnChange handler
put "Edit1.Text := ShellTreeView1.Path;". In the button's OnClick
handler, put "ShellTreeView1.Path := Edit1.Text;".

When you change folders within the tree, the path is reflected in the
edit box. But if you type in a path and click the button, it does NOT
update the tree. However, if you type a non-existent path, you'll get an
error message.

Is TShellTreeView.SetPath() broken?


--
Neil J. Rubenking
Contributing Technical Editor
PC Magazine

Dave Nottage

unread,
Sep 19, 2001, 7:55:19 PM9/19/01
to
"Neil J. Rubenking" wrote:
> Is TShellTreeView.SetPath() broken?

Look at the code for it, for the answer. It's in Demos\ShellControls:

SetPath:

FUpdating := True;
SetPathFromID(NewPIDL);

then:

procedure TCustomShellTreeView.SetPathFromID(ID: PItemIDList);
var
I: Integer;
Pidls: TList;
Temp, Node: TTreeNode;
begin
if FUpdating or (csLoading in ComponentState)
or ((SelectedFolder <> nil) and SamePIDL(SelectedFolder.AbsoluteID, ID))
then Exit;

because FUpdating is set to true just before the call to SetPathFromID, it
*always* exits.

I commented out the

FUpdating := True

in SetPath. Hopefully it wont break anything else <g>

--
Dave Nottage


Neil J. Rubenking

unread,
Sep 20, 2001, 10:18:05 AM9/20/01
to
In article <3ba92ffc_1@dnews>, da...@removethis.b3.com.au says...

> "Neil J. Rubenking" wrote:
> > Is TShellTreeView.SetPath() broken?
>
> I commented out the
>
> FUpdating := True
>
> in SetPath. Hopefully it wont break anything else <g>

Dang! I did look at the source, but I didn't make the connection you did.
I'll try commenting out that line, as you suggest.

0 new messages