Nested Display

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mshmyob
    Recognized Expert Contributor
    • Jan 2008
    • 903

    #1

    Nested Display

    I am in testing mode for this part of my app so I can change anything to make this work.

    I have added email functionality to one of my apps. I use SMTP to send and either POP3 or IMAP4 to receive. For the receive I store everything into tables except attachments - they are in a directory and only referenced in the tables.

    Everything works fine so no problem getting email to work.

    What I am wanting has to do with the interface. Everthing for viewing an email account and emails looks good and works. One of the tables I have has 'folder' names called 'Inbox, outbox, trash, etc.' - the standard 'folders' in an email app. Clicking (from a list box control) on any of those shows the emails in the appropriate 'folders'

    What I want now is to allow an end user to add their own 'folders' - Such as Clients. I can do that but now I want 'sub folders'. Such as under Clients they may have a Jane Doe 'folder', a Joe Blow 'folder', etc.

    That is the part I am having trouble with. How can I set up the table to accomodate that and more importantly how can I display it in a nested fashion.

    I was fooling with a table like so:

    tblMailUserFold ers

    MailUserFolderI D - autonumber
    MailUserFolderN ame - text
    MailUserParentF olderID - number (long)

    The MailUserParentF olderID would reference back to the MailUserFolderI D

    example

    Record 1

    MailUserFolderI D = 1
    MailUserFolderN ame = Clients
    Mail UserParentFolde rID = NULL - NULL would indicated root folder

    Record 2

    MailUserFolderI D=2
    MailUserFolderN ame = Jane Doe
    MailUserParentI DFolderID = 1 - any value here other than NULL would indicated a nested folder

    I have no problem getting the data in but cannot figure out how to display it in a nested view.

    Remember this is in testing mode and I can make any changes. The only requirement I have is that tables are used and NOT real directories.

    Any ideas?

    cheers
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by mshmyob
    I am in testing mode for this part of my app so I can change anything to make this work.

    I have added email functionality to one of my apps. I use SMTP to send and either POP3 or IMAP4 to receive. For the receive I store everything into tables except attachments - they are in a directory and only referenced in the tables.

    Everything works fine so no problem getting email to work.

    What I am wanting has to do with the interface. Everthing for viewing an email account and emails looks good and works. One of the tables I have has 'folder' names called 'Inbox, outbox, trash, etc.' - the standard 'folders' in an email app. Clicking (from a list box control) on any of those shows the emails in the appropriate 'folders'

    What I want now is to allow an end user to add their own 'folders' - Such as Clients. I can do that but now I want 'sub folders'. Such as under Clients they may have a Jane Doe 'folder', a Joe Blow 'folder', etc.

    That is the part I am having trouble with. How can I set up the table to accomodate that and more importantly how can I display it in a nested fashion.

    I was fooling with a table like so:

    tblMailUserFold ers

    MailUserFolderI D - autonumber
    MailUserFolderN ame - text
    MailUserParentF olderID - number (long)

    The MailUserParentF olderID would reference back to the MailUserFolderI D

    example

    Record 1

    MailUserFolderI D = 1
    MailUserFolderN ame = Clients
    Mail UserParentFolde rID = NULL - NULL would indicated root folder

    Record 2

    MailUserFolderI D=2
    MailUserFolderN ame = Jane Doe
    MailUserParentI DFolderID = 1 - any value here other than NULL would indicated a nested folder

    I have no problem getting the data in but cannot figure out how to display it in a nested view.

    Remember this is in testing mode and I can make any changes. The only requirement I have is that tables are used and NOT real directories.

    Any ideas?

    cheers
    To graphically display data in a Nested/Hierarchal view, such as would exist in a Relational Database, I use a TreeView Control. Have you considered this Option?

    Comment

    • mshmyob
      Recognized Expert Contributor
      • Jan 2008
      • 903

      #3
      Thanks ADezii,

      I have never used the Treeview Control before. I will research that and give it a try.

      cheers,

      Originally posted by ADezii
      To graphically display data in a Nested/Hierarchal view, such as would exist in a Relational Database, I use a TreeView Control. Have you considered this Option?

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by mshmyob
        Thanks ADezii,

        I have never used the Treeview Control before. I will research that and give it a try.

        cheers,
        This Control can be tricky to use, as soon as I get a chance, I'll whip up a Demo for you to Preview. Actually, I'll Attach a Demo that I use right now:

        Comment

        • FishVal
          Recognized Expert Specialist
          • Jun 2007
          • 2656

          #5
          Just subscribing.
          I will post some demo later when get a time to cleanup and comment the code.

          Comment

          • mshmyob
            Recognized Expert Contributor
            • Jan 2008
            • 903

            #6
            Thanks AD,

            I am working on it and will let you know. But I believe you are correct (as usual) that the ListView is the way to proceed.

            cheers,

            Originally posted by ADezii
            This Control can be tricky to use, as soon as I get a chance, I'll whip up a Demo for you to Preview. Actually, I'll Attach a Demo that I use right now:

            Comment

            • mshmyob
              Recognized Expert Contributor
              • Jan 2008
              • 903

              #7
              Thanks Fish,

              Look forward to it.

              cheers

              Originally posted by FishVal
              Just subscribing.
              I will post some demo later when get a time to cleanup and comment the code.

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                Originally posted by mshmyob
                Thanks AD,

                I am working on it and will let you know. But I believe you are correct (as usual) that the ListView is the way to proceed.

                cheers,
                mshmyob, just keep in mind that the ListView and TreeView are two, distinct, Controls and do not refer to the same thing.

                Comment

                • mshmyob
                  Recognized Expert Contributor
                  • Jan 2008
                  • 903

                  #9
                  Sorry AD, I meant TreeView :).

                  cheers,

                  Originally posted by ADezii
                  mshmyob, just keep in mind that the ListView and TreeView are two, distinct, Controls and do not refer to the same thing.

                  Comment

                  • FishVal
                    Recognized Expert Specialist
                    • Jun 2007
                    • 2656

                    #10
                    Well.

                    Frankly speaking, I've written this sample a while ago and the code was very kludgy and uncompleted. It was not tested in long run (I use tree with other relationship type in my applications) and a part of code was written from scratch today. It seems to work, but I couldn't state it has completely no bugs.

                    Contents:

                    Tables:
                    [tblTree] - tree source
                    the rest tables with meaningful names are used to store values to initialize object properties (in the sample only one object of OtMTree class).

                    Queries:
                    all the queries are used to initialize object properties

                    Forms:
                    [frmDObjects] - edit values used to initialize object properties
                    [frmTree] - form with sample tree

                    Modules:
                    [DObj] - routine to initialize object properties
                    [SQLSelect] - simple SQL statement parser class
                    [OtMTree] - class which handles all operations with tree (One-to-Many Tree)

                    Sample tree has the following properties:
                    • WYSIWYG editing of node text
                    • WYSIWYG adding of new node
                    • WYSIWYG deleting of node (button in the left upper corner). So far it treats orphans appearing after node with children has been deleted in only one way - make them children of parent node.
                    • Drag-and-Drop to move node
                    • Tree nodes expanded/colapsed state as well as node order persists in source table
                    • Nodes have icons which are being rendered from ImageList control. Icon keys are stored in source table.
                    Attached Files

                    Comment

                    • mshmyob
                      Recognized Expert Contributor
                      • Jan 2008
                      • 903

                      #11
                      Thank you AD and Fish.

                      I will study your code and see what I come up with in during the next week or two and let you know my results.

                      Again thank you.

                      cheers,

                      Comment

                      • ADezii
                        Recognized Expert Expert
                        • Apr 2006
                        • 8834

                        #12
                        Originally posted by mshmyob
                        Thank you AD and Fish.

                        I will study your code and see what I come up with in during the next week or two and let you know my results.

                        Again thank you.

                        cheers,
                        If you are interested, I can provide you with the Help Files for the Microsoft Common Controls, which includes, but is not limited to, the TreeView Control. It is extremely handy, in that it will provide comprehensive Help for the Properties, Methods, and Events that the Control exposes. Just let me know if you are interested.

                        Comment

                        • mshmyob
                          Recognized Expert Contributor
                          • Jan 2008
                          • 903

                          #13
                          Thanks AD,

                          That would be EXTREMELY helpful.

                          cheers,

                          Originally posted by ADezii
                          If you are interested, I can provide you with the Help Files for the Microsoft Common Controls, which includes, but is not limited to, the TreeView Control. It is extremely handy, in that it will provide comprehensive Help for the Properties, Methods, and Events that the Control exposes. Just let me know if you are interested.

                          Comment

                          • ADezii
                            Recognized Expert Expert
                            • Apr 2006
                            • 8834

                            #14
                            Originally posted by mshmyob
                            Thanks AD,

                            That would be EXTREMELY helpful.

                            cheers,
                            Hello mshmyob, I think that you will find this very helpful, not just for the TreeView Control, but the others also. Enjoy!

                            Comment

                            • FishVal
                              Recognized Expert Specialist
                              • Jun 2007
                              • 2656

                              #15
                              For those who find it interesting I'm attaching the last version of tree interface sample. There are several major enhancements in comparison with the previous version.
                              • Two shortcut menus were added to OtMTree class and now all operations with nodes and tree are being held via these menus.
                              • Node properties dialog was added.
                              • Tree search dialog was added.


                              Regards,
                              Fish.
                              Attached Files

                              Comment

                              Working...