dcsimg
Results 1 to 22 of 22

Thread: [vbRichClient] RAD TreeView

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    [vbRichClient] RAD TreeView

    What Is It?
    Well, it's just a regular treeview but with lots of Rapid Application Development features, to minimise the amount of coding you need to implement many regularly-needed features.

    What it has, at its core, is the concept of Node Types, each of which has its own rules that govern appearance and behaviour.

    What isn't it?
    It is not a drop-in replacement for an existing treeview as its object model is different. It may also lack some features of a regular treeview; if that is the case, it is because I have not needed those features yet - but they can be added.

    Features:
    • Automatic expansion and scrolling during drag operations
    • Automatic validation and acceptance/rejection of valid/invalid drag operations, governed by NodeType settings
    • Automatic validation and acceptance/rejection of invalid Node Captions during user editing
    • Automatic creation of intuitive drag icons to indicate validity of drag operations (even from external controls)
    • Full customisation of the tree's appearance (all shown in the demo)


    Name:  Untitled.jpg
Views: 337
Size:  70.0 KB

    Usage:
    Add the control (and related classes) to your project and, then, define your tree in the following manner:

    1) Create a NodeType for each kind of 'thing' that is to be represented in the tree

    e.g. MyTree.NodeTypes.Add TypeName, ImageKey, [ExpandedImageKey], [CaptionColour], [CaptionBold], [CaptionItalic], [SortMethod], [SortPriority], [DragDropBehaviour], [UserInteractivity]

    In addition, the following properties (among others) are available, via MyTree.NodeTypes(TypeName)

    .ValidChildTypes: A pipe(|)-delimited list of types that are valid as children of this type. If not set, all types are valid children
    .UserCanAddChildren: i.e. whether or not the INSERT key is supported for this Type, so that a child node (of the default child NodeType) can be added by the user
    .UserCanAddSiblings: i.e. whether or not the SHIFT+INSERT keys ire supported for this Type, so that a sibling node (of the same NodeType) can be added by the user
    .UserCanDelete: i.e. whether or not the DELETE key is supported for this Type, so that the user can remove a node (and its children)
    .UserCanEdit: i.e. whether or not the F2 key is supported for this Type, so that the user can change a Node's caption
    Note: These four can all be set individually, as above, or collectively via the UserInteractivity parameter of the .Add method
    .DefaultChildType: This is the type of node that will be added if UserCanAddChildren is True. If not specfied, it will be the first item in .ValidChildTypes
    .DragDropBehaviour: Whether this type of Node is valid as an Internal (i.e. Node-To-Node) drag source and/or target. Similar settings support dragging to or from other controls

    2) Add your Nodes to the tree, specifying the NodeType for each


    e.g. MyTree.Nodes.Add ParentNodeKey, NodeKey, Caption, NodeType, [CaptionColour]*
    CaptionColour is optional. If set it will over-ride the colour defined by its NodeType

    Finally, set the 'Suspended' property of your Tree to 'False', which will cause your tree to update itself (it's set to True by default so that the initial tree population doesn't cause the control to update every time a node is added)


    3) That's it! Run your project and your tree should fully support all specified drag/drop and user interaction (adding/removing/renaming) straight away!


    EDIT:
    I will add more documentation to the above post, if anybody needs it but I don't have time right now. Hopefully, the demo is pretty clear on most things.
    Attached Files Attached Files
    Last edited by ColinE66; May 23rd, 2018 at 11:57 AM.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  2. #2
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,059

    Re: [vbRichClient] RAD TreeView

    Wonderful, thanks for sharing.

  3. #3
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Test first and hope to do better!
    QQ: 289778005

  4. #4
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,079

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ChenLin View Post
    Test first and hope to do better!
    What does that mean? It's obviously been tested, but of course there may be bugs. Why not report a bug instead of just giving a flippant comment?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by jpbro View Post
    It's obviously been tested, but of course there may be bugs.
    Actually, I just tried to create a tree view from scratch and discovered something that I'd neglected to mention in my opening post...

    The Tree has a 'Suspended' property which exists so that nodes can be bulk-added without the tree updating. By default, it is set to True, based on the assumption that initial population of the tree will occur at app startup. So, what I should have mentioned was that the final stage of Step 2, above, is to set the Suspended property to False, which will cause the Tree to update itself.

    I'll modify the OP...
    Last edited by ColinE66; May 21st, 2018 at 12:22 PM.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  6. #6
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by jpbro View Post
    What does that mean? It's obviously been tested, but of course there may be bugs. Why not report a bug instead of just giving a flippant comment?
    Because I did experience real-time errors in several places when I tested 91:

    Attachment 159167
    QQ: 289778005

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ChenLin View Post
    Because I did experience real-time errors in several places when I tested 91:

    Attachment 159167
    Well, why didn't you say that in the first place?

    Also, did you get these errors in the demo, or when you tried to use the code in your own project? Also, it looks like you have modified the code; there is no On Error Resume Next in sub Draw.

    Try to provide some information that I can actually use, please!
    Last edited by ColinE66; May 22nd, 2018 at 02:46 AM.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  8. #8
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Just in the demo, I currently have no projects that need this, just for testing.
    Attachment 159171
    QQ: 289778005

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    @ChenLin

    vbRichClient5 is registered on your machine, yes?

    Also, please take out any On Error Resume Next lines you have added, step through the code, and let me know the first line on which an error occurs.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  10. #10
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    VbRichclient5 has been quoted. There are three hints of errors. Please look at the screenshots.

    Attachment 159189
    QQ: 289778005

  11. #11
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ColinE66 View Post
    @ChenLin

    vbRichClient5 is registered on your machine, yes?

    Also, please take out any On Error Resume Next lines you have added, step through the code, and let me know the first line on which an error occurs.
    Agreed. He should check whether it is a right version.
    Attached Images Attached Images  

  12. #12
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by Jonney View Post
    Agreed. He should check whether it is a right version.
    I use the latest version 443, if you add On error resume next in the wrong place, you can normally open the test.
    QQ: 289778005

  13. #13
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,079

    Re: [vbRichClient] RAD TreeView

    Latest version of vbRichClient5 is 5.0.66 from here: https://vbrichclient.com/#/en/Downloads.htm, try installing that. What's version 443?

  14. #14
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by jpbro View Post
    Latest version of vbRichClient5 is 5.0.66 from here: https://vbrichclient.com/#/en/Downloads.htm, try installing that. What's version 443?
    Sorry, this version number is wrong... 443 is oleexp.tlb
    QQ: 289778005

  15. #15
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,059

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ChenLin View Post
    Sorry, this version number is wrong... 443 is oleexp.tlb
    ColinE66's TreeView only requires vbRichClient5.dll and does not require oleexp.tlb.

    It works very well on my computers, whether on XP or on Win10.
    Last edited by dreammanor; May 23rd, 2018 at 02:17 AM.

  16. #16

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    The RC5 version is unlikely to be the problem, although it would be interesting if ChenLin would actually answer that question.

    And just to be 100% clear, the 1st error occurs because mAppearance is Nothing in sub CreateBackgroundBuffer, correct?
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  17. #17
    Lively Member
    Join Date
    May 2016
    Location
    China
    Posts
    97

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ColinE66 View Post
    The RC5 version is unlikely to be the problem, although it would be interesting if ChenLin would actually answer that question.

    And just to be 100% clear, the 1st error occurs because mAppearance is Nothing in sub CreateBackgroundBuffer, correct?
    I'm not sure if this is the reason. Anyway, only adding the on error resume next to the three lines in order can be tested.
    QQ: 289778005

  18. #18
    PowerPoster
    Join Date
    Oct 2013
    Posts
    3,161

    Re: [vbRichClient] RAD TreeView

    @ChenLin Have you tried debugging the code?
    As you are currently the only one having some problems you should give more clues instead of tiny screenshots with the lines highlighted on which errors occur.
    Do you know how to debug VB6 code? If so then please provide some actual information about what happens when you step through the code.
    Last edited by Arnoutdv; May 23rd, 2018 at 05:30 AM.

  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by ChenLin View Post
    I'm not sure if this is the reason. Anyway, only adding the on error resume next to the three lines in order can be tested.
    Still waiting for the RC5 version on your machine...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  20. #20
    PowerPoster
    Join Date
    Oct 2013
    Posts
    3,161

    Re: [vbRichClient] RAD TreeView

    I do get an error when doing "SHIFT-INS" on a node.
    Code:
    Public Property Get DefaultChildType() As String ' the default child type is the first listed type
    Dim s() As String
       If Len(mValidChildTypes) = 0 Then Exit Property
       s() = Split(mValidChildTypes, "|")
       ' When doing a SHIFT-INS the content of mValidChildTypes = "*"
       ' Doing a Split on "|" and accessing element 1 throws an error
       DefaultChildType = s(1)
    End Property

  21. #21

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    Quote Originally Posted by Arnoutdv View Post
    I do get an error when doing "SHIFT-INS" on a node.
    Thanks for the catch. That DefaultChildType thing was a last-minute addition - it clearly needs a bit more work! I'll update the code when I get home and re-submit a new version in the OP.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  22. #22

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,029

    Re: [vbRichClient] RAD TreeView

    Original post updated to incorporate a fix for the bug that arnoutdv found...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width