Solved

Help with TreeView

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

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…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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