Solved

Help with TreeView

Posted on 2009-05-18
3
170 Views
Last Modified: 2012-05-07
Dear Experts,

An expert helpt me with this code:

procedure TForm1.btnAddFolderClick(Sender: TObject);
var aText: string;
begin
  if InputQuery('Folder', 'Enter a folder name', aText) then
    AddItem(aText, 0, nil);
end;

How do i have to implement the InputQuery in this procedure also:

procedure TForm1.btnAddFileClick(Sender: TObject);
begin
  if (TreeView1.Selected <> nil) and (TreeView1.Selected.ImageIndex = 0) then
  begin
    AddItem(Edit1.Text, 1, TreeView1.Selected);
  end else
    ShowMessage('First select a folder');
end;

Grtz. PK
0
Comment
Question by:peterkiers
  • 2
3 Comments
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
Comment Utility
i'll repost
procedure TForm1.btnAddFileClick(Sender: TObject);

var aText: string;

begin

  if (TreeView1.Selected <> nil) and (Treeview1.Selected.ImageIndex = 0) then

  begin

    if InputQuery('File', 'Enter a file name', aText) then

      AddItem(aText, 1, TreeView1.Selectedl);

  end else

    ShowMessage('Select a folder in the treeview first.');

end;

Open in new window

0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
oops, technicallity fault (also called a typo)

procedure TForm1.btnAddFileClick(Sender: TObject);

var aText: string;

begin

  if (TreeView1.Selected <> nil) and (Treeview1.Selected.ImageIndex = 0) then

  begin

    if InputQuery('File', 'Enter a file name', aText) then

      AddItem(aText, 1, TreeView1.Selected);

  end else

    ShowMessage('Select a folder in the treeview first.');

end;

Open in new window

0
 
LVL 1

Author Comment

by:peterkiers
Comment Utility
again 500 p comming your way.

Peter
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now