Announcement

Collapse
No announcement yet.

Treeview Control + Imagelist + Checkbox = BIG CHECKS

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

  • Treeview Control + Imagelist + Checkbox = BIG CHECKS

    Been working with the treeview control, not the first time, but is first time I've used an imagelist with the treeview control. Along with checkbox's. The images I'm using are thumbnailed to 48x48 and have two images per treeview leaf, and it looks ok, except for the big PLUS sign next to each one, ...

    And when I enable checkboxes with the control, the darn checkbox is the same size as the thumbnail. Is that like default behavior of a treeview or just with the TREEVIEW CONTROL?

    P.S. Also, is there a means to keep the selection highlight from flashing the node when clicking the checkbox?
    Furcadia, an interesting online MMORPG in which you can create and program your own content.

  • #2
    AFAIK the height of each node of the tree is controlled by the size of the image list assigned to same. If you don't assign one and use checkboxes Windows will do its own thing to size the state images used for the checkboxes.

    Also, is there a means to keep the selection highlight from flashing the node when clicking the checkbox
    Huh? What do you mean by "Flashing?" The default action is to select the most recently-clicked node and that results in redrawing in the selection color, and redrawing the node which formerly was selected in the 'normal' color.

    You can prevent selection of a node by processing the WM_NOTIFY/TVN_SELCHANGING notification and returning TRUE if you don't want that node selected. (works with keyboard as well as mouse clicks).

    Then again, "code not shown." You might be doing something like forcing your own redraw when Windows was going to redraw it anyway... that sounds a bit like "flashing."
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      There is a difference in processing whether you click the checkbox or click the node, if you click the checkbox, you're not selecting the node. However, the selection highlight flashes to the just checked / unchecked item then either returns to the previous selection, or the top of the visible part of the treeview.

      Code not shown because you'd need a bunch of additional things to go along with the code, might be able to construct a demo which includes a sample image list in the resource file. Will look into that.
      Furcadia, an interesting online MMORPG in which you can create and program your own content.

      Comment


      • #4
        Code not shown because you'd need a bunch of additional things to go along with the code
        Perhaps all you need to show is your window procedure, specifically anything you are doing under WM_NOTIFY, plus the styles (regular and extended) used when creating the treeview control.

        Now, that *IS* a "perhaps" that will be sufficient....
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Possible:
          Code:
              CONTROL ADD "SysTreeView32", hDlg, %IDTV_FOXTREE, "FoxTree", 6, 254, 126, _
                  149, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %TVS_HASBUTTONS OR _
                  %TVS_LINESATROOT OR %TVS_SHOWSELALWAYS OR %TVS_FULLROWSELECT OR _
                  %TVS_CHECKBOXES, %WS_EX_CLIENTEDGE OR %WS_EX_ACCEPTFILES OR _
                  %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
          And:
          Code:
          CALLBACK FUNCTION ShowFOXEDITProc()
          LOCAL BumpX, iError, procResults        AS LONG
          ....
                  CASE %WM_NOTIFY
                      SELECT CASE CB.CTL
                          CASE %idtv_foxtree, %idtv_importtree
                              IF CB.NMCODE = %TVN_SELCHANGED THEN
                                  LOCAL tvNmCode AS NM_TREEVIEW POINTER
                                  tvNmCode = CB.LPARAM
                                  ' make big image here
                              END IF
                              ' procResults = 1
                      END SELECT
          ....
              FUNCTION = procResults
          END FUNCTION
          That's it so far for the notify processing, ...

          Note: PBForms did the CONTROL ADD.
          Furcadia, an interesting online MMORPG in which you can create and program your own content.

          Comment


          • #6
            Code:
            CASE %WM_NOTIFY
                        SELECT CASE CB.CTL 
                           CASE %idtv_foxtree, %idtv_importtree
                                IF CB.NMCODE = %TVN_SELCHANGED THEN
                                    LOCAL tvNmCode AS NM_TREEVIEW POINTER
                                    tvNmCode = CB.LPARAM
                                    ' make big image here
                                END IF
                                ' procResults = 1
                        END SELECT
            Two things:

            1. "Make a big image here" sounds like you might be doing something significant to the display process.
            2. According to the doc, CB.CTL only identifies the control when the message is WM_COMMAND. I think you want to us CB.NMID when you need to identify a control in response to a WM_NOTIFY message. (But you did use CB.NMCODE, which is the new function to get the notification message under WM_NOTIFY).
            3. (Well, OK, three things). By the time you get TVN_SELCHANGED, everything is done; which I think means the screen has already been repainted. TVN_SELCHANGING ("I want to change the selection, captain may I?" ) might be a better choice on which to do whatever you are doing.

            What exactly is it you want to do when the selection changes?

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              That's easy, treeview is full of little thumbnails which are then displayed on the main surface when the user clicks on one. The checkbox'es are for mass management of the properties for the images. Note that the program is still very raw, I've only been working on the conversion for a couple of weeks now. This particular screenshot is with the checkbox's turned off, and the thumbnail size set to 48x48. When checkbox's are enabled, the checkbox is the same size as the thumbnail, or rather, the same size as the ImageList attributes which is attached to the TreeView, so if the tNail are 16x16, so is the checkbox, and likewise if you jack it up to 64x64. And the +/- icons resize in proportion to the tNail size. And yes, "Make big image here" is where the call to the function that returns the full size image for display goes, but on the DISPLAY side of the program, ...
              Attached Files
              Furcadia, an interesting online MMORPG in which you can create and program your own content.

              Comment

              Working...
              X