From: <ah...@us...> - 2013-05-25 13:40:40
|
Revision: 13521 http://jvcl.svn.sourceforge.net/jvcl/?rev=13521&view=rev Author: ahuser Date: 2013-05-25 13:40:28 +0000 (Sat, 25 May 2013) Log Message: ----------- Mantis 6103: Assign TJvTreeNode.Checked doesn't work Modified Paths: -------------- trunk/jvcl/run/JvCheckTreeView.pas trunk/jvcl/run/JvComCtrls.pas Modified: trunk/jvcl/run/JvCheckTreeView.pas =================================================================== --- trunk/jvcl/run/JvCheckTreeView.pas 2013-05-25 13:11:27 UTC (rev 13520) +++ trunk/jvcl/run/JvCheckTreeView.pas 2013-05-25 13:40:28 UTC (rev 13521) @@ -400,8 +400,8 @@ mask := TVIF_STATE; hItem := Node.ItemId; if TreeView_GetItem(Handle, Item) then - Result := (((Item.State and TVIS_STATEIMAGEMASK) or TVIS_CHECKED) = TVIS_CHECKED) or - (((Item.State and TVIS_STATEIMAGEMASK) or TVIS_CHECKED shl 1) = TVIS_CHECKED shl 1) + Result := (((Item.state and TVIS_STATEIMAGEMASK) or TVIS_CHECKED) = TVIS_CHECKED) or + (((Item.state and TVIS_STATEIMAGEMASK) or TVIS_CHECKED shl 1) = TVIS_CHECKED shl 1) else Result := False; end; @@ -507,18 +507,15 @@ Item: TTVItem; begin FillChar(Item, SizeOf(Item), 0); - with Item do - begin - hItem := Node.ItemId; - mask := TVIF_STATE; - StateMask := TVIS_STATEIMAGEMASK; - TreeView_GetItem(Handle, Item); - if Value then - Item.State := Item.State + TVIS_CHECKED - else - Item.State := Item.State - TVIS_CHECKED; - TreeView_SetItem(Handle, Item); - end; + Item.hItem := Node.ItemId; + Item.mask := TVIF_STATE; + Item.stateMask := TVIS_STATEIMAGEMASK; + TreeView_GetItem(Handle, Item); + if Value then + Item.state := TVIS_CHECKED + else + Item.state := TVIS_CHECKED shr 1; + TreeView_SetItem(Handle, Item); end; procedure TJvCheckTreeView.SetRadioItem(Node: TTreeNode; const Value: Boolean); @@ -595,11 +592,11 @@ begin Item.hItem := Node.ItemId; Item.mask := TVIF_STATE; - Item.StateMask := TVIS_STATEIMAGEMASK; + Item.stateMask := TVIS_STATEIMAGEMASK; TreeView_GetItem(Handle, Item); - if ((Item.State and TVIS_STATEIMAGEMASK) <> Cardinal(IndexToStateImageMask(CheckBoxOptions.RadioUncheckedIndex))) and - ((Item.State and TVIS_STATEIMAGEMASK) <> Cardinal(IndexToStateImageMask(CheckBoxOptions.RadioCheckedIndex))) then + if ((Item.state and TVIS_STATEIMAGEMASK) <> UINT(IndexToStateImageMask(CheckBoxOptions.RadioUncheckedIndex))) and + ((Item.state and TVIS_STATEIMAGEMASK) <> UINT(IndexToStateImageMask(CheckBoxOptions.RadioCheckedIndex))) then begin Item.mask := TVIF_STATE or TVIF_HANDLE; Item.stateMask := TVIS_STATEIMAGEMASK; Modified: trunk/jvcl/run/JvComCtrls.pas =================================================================== --- trunk/jvcl/run/JvComCtrls.pas 2013-05-25 13:11:27 UTC (rev 13520) +++ trunk/jvcl/run/JvComCtrls.pas 2013-05-25 13:40:28 UTC (rev 13521) @@ -2560,7 +2560,7 @@ mask := TVIF_STATE; hItem := ItemId; if TreeView_GetItem(Handle, Item) then - Result := ((Item.State and TVIS_BOLD) = TVIS_BOLD) + Result := ((Item.state and TVIS_BOLD) = TVIS_BOLD) else Result := False; end; @@ -2581,7 +2581,7 @@ mask := TVIF_STATE; hItem := ItemId; if TreeView_GetItem(Handle, Item) then - Result := ((Item.State and TVIS_CHECKED) = TVIS_CHECKED) + Result := ((Item.state and TVIS_CHECKED) = TVIS_CHECKED) else Result := False; end; @@ -2602,9 +2602,9 @@ hItem := ItemId; StateMask := TVIS_BOLD; if Value then - Item.State := TVIS_BOLD + Item.state := TVIS_BOLD else - Item.State := 0; + Item.state := 0; TreeView_SetItem(Handle, Item); end; end; @@ -2618,30 +2618,24 @@ begin FChecked := Value; if Owner.Owner is TJvTreeView then - begin - TJvTreeView(Owner.Owner).SetCheckedInState(Self, FChecked); - end + TJvTreeView(Owner.Owner).SetCheckedInState(Self, FChecked) else begin FillChar(Item, SizeOf(Item), 0); - with Item do - begin - hItem := ItemId; - mask := TVIF_STATE; - StateMask := TVIS_STATEIMAGEMASK; - if Value then - Item.State := TVIS_CHECKED - else - Item.State := TVIS_CHECKED shr 1; - TreeView_SetItem(Handle, Item); - end; + Item.hItem := ItemId; + Item.mask := TVIF_STATE; + Item.stateMask := TVIS_STATEIMAGEMASK; + if Value then + Item.state := TVIS_CHECKED + else + Item.state := TVIS_CHECKED shr 1; + TreeView_SetItem(Handle, Item); end; DoCheckedChange; end; end; -procedure TJvTreeNode.MoveTo(Destination: TTreeNode; - Mode: TNodeAttachMode); +procedure TJvTreeNode.MoveTo(Destination: TTreeNode; Mode: TNodeAttachMode); var SaveItem, Item: TTVItem; begin @@ -2841,7 +2835,7 @@ mask := TVIF_STATE; hItem := Node.ItemId; if TreeView_GetItem(Handle, Item) then - Result := ((Item.State and TVIS_CHECKED) = TVIS_CHECKED) + Result := ((Item.state and TVIS_CHECKED) = TVIS_CHECKED) else Result := False; end; @@ -3021,9 +3015,9 @@ mask := TVIF_STATE; StateMask := TVIS_STATEIMAGEMASK; if Value then - Item.State := TVIS_CHECKED + Item.state := TVIS_CHECKED else - Item.State := TVIS_CHECKED shr 1; + Item.state := TVIS_CHECKED shr 1; TreeView_SetItem(Handle, Item); end; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |