Solved

Windows Explorer Effect

Posted on 2010-11-16
9
289 Views
Last Modified: 2012-05-10
Hi,

I need to show data in format like Windows Explorer 'Folders' and 'Files'
The input data will be from a database in heirarchial  pattern.

Regards
Allan
0
Comment
Question by:Allan_Fernandes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 34143902
A bit unclear to me, do you mean the data will be extracted in a temp folder and you want to view it as the explorer does ?
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34143941
Could you provide more details please, do you mean you will get the hierarchy of the Files and Folders from the database and you want to have expand sign [+] next to the folders and once clicked it shows the content (again files and folders) and if a file is clicked it will be opened with the default or associate application, is that it ?
0
 

Author Comment

by:Allan_Fernandes
ID: 34143964

>> from the database and you want to have expand sign [+] next to the folders and once clicked it shows >> the content (again files and folders) and if a file is clicked it will be opened with the default or >> associate application, is that it ?


You have understood correct.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Expert Comment

by:jimyX
ID: 34143994
How is your data formatted in the database ? Please provide sample of data from the database just to know in which form you are storing it.
0
 

Author Comment

by:Allan_Fernandes
ID: 34144274
Sample database format

ParentCode   ItemCode    Name
0                    1                Birds
1                    10              Parrot                  
1                    11              Piegon
1                    12              Eagle
12                  100            Falcon
12                  101            Hawk

Regards
Allan
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 34144317
OK, below is how it will look, but what's next ? for example what shall happen when Parrot is clicked and/or double clicked ?

0
|
----1 Birds
      |
      ------- 10 Parrot
      |
      ------- 11 Piegon
      |
      ------- 12 Eagle
                  |
                  ------- 100 Falcon
                  |
                  ------- 101 Hawk
0
 

Author Comment

by:Allan_Fernandes
ID: 34144488
Thanks for helping me clarify my needs. Please advice if ready component.

I can use Treeview for Left Panel and Check list box in a Right Hand Panel

>> If selection is on Eagle then

 ---1 Birds                               |               100 Falcon
      |                                        |               101 Hawk
      ------- 10 Parrot                |
      |
      ------- 11 Piegon
      |
      ------- 12 Eagle

Thanks
Allan
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34146527
Allan,
Be careful, you should be assigning the points after you are given the final solution and it met your demand. Anyway, back to your question:

You can still add all the numbers in the Treeview as a hierarchy in addition to viewing the ItemCodes, if available, in a checklistbox. Please let me know if this is what you wanted:

Procedure TVAddChild(ParnetCode, Str:string);
var
  i : integer;
  s1, s2:string;
begin
  for i := 0 to Form1.Treeview1.Items.Count-1 do
    begin
      s1 := Form1.Treeview1.Items[i].Text;
      if pos(' ',s1) <= 0 then
        begin
          if s1 = ParnetCode then
             begin
               Form1.Treeview1.Items[i].Selected := True;
               Form1.Treeview1.Items.AddChild(Form1.Treeview1.Selected, Str);
               break;
           end;
        end
      else
        begin
          s2 := copy(s1,1,pos(' ',s1)-1);
          if s2 = ParnetCode then
             begin
              Form1.Treeview1.Items[i].Selected := True;
              Form1.Treeview1.Items.AddChild(Form1.Treeview1.Selected, Str);
              break;
            end;
        end;
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i : integer;
begin
  Query1.Close;
  Query1.SQL.Text := 'select min(ParentCode) as root from Table1';
  Query1.Open;
  Treeview1.Items.Clear;
  Treeview1.Items.Insert(Treeview1.Items.GetFirstNode,Query1.fieldbyname('root').AsString);
  Query1.Close;
  Query1.SQL.Text := 'select * from Table1 order by ParentCode';
  Query1.Open;
  Query1.First;
  for i:= 0 to Query1.RecordCount-1 do
    begin
      TVAddChild(Query1.fieldbyname('ParentCode').AsString, Query1.fieldbyname('ItemCode').AsString +' '+ Query1.fieldbyname('Name').AsString);
      Query1.Next;
    end;
  Treeview1.Items[0].Selected := true;
  Query1.Close;
end;

procedure TForm1.Treeview1Click(Sender: TObject);
var
  i : integer;
  s1, s2 : string;
begin
  Query1.Close;
  s1 := Treeview1.Selected.Text;
  if pos(' ',s1) <= 0 then
    begin
      Query1.SQL.Text := 'select * from Login where ParentCode = ' + QuotedStr(S1);
    end
  else
    begin
      s2 := copy(s1,1,pos(' ',s1)-1);
      Query1.SQL.Text := 'select * from Login where ParentCode = ' + QuotedStr(s2);
    end;
  Query1.Open;
  Checklistbox1.Clear;
  for i := 0 to Query1.RecordCount-1 do
    begin
      Checklistbox1.Items.Add(Query1.fieldbyname('ItemCode').AsString +' '+ Query1.fieldbyname('Name').AsString);
      Query1.Next;
    end;
  Query1.Close;
end;

Open in new window

0
 

Author Comment

by:Allan_Fernandes
ID: 34162901
Thanks This is perfect
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 120
can't find the executable in Simulator 1 130
Tembedded WB animatid gifs not animated on some pcs 2 94
Delphi: making a BW image transparent 10 137
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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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