Announcement

Collapse
No announcement yet.

Treeview

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Treeview

    I downloaded the source for adding a TreeView control to DDT.

    Does anyone have an example for adding icons to the Treeview?

    --Dave


    ------------------
    Home of the BASIC Gurus
    www.basicguru.com
    Home of the BASIC Gurus
    www.basicguru.com

  • #2
    Thanks to Eric Pearson who gave me some pointers... I got it working (sort of).

    I can't control (yet) which image is displayed for each "state" of a branch (open/close).

    You can download the code, bitmaps & sample from http://www.basicguru.com/navarro/tview.zip

    --Dave


    ------------------
    Home of the BASIC Gurus
    www.basicguru.com
    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      Hey guys!

      I was playing around with this code today...

      In the TVInsertItemBMP function you need to change

      tv_insert.Item.Item.mask = %TVIF_STATE OR %TVIF_TEXT OR %TVIF_IMAGE

      to

      tv_insert.Item.Item.mask = %TVIF_STATE OR %TVIF_TEXT OR %TVIF_IMAGE OR %TVIF_SELECTEDIMAGE

      otherwise the selected image is always going to be the oFolder bitmap
      for the children. Weird.

      Scott


      ------------------
      Scott Wolfington
      http://www.boogietools.com


      [This message has been edited by Scott Wolfington (edited March 05, 2003).]
      Scott Wolfington
      [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

      Comment


      • #4


        [This message has been edited by Jules Marchildon (edited February 24, 2001).]
        Best regards
        Jules
        www.rpmarchildon.com

        Comment


        • #5
          Yeah, I thought that was weird too. Doesn't compile if you remove
          the second .Item though [or the first .Item ;-)].

          Scott


          ------------------
          Scott Wolfington
          http://www.boogietools.com



          [This message has been edited by Scott Wolfington (edited March 05, 2003).]
          Scott Wolfington
          [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

          Comment


          • #6
            No, "Item.Item." is correct. The structures are nested this way:

            Code:
            UNION TV_ITEM_UNION
                itemex AS TVITEMEX
                item AS TV_ITEM
            END UNION
             
            TYPE TV_INSERTSTRUCT
              hParent AS DWORD
              hInsertAfter AS DWORD
              item AS TV_ITEM_UNION
            END TYPE
            So if you DIM a structure as a TV_INSERTSTRUCT it has an element called Item that is a TV_ITEM__UNION, which has an element called Item.

            Not ideal naming, perhaps, but the compilers have no problem keeping it straight.

            -- Eric

            ------------------
            Perfect Sync: Perfect Sync Development Tools
            Email: mailto:[email protected][email protected]</A>
            "Not my circus, not my monkeys."

            Comment


            • #7


              [This message has been edited by Jules Marchildon (edited February 24, 2001).]
              Best regards
              Jules
              www.rpmarchildon.com

              Comment


              • #8
                Jules --

                I suspect that you're not using the latest COMMCTRL.INC file. I checked the file that is (internally) dated December 10, 1999 and it does contain the structures I posted.

                The latest files are available for download from this web site.

                -- Eric


                ------------------
                Perfect Sync: Perfect Sync Development Tools
                Email: mailto:[email protected][email protected]</A>

                [This message has been edited by Eric Pearson (edited February 21, 2001).]
                "Not my circus, not my monkeys."

                Comment


                • #9


                  [This message has been edited by Jules Marchildon (edited February 24, 2001).]
                  Best regards
                  Jules
                  www.rpmarchildon.com

                  Comment


                  • #10
                    > is there any advantage to this alternate structure.

                    Well, one advantage is that Dave's code will compile.

                    Seriously, the TVITEMEX structure adds the lIntegral element, which can be used to create oversized items for owner-drawn treeview items. If you don't need that feature, there's no real advantage.

                    But IMO it's best to use the lastest WIN32API.INC files as improvements are made by PowerBASIC Support, regardless of whether or not you need the specific improvements. One of these days they will change something you do need, and then you would have to choose between "catching up" with all of the changes, or forever cutting and pasting custom versions of WIN32API.INC for your own use. Been there, done that, learned my lesson...

                    -- Eric

                    P.S For more info about lIntegral....

                    http://msdn.microsoft.com/library/psdk/shellcc/commctls/TreeView/Structures/TVITEMEX.h tm


                    ------------------
                    Perfect Sync: Perfect Sync Development Tools
                    Email: mailto:[email protected][email protected]</A>

                    [This message has been edited by Eric Pearson (edited February 21, 2001).]
                    "Not my circus, not my monkeys."

                    Comment


                    • #11
                      Eric;

                      No problem, I agree with you.

                      Regards,
                      Jules



                      [This message has been edited by Jules Marchildon (edited February 24, 2001).]
                      Best regards
                      Jules
                      www.rpmarchildon.com

                      Comment


                      • #12
                        To avoid confusion, the PB include file should have used TVINSERTSTRUCT,
                        not TV_INSERTSTRUCT to follow current naming conventions as per MicroSofts
                        updates.

                        Regards,
                        Jules

                        [This message has been edited by Jules Marchildon (edited February 24, 2001).]
                        Best regards
                        Jules
                        www.rpmarchildon.com

                        Comment

                        Working...
                        X