Solved

Help with TreeView

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

840 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