Solved

Help with TreeView

Posted on 2009-05-18
3
172 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 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 24411641
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 37

Expert Comment

by:Geert Gruwez
ID: 24411652
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
ID: 24411657
again 500 p comming your way.

Peter
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 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

19 Experts available now in Live!

Get 1:1 Help Now