Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tree View Control (A2000)

    How do I use this tool.
    I have created a form, referenced the MSCOMCTL.OCX, created the control on the form.
    Nothing's happening.
    how do i populate this control and create the nodes.
    any help is advantagious.

    Dave

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Tree View Control (A2000)

    Since Treeview and Listview are not native Access controls, you'll have to populate and handle them entirely in code.

    It would take too long to explain it all here. I have attached a sample Access 97 database. I hope you will be able to get the general idea from it.

    The database contains a few tables, one query and one form.
    The form contains a treeview and a listview.

    If you select one of these in Design view, the properties window won't display all relevant properties and methods. You can open a specialized properties window by right-clicking the controls, selecting '...-object' and then Properties.

    In the specialized properties window of the listview, you will find how the column headers were created.

    If you look at the code behind the form, you will see how the treeview and listview are filled and handled.

    HTH, Hans
    Attached Files Attached Files

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tree View Control (A2000)

    Hans

    Just got round to mess about with this.
    I've tried to re-produce what you have done with your example.

    I'm a little stuck on a couple of things.

    You have several tables and one query, I have set the primary keys in my tables.
    I've used the MStreeview 5.0 wizard but am now unable to have duplicate values, (understandable)

    I'm making mine as follows.
    FORD
    ESCORT
    MONDEO
    GALAXY etc

    Can you provide a simple overview on the way you set yours up.

    Dave

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Tree View Control (A2000)

    The key values in a TreeView must be unique, and always start with a letter.

    In the demo I posted in April, there are several levels, and the same name can (potentially) come up in several levels. Within one level the names are unique, however. Therefore I made the keys by prefixing the name with a letter indicating the level and an underscore. So, for instance, at the country level, the keys are "L_" plus the country name; at the region level, the keys are "S_" plus the region name.

    If you have one table with a primary key, you can use that to construct the keys. If the primary key is numeric (for instance an AutoNumber), or if it is alphanumeric but could begin with a digit, you can use an arbitrary prefix, say "K_" (for key).

    To add nodes, you use the Add method of the Nodes collection of the Treeview.

    Add has 4 arguments:

    Relative:
    Omit if the new node is at the highest level. Otherwise, it must be a node previously defined.
    Relationship:
    tvwChild indicates that the new node is a "child" of the node in Relative.
    Among other possible values are tvwFirst, tvwNext and tvwLast.
    These indicate that the new node will be added at the same level as the Relative, in the indicated position.
    Key:
    A unique string value identifying the new node.
    Text:
    The string value that is displayed in the TreeView.

    HTH,
    Hans

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tree View Control (A2000)

    Thanks Hans
    I'll study it in more details.

    Dave

Posting Permissions

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