Solved

Windows Explorer Effect

Posted on 2010-11-16
9
283 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
  • 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

20 Experts available now in Live!

Get 1:1 Help Now