View Issue Details

IDProjectCategoryView StatusLast Update
0005119JEDI VCL00 JVCL Componentspublic2011-06-10 16:09
ReportertetarddAssigned ToAHUser 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.39 
Target VersionFixed in Version3.40 
Summary0005119: TjvTreeView does not fire OnNodeCheckedChange on Windows XP
DescriptionHi,

TJvTreeView does not fire OnNodeCheckedChange on Windows XP SP3 latest update.

I think the bug comes from the following (see comments marked ***):

procedure TJvTreeView.CNNotify(var Msg: TWMNotify);
...
     NM_TVSTATEIMAGECHANGING: // ComCtrls 6+
     *** Wrong here: it's not ComCtrls 6+, it's ComCtrls 6+ AND Vista.
         My lastest Windows XP SP3 HAS ComCtrls 6 but this notification is NOT
         sent so we still need the emulation (see below) ***
     begin
          if CheckBoxes and (GetComCtlVersion >= ComCtlVersionIE6) then
          begin
            Node := Items.GetNode(PNMTVStateImageChanging(Msg.NMHdr).hti);
            PostCheckStateChanged(Node);
          end;
        end;
      NM_CLICK, NM_RCLICK:
        begin
          Node := GetNodeAt(Point.X, Point.Y);
          if Assigned(Node) and not MultiSelect then
            Selected := Node;

          if (Node <> nil) and (Msg.NMHdr.code = NM_RCLICK) then
            if Assigned(TJvTreeNode(Node).PopupMenu) then // Popup menu may not be assigned
              TJvTreeNode(Node).PopupMenu.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);

          *** Original code: here, XP SP3 should have this emulation performed
              but as the GetComCtlVersion < ComCtlVersionIE6 returns False in
              my XP SP3 with latest updates, the PostCheckStateChanged is not
              called ***
          if Checkboxes and (GetComCtlVersion < ComCtlVersionIE6) and (Node <> nil) and // emulate missing notify message
             (htOnStateIcon in GetHitTestInfoAt(Point.X, Point.Y)) then
            PostCheckStateChanged(Node);

          *** Modifications proposed by David Tetard ***
          if Checkboxes and ((GetComCtlVersion < ComCtlVersionIE6) Or CheckWin32Version(5))
             and (Node <> nil) and // emulate missing notify message
             (htOnStateIcon in GetHitTestInfoAt(Point.X, Point.Y)) then
            PostCheckStateChanged(Node);
        end;
Additional InformationNote that this proposed fix is only for the click on the check boxes, there are other places that call PostCheckStateChanged that may need fixing too.
TagsNo tags attached.

Activities

obones

2010-03-08 15:23

administrator   ~0017239

Please provide the zipped sources of a sample application showing this

tetardd

2010-03-09 13:50

reporter   ~0017292

I will as soon as I can but for now, it would be faster to create your own:
1- Create ap with VCL form.
2- Add TjvTreeView to it and set to display the check boxes.
3- Add a few items in the TjvTreeView.
4- Create an OnNodeCheckedChange event that simply executes "ShowMessage('Bingo')".

Run app, tick a check box, no "Bingo" message!

2010-03-13 14:07

 

Bug jvTreeView.zip (451,505 bytes)

tetardd

2010-03-13 14:09

reporter   ~0017302

Here we go, demo included. Note that this bug seems to be dependent on the installations that took place in the OS, as described in my original post.

AHUser

2010-04-02 13:41

developer   ~0017345

Fixed in SVN.

Issue History

Date Modified Username Field Change
2010-01-22 21:09 tetardd New Issue
2010-03-08 15:23 obones Note Added: 0017239
2010-03-08 15:23 obones Status new => feedback
2010-03-09 13:50 tetardd Note Added: 0017292
2010-03-13 14:08 tetardd File Added: Bug jvTreeView.zip
2010-03-13 14:09 tetardd Note Added: 0017302
2010-04-02 13:41 AHUser Note Added: 0017345
2010-04-02 13:41 AHUser Status feedback => resolved
2010-04-02 13:41 AHUser Fixed in Version => Daily / SVN
2010-04-02 13:41 AHUser Resolution open => fixed
2010-04-02 13:41 AHUser Assigned To => AHUser
2011-06-10 16:09 obones Fixed in Version Daily / SVN => 3.40