View Issue Details

IDProjectCategoryView StatusLast Update
0014881LazarusPatchpublic2011-12-01 11:22
ReporterBoian MitovAssigned ToPaul Ishenin 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0014881: Added StateImages in TListView
DescriptionI have added StateImages in TListView and have implemented the functionality in Windows.
Additional InformationPatch is attached.
TagsTListView
Fixed in Revision22310
LazTarget0.9.30
WidgetsetWin32/Win64
Attached Files
  • listviewpath.patch (26,315 bytes)
    Index: ideintf/listviewpropedit.pp
    ===================================================================
    --- ideintf/listviewpropedit.pp	(revision 22267)
    +++ ideintf/listviewpropedit.pp	(working copy)
    @@ -201,6 +201,7 @@
       begin
         TreeView1.Selected.ImageIndex := StrToIntDef(edtIndexImg.Text, -1);
         TreeView1.Selected.StateIndex := StrToIntDef(edtIndexState.Text, -1);
    +    TreeView1.Selected.SelectedIndex := TreeView1.Selected.ImageIndex;
     
         edtIndexImg.Text := IntToStr(TreeView1.Selected.ImageIndex);
         edtIndexState.Text := IntToStr(TreeView1.Selected.StateIndex);
    @@ -228,7 +229,8 @@
             with Node do
             begin
               ImageIndex := AListView.Items[I].ImageIndex;
    -          //StateIndex := AListView.Items[I].StateIndex;
    +          StateIndex := AListView.Items[I].StateIndex;
    +          SelectedIndex := ImageIndex;
             end;
     
             //SubItems
    @@ -269,7 +271,7 @@
               Item := FListView.Items.Add;
               Item.Caption := Node.Text;
               Item.ImageIndex := Node.ImageIndex;
    -          //Item.StateIndex := Node.StateIndex;
    +          Item.StateIndex := Node.StateIndex;
     
               //SubItems
               for J := 0 to Node.Count - 1 do
    Index: ideintf/listviewpropedit.lfm
    ===================================================================
    --- ideintf/listviewpropedit.lfm	(revision 22267)
    +++ ideintf/listviewpropedit.lfm	(working copy)
    @@ -12,14 +12,14 @@
       Constraints.MinWidth = 400
       OnCreate = FormCreate
       Position = poScreenCenter
    -  LCLVersion = '0.9.27'
    +  LCLVersion = '0.9.29'
       object BtnOK: TBitBtn
         AnchorSideRight.Control = BtnCancel
         AnchorSideBottom.Control = Owner
         AnchorSideBottom.Side = asrBottom
    -    Left = 183
    -    Height = 36
    -    Top = 204
    +    Left = 180
    +    Height = 26
    +    Top = 214
         Width = 75
         Anchors = [akRight, akBottom]
         AutoSize = True
    @@ -36,10 +36,10 @@
         AnchorSideRight.Control = BtnApply
         AnchorSideBottom.Control = Owner
         AnchorSideBottom.Side = asrBottom
    -    Left = 264
    -    Height = 32
    -    Top = 208
    -    Width = 78
    +    Left = 261
    +    Height = 26
    +    Top = 214
    +    Width = 81
         Anchors = [akRight, akBottom]
         AutoSize = True
         BorderSpacing.Around = 6
    @@ -57,8 +57,8 @@
         AnchorSideBottom.Control = Owner
         AnchorSideBottom.Side = asrBottom
         Left = 348
    -    Height = 29
    -    Top = 211
    +    Height = 25
    +    Top = 215
         Width = 75
         Anchors = [akRight, akBottom]
         AutoSize = True
    @@ -76,8 +76,8 @@
         AnchorSideBottom.Control = Owner
         AnchorSideBottom.Side = asrBottom
         Left = 429
    -    Height = 36
    -    Top = 204
    +    Height = 26
    +    Top = 214
         Width = 75
         Anchors = [akRight, akBottom]
         AutoSize = True
    @@ -94,13 +94,13 @@
         AnchorSideTop.Control = Owner
         AnchorSideBottom.Control = BtnOK
         Left = 6
    -    Height = 192
    +    Height = 202
         Top = 6
         Width = 295
         Anchors = [akTop, akLeft, akBottom]
         BorderSpacing.Around = 6
         Caption = 'Items'
    -    ClientHeight = 173
    +    ClientHeight = 184
         ClientWidth = 291
         TabOrder = 4
         object TreeView1: TTreeView
    @@ -109,14 +109,14 @@
           AnchorSideBottom.Control = GroupBox1
           AnchorSideBottom.Side = asrBottom
           Left = 5
    -      Height = 163
    +      Height = 174
           Top = 5
           Width = 160
           Anchors = [akTop, akLeft, akRight, akBottom]
           BorderSpacing.Left = 5
           BorderSpacing.Top = 5
           BorderSpacing.Bottom = 5
    -      DefaultItemHeight = 19
    +      DefaultItemHeight = 17
           HideSelection = False
           ReadOnly = True
           TabOrder = 0
    @@ -184,22 +184,22 @@
         AnchorSideRight.Side = asrBottom
         AnchorSideBottom.Control = BtnOK
         Left = 307
    -    Height = 192
    +    Height = 202
         Top = 6
         Width = 197
         Anchors = [akTop, akLeft, akRight, akBottom]
         BorderSpacing.Around = 6
         Caption = 'Item Properties'
    -    ClientHeight = 173
    +    ClientHeight = 184
         ClientWidth = 193
         TabOrder = 5
         object LabelCaption: TLabel
           AnchorSideLeft.Control = GroupBox2
           AnchorSideTop.Control = GroupBox2
           Left = 6
    -      Height = 18
    +      Height = 16
           Top = 6
    -      Width = 54
    +      Width = 46
           BorderSpacing.Left = 6
           BorderSpacing.Top = 6
           Caption = 'Caption:'
    @@ -211,9 +211,9 @@
           AnchorSideTop.Control = edtText
           AnchorSideTop.Side = asrBottom
           Left = 6
    -      Height = 18
    -      Top = 55
    -      Width = 83
    +      Height = 16
    +      Top = 53
    +      Width = 68
           BorderSpacing.Top = 6
           Caption = 'Image Index:'
           FocusControl = edtIndexImg
    @@ -224,14 +224,13 @@
           AnchorSideTop.Control = edtIndexImg
           AnchorSideTop.Side = asrBottom
           Left = 6
    -      Height = 18
    -      Top = 104
    -      Width = 78
    +      Height = 16
    +      Top = 100
    +      Width = 61
           BorderSpacing.Top = 6
           Caption = 'State Index:'
           FocusControl = edtIndexState
           ParentColor = False
    -      Visible = False
         end
         object edtText: TEdit
           AnchorSideLeft.Control = LabelCaption
    @@ -241,7 +240,7 @@
           AnchorSideRight.Side = asrBottom
           Left = 6
           Height = 23
    -      Top = 26
    +      Top = 24
           Width = 182
           Anchors = [akTop, akLeft, akRight]
           BorderSpacing.Top = 2
    @@ -255,7 +254,7 @@
           AnchorSideTop.Side = asrBottom
           Left = 6
           Height = 23
    -      Top = 75
    +      Top = 71
           Width = 48
           BorderSpacing.Top = 2
           OnEditingDone = edtIndexStateEditingDone
    @@ -267,12 +266,11 @@
           AnchorSideTop.Side = asrBottom
           Left = 6
           Height = 23
    -      Top = 124
    +      Top = 118
           Width = 48
           BorderSpacing.Top = 2
           OnEditingDone = edtIndexStateEditingDone
           TabOrder = 2
    -      Visible = False
         end
       end
     end
    Index: ideintf/listviewpropedit.lrs
    ===================================================================
    --- ideintf/listviewpropedit.lrs	(revision 22267)
    +++ ideintf/listviewpropedit.lrs	(working copy)
    @@ -6,42 +6,42 @@
       +'OK'#11'BorderIcons'#11#12'biSystemMenu'#6'biHelp'#0#7'Caption'#6#21'ListVie'
       +'w Items Editor'#12'ClientHeight'#3#246#0#11'ClientWidth'#3#254#1#21'Constra'
       +'ints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3#144#1#8'OnCreate'#7#10'F'
    -  +'ormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.27'#0#7
    +  +'ormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#7
       +'TBitBtn'#5'BtnOK'#23'AnchorSideRight.Control'#7#9'BtnCancel'#24'AnchorSideB'
       +'ottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
    -  +#183#0#6'Height'#2'$'#3'Top'#3#204#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
    +  +#180#0#6'Height'#2#26#3'Top'#3#214#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
       +'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#3'&OK'
       +#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#4'Kind'#7#4'bk'
       +'OK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#9'B'
       +'tnCancel'#23'AnchorSideRight.Control'#7#8'BtnApply'#24'AnchorSideBottom.Con'
    -  +'trol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#8#1#6'H'
    -  +'eight'#2' '#3'Top'#3#208#0#5'Width'#2'N'#7'Anchors'#11#7'akRight'#8'akBotto'
    +  +'trol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#5#1#6'H'
    +  +'eight'#2#26#3'Top'#3#214#0#5'Width'#2'Q'#7'Anchors'#11#7'akRight'#8'akBotto'
       +'m'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#6'Cancel'#9#7'Caption'#6#6
       +'Cancel'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#4'Kind'
       +#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#7'TB'
       +'itBtn'#8'BtnApply'#23'AnchorSideRight.Control'#7#7'BtnHelp'#24'AnchorSideBo'
       +'ttom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
    -  +'\'#1#6'Height'#2#29#3'Top'#3#211#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
    +  +'\'#1#6'Height'#2#25#3'Top'#3#215#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
       +'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#6'&Appl'
       +'y'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#9'NumGlyphs'
       +#2#0#7'OnClick'#7#13'btnApplyClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#7'BtnHelp'
       +#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBott'
       +'om'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'a'
    -  +'srBottom'#4'Left'#3#173#1#6'Height'#2'$'#3'Top'#3#204#0#5'Width'#2'K'#7'Anc'
    +  +'srBottom'#4'Left'#3#173#1#6'Height'#2#26#3'Top'#3#214#0#5'Width'#2'K'#7'Anc'
       +'hors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6
       +#7'Caption'#6#5'&Help'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidt'
       +'h'#2'K'#4'Kind'#7#6'bkHelp'#9'NumGlyphs'#2#0#8'TabOrder'#2#3#0#0#9'TGroupBo'
       +'x'#9'GroupBox1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont'
       +'rol'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'BtnOK'#4'Left'#2#6#6'Heigh'
    -  +'t'#3#192#0#3'Top'#2#6#5'Width'#3''''#1#7'Anchors'#11#5'akTop'#6'akLeft'#8'a'
    +  +'t'#3#202#0#3'Top'#2#6#5'Width'#3''''#1#7'Anchors'#11#5'akTop'#6'akLeft'#8'a'
       +'kBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#5'Items'#12'ClientHeig'
    -  +'ht'#3#173#0#11'ClientWidth'#3'#'#1#8'TabOrder'#2#4#0#9'TTreeView'#9'TreeVie'
    +  +'ht'#3#184#0#11'ClientWidth'#3'#'#1#8'TabOrder'#2#4#0#9'TTreeView'#9'TreeVie'
       +'w1'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9
       +'GroupBox1'#24'AnchorSideBottom.Control'#7#9'GroupBox1'#21'AnchorSideBottom.'
    -  +'Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#3#163#0#3'Top'#2#5#5'Width'#3#160
    +  +'Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#3#174#0#3'Top'#2#5#5'Width'#3#160
       +#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#18'BorderSpacin'
       +'g.Left'#2#5#17'BorderSpacing.Top'#2#5#20'BorderSpacing.Bottom'#2#5#17'Defau'
    -  +'ltItemHeight'#2#19#13'HideSelection'#8#8'ReadOnly'#9#8'TabOrder'#2#0#18'OnS'
    +  +'ltItemHeight'#2#17#13'HideSelection'#8#8'ReadOnly'#9#8'TabOrder'#2#0#18'OnS'
       +'electionChanged'#7#25'TreeView1SelectionChanged'#7'Options'#11#17'tvoAutoIt'
       +'emHeight'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'#12't'
       +'voShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#7'TButton'#10'BtnNewItem'
    @@ -67,35 +67,34 @@
       +'ox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSideLeft.Side'#7#9
       ,'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'
       +#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Cont'
    -  +'rol'#7#5'BtnOK'#4'Left'#3'3'#1#6'Height'#3#192#0#3'Top'#2#6#5'Width'#3#197#0
    +  +'rol'#7#5'BtnOK'#4'Left'#3'3'#1#6'Height'#3#202#0#3'Top'#2#6#5'Width'#3#197#0
       +#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.'
    -  +'Around'#2#6#7'Caption'#6#15'Item Properties'#12'ClientHeight'#3#173#0#11'Cl'
    +  +'Around'#2#6#7'Caption'#6#15'Item Properties'#12'ClientHeight'#3#184#0#11'Cl'
       +'ientWidth'#3#193#0#8'TabOrder'#2#5#0#6'TLabel'#12'LabelCaption'#22'AnchorSi'
       +'deLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.Control'#7#9'GroupBox2'#4'L'
    -  +'eft'#2#6#6'Height'#2#18#3'Top'#2#6#5'Width'#2'6'#18'BorderSpacing.Left'#2#6
    +  +'eft'#2#6#6'Height'#2#16#3'Top'#2#6#5'Width'#2'.'#18'BorderSpacing.Left'#2#6
       +#17'BorderSpacing.Top'#2#6#7'Caption'#6#8'Caption:'#12'FocusControl'#7#7'edt'
       +'Text'#11'ParentColor'#8#0#0#6'TLabel'#15'LabelImageIndex'#22'AnchorSideLeft'
       +'.Control'#7#12'LabelCaption'#21'AnchorSideTop.Control'#7#7'edtText'#18'Anch'
    -  +'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#18#3'Top'#2'7'#5'Wid'
    -  +'th'#2'S'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'Image Index:'#12'FocusCo'
    +  +'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#16#3'Top'#2'5'#5'Wid'
    +  +'th'#2'D'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'Image Index:'#12'FocusCo'
       +'ntrol'#7#11'edtIndexImg'#11'ParentColor'#8#0#0#6'TLabel'#15'LabelStateIndex'
       +#22'AnchorSideLeft.Control'#7#15'LabelImageIndex'#21'AnchorSideTop.Control'#7
       +#11'edtIndexImg'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'
    -  +#2#18#3'Top'#2'h'#5'Width'#2'N'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'St'
    -  +'ate Index:'#12'FocusControl'#7#13'edtIndexState'#11'ParentColor'#8#7'Visibl'
    -  +'e'#8#0#0#5'TEdit'#7'edtText'#22'AnchorSideLeft.Control'#7#12'LabelCaption'
    -  +#21'AnchorSideTop.Control'#7#12'LabelCaption'#18'AnchorSideTop.Side'#7#9'asr'
    -  +'Bottom'#23'AnchorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'
    -  +#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#23#3'Top'#2#26#5'Width'#3#182#0#7'An'
    -  +'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#2#19'Bord'
    -  +'erSpacing.Right'#2#5#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2#0#0#0#5'TE'
    -  +'dit'#11'edtIndexImg'#22'AnchorSideLeft.Control'#7#7'edtText'#21'AnchorSideT'
    -  +'op.Control'#7#15'LabelImageIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L'
    -  +'eft'#2#6#6'Height'#2#23#3'Top'#2'K'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2
    -  +#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#1#0#0#5'TEdi'
    -  +'t'#13'edtIndexState'#22'AnchorSideLeft.Control'#7#11'edtIndexImg'#21'Anchor'
    -  +'SideTop.Control'#7#15'LabelStateIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'
    -  +#4'Left'#2#6#6'Height'#2#23#3'Top'#2'|'#5'Width'#2'0'#17'BorderSpacing.Top'#2
    -  +#2#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#2#7'Visibl'
    -  +'e'#8#0#0#0#0
    +  +#2#16#3'Top'#2'd'#5'Width'#2'='#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'St'
    +  +'ate Index:'#12'FocusControl'#7#13'edtIndexState'#11'ParentColor'#8#0#0#5'TE'
    +  +'dit'#7'edtText'#22'AnchorSideLeft.Control'#7#12'LabelCaption'#21'AnchorSide'
    +  +'Top.Control'#7#12'LabelCaption'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'An'
    +  +'chorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBotto'
    +  +'m'#4'Left'#2#6#6'Height'#2#23#3'Top'#2#24#5'Width'#3#182#0#7'Anchors'#11#5
    +  +'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#2#19'BorderSpacing.Ri'
    +  +'ght'#2#5#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2#0#0#0#5'TEdit'#11'edtI'
    +  +'ndexImg'#22'AnchorSideLeft.Control'#7#7'edtText'#21'AnchorSideTop.Control'#7
    +  +#15'LabelImageIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Hei'
    +  +'ght'#2#23#3'Top'#2'G'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2#13'OnEditingD'
    +  +'one'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#1#0#0#5'TEdit'#13'edtInde'
    +  +'xState'#22'AnchorSideLeft.Control'#7#11'edtIndexImg'#21'AnchorSideTop.Contr'
    +  +'ol'#7#15'LabelStateIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6
    +  +#6'Height'#2#23#3'Top'#2'v'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2#13'OnEdi'
    +  +'tingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#2#0#0#0#0
     ]);
    Index: components/codetools/identcompletiontool.pas
    ===================================================================
    --- components/codetools/identcompletiontool.pas	(revision 22267)
    +++ components/codetools/identcompletiontool.pas	(working copy)
    @@ -1979,7 +1979,7 @@
           Item.ResultType:=ResultType;
           Item.Params:=TStringList.Create;
           Item.Params.Delimiter:=';';
    -      Item.Params.StrictDelimiter:=true;
    +//      Item.Params.StrictDelimiter:=true;
           Item.Params.DelimitedText:=Params;
         end;
     
    Index: lcl/interfaces/win32/win32wscustomlistview.inc
    ===================================================================
    --- lcl/interfaces/win32/win32wscustomlistview.inc	(revision 22267)
    +++ lcl/interfaces/win32/win32wscustomlistview.inc	(working copy)
    @@ -421,6 +421,14 @@
           AIndex, MAKELPARAM(ANewPosition.X, ANewPosition.Y)) <> 0;
     end;
     
    +class procedure TWin32WSCustomListView.ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer);
    +begin
    +  if not WSCheckHandleAllocated(ALV, 'ItemSetStateImage')
    +  then Exit;
    +
    +  ListView_SetItemState(ALV.Handle, AIndex, IndexToStateImageMask(AStateImageIndex + 1), LVIS_STATEIMAGEMASK);
    +end;
    +
     class procedure TWin32WSCustomListView.ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean);
     const
       // lisCut, lisDropTarget, lisFocused, lisSelected
    @@ -554,6 +562,55 @@
       Result := SendMessage(ALV.Handle, LVM_GETHOVERTIME, 0, 0);
     end;
     
    +class function TWin32WSCustomListView.GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests;
    +var
    +  HitInfo: LV_HITTESTINFO;
    +
    +begin
    +  Result := [];
    +  if not WSCheckHandleAllocated(ALV, 'GetHitTestInfoAt')
    +  then Exit;
    +
    +  with HitInfo do
    +  begin
    +    pt.X := X;
    +    pt.Y := Y;
    +    ListView_HitTest( ALV.Handle, HitInfo );
    +
    +    if ((flags and LVHT_ABOVE) <> 0) and (Y < 0) then
    +      Include(Result, htAbove);
    +
    +    if (flags and LVHT_BELOW) <> 0 then
    +      Include(Result, htBelow);
    +
    +    if (flags and LVHT_NOWHERE) <> 0 then
    +      Include(Result, ComCtrls.htNowhere);
    +
    +    if (flags and LVHT_ONITEM) = LVHT_ONITEM then
    +      Include(Result, htOnItem)
    +
    +    else
    +      begin
    +      if (flags and LVHT_ONITEMICON) <> 0 then
    +        Include(Result, htOnIcon);
    +
    +      if (flags and LVHT_ONITEMLABEL) <> 0 then
    +        Include(Result, htOnLabel);
    +
    +      if (flags and LVHT_ONITEMSTATEICON) <> 0 then
    +        Include(Result, htOnStateIcon);
    +
    +      end;
    +
    +    if (flags and LVHT_TOLEFT) <> 0 then
    +      Include(Result, htToLeft);
    +
    +    if (flags and LVHT_TORIGHT) <> 0 then
    +      Include(Result, htToRight);
    +
    +  end;
    +end;
    +
     class function TWin32WSCustomListView.GetItemAt(const ALV: TCustomListView; x,y: integer): Integer;
     var 
       HitInfo: LV_HITTESTINFO;
    Index: lcl/interfaces/win32/win32wscomctrls.pp
    ===================================================================
    --- lcl/interfaces/win32/win32wscomctrls.pp	(revision 22267)
    +++ lcl/interfaces/win32/win32wscomctrls.pp	(working copy)
    @@ -108,6 +108,7 @@
         class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); override;
         class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
         class function  ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; override;
    +    class procedure ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer); override;
         class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
         class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
         class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
    @@ -121,6 +122,7 @@
         class function GetBoundingRect(const ALV: TCustomListView): TRect; override;
         class function GetDropTarget(const ALV: TCustomListView): Integer; override;
         class function GetFocused(const ALV: TCustomListView): Integer; override;
    +    class function GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests; override;
         class function GetHoverTime(const ALV: TCustomListView): Integer; override;
         class function GetItemAt(const ALV: TCustomListView; x,y: Integer): Integer; override;
         class function GetSelCount(const ALV: TCustomListView): Integer; override;
    Index: lcl/comctrls.pp
    ===================================================================
    --- lcl/comctrls.pp	(revision 22267)
    +++ lcl/comctrls.pp	(working copy)
    @@ -699,6 +699,7 @@
         FCaption: String;
         FData: Pointer;
         FImageIndex: TImageIndex;
    +    FStateIndex: TImageIndex;
         FStates: TListItemStates;
         FChecked: Boolean;
         function GetCaption: String; virtual;
    @@ -709,6 +710,7 @@
         function GetState(const ALisOrd: Integer): Boolean;
         function GetImageIndex: TImageIndex; virtual;
         function GetIndex: Integer; virtual;
    +    function GetStateIndex: TImageIndex; virtual;
         function GetSubItemImages(const AIndex: Integer): Integer;
         function GetSubItems: TStrings; virtual;
         function GetTop: Integer;
    @@ -725,6 +727,7 @@
         procedure SetLeft(Value: Integer);
         procedure SetCaption(const AValue : String); virtual;
         procedure SetPosition(const AValue: TPoint);
    +    procedure SetStateIndex(const AValue: TImageIndex); virtual;
         procedure SetSubItemImages(const AIndex, AValue: Integer);
         procedure SetSubItems(const AValue: TStrings);
         procedure SetTop(Value: Integer);
    @@ -754,6 +757,7 @@
         property Owner: TListItems read FOwner;
         property Position: TPoint read GetPosition write SetPosition;
         property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
    +    property StateIndex: TImageIndex read GetStateIndex write SetStateIndex;
         property SubItems: TStrings read GetSubItems write SetSubItems;
         property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
         property Top: Integer read GetTop write SetTop;
    @@ -1109,6 +1113,7 @@
         procedure Clear;
         procedure EndUpdate;
         function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem;
    +    function GetHitTestInfoAt(X, Y: Integer): THitTests;
         function GetItemAt(x,y: integer): TListItem;
         property BoundingRect: TRect read GetBoundingRect;
         property BorderStyle default bsSingle;
    Index: lcl/include/customlistview.inc
    ===================================================================
    --- lcl/include/customlistview.inc	(revision 22267)
    +++ lcl/include/customlistview.inc	(working copy)
    @@ -733,6 +733,13 @@
       else Result := FHoverTime;
     end;
     
    +function TCustomListView.GetHitTestInfoAt(X, Y: Integer): THitTests;
    +begin
    +  Result := [];
    +  if HandleAllocated then
    +    Result := TWSCustomListViewClass(WidgetSetClass).GetHitTestInfoAt( Self, X, Y );
    +end;
    +
     function TCustomListView.GetItemAt(x,y: Integer): TListItem;
     var 
       Item: Integer;
    Index: lcl/include/listitem.inc
    ===================================================================
    --- lcl/include/listitem.inc	(revision 22267)
    +++ lcl/include/listitem.inc	(working copy)
    @@ -659,6 +659,28 @@
     end;
     
     {------------------------------------------------------------------------------}
    +{   TListItem SetStateIndex                                                    }
    +{------------------------------------------------------------------------------}
    +procedure TListItem.SetStateIndex(const AValue: TImageIndex);
    +begin
    +  if AValue = FImageIndex then Exit;
    +
    +  FStateIndex := AValue;
    +
    +  if WSUpdateAllowed then
    +    TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemSetStateImage(FOwner.FOwner, GetIndex, Self, 0, FStateIndex);
    +
    +end;
    +
    +{------------------------------------------------------------------------------}
    +{   TListItem GetStateIndex                                                    }
    +{------------------------------------------------------------------------------}
    +function TListItem.GetStateIndex: TImageIndex;
    +begin
    +  Result := FStateIndex;
    +end;
    +
    +{------------------------------------------------------------------------------}
     {   TListItem SetState                                                         }
     {------------------------------------------------------------------------------}
     procedure TListItem.SetState(const ALisOrd: Integer; const AIsSet: Boolean);
    Index: lcl/widgetset/wscomctrls.pp
    ===================================================================
    --- lcl/widgetset/wscomctrls.pp	(revision 22267)
    +++ lcl/widgetset/wscomctrls.pp	(working copy)
    @@ -104,6 +104,7 @@
         class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); virtual;
         class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); virtual;
         class function ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; virtual;
    +    class procedure ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer); virtual;
         class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); virtual;
         class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); virtual;
         class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
    @@ -116,6 +117,7 @@
         class function GetBoundingRect(const ALV: TCustomListView): TRect; virtual;
         class function GetDropTarget(const ALV: TCustomListView): Integer; virtual;
         class function GetFocused(const ALV: TCustomListView): Integer; virtual;
    +    class function GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests; virtual;
         class function GetHoverTime(const ALV: TCustomListView): Integer; virtual;
         class function GetItemAt(const ALV: TCustomListView; x,y: integer): Integer; virtual;
         class function GetSelCount(const ALV: TCustomListView): Integer; virtual;
    @@ -358,6 +360,12 @@
       Result := False;
     end;
     
    +class procedure TWSCustomListView.ItemSetStateImage(const ALV: TCustomListView;
    +  const AIndex: Integer; const AItem: TListItem;
    +  const ASubIndex, AStateImageIndex: Integer);
    +begin
    +end;
    +
     class procedure TWSCustomListView.ItemSetState(const ALV: TCustomListView;
       const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
       const AIsSet: Boolean);
    @@ -403,6 +411,11 @@
       Result := -1;
     end;
     
    +class function TWSCustomListView.GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests;
    +begin
    +  Result := [];
    +end;
    +
     class function TWSCustomListView.GetHoverTime(const ALV: TCustomListView): Integer;
     begin
       Result := -1;
    
    listviewpath.patch (26,315 bytes)

Activities

2009-10-23 08:05

 

listviewpath.patch (26,315 bytes)
Index: ideintf/listviewpropedit.pp
===================================================================
--- ideintf/listviewpropedit.pp	(revision 22267)
+++ ideintf/listviewpropedit.pp	(working copy)
@@ -201,6 +201,7 @@
   begin
     TreeView1.Selected.ImageIndex := StrToIntDef(edtIndexImg.Text, -1);
     TreeView1.Selected.StateIndex := StrToIntDef(edtIndexState.Text, -1);
+    TreeView1.Selected.SelectedIndex := TreeView1.Selected.ImageIndex;
 
     edtIndexImg.Text := IntToStr(TreeView1.Selected.ImageIndex);
     edtIndexState.Text := IntToStr(TreeView1.Selected.StateIndex);
@@ -228,7 +229,8 @@
         with Node do
         begin
           ImageIndex := AListView.Items[I].ImageIndex;
-          //StateIndex := AListView.Items[I].StateIndex;
+          StateIndex := AListView.Items[I].StateIndex;
+          SelectedIndex := ImageIndex;
         end;
 
         //SubItems
@@ -269,7 +271,7 @@
           Item := FListView.Items.Add;
           Item.Caption := Node.Text;
           Item.ImageIndex := Node.ImageIndex;
-          //Item.StateIndex := Node.StateIndex;
+          Item.StateIndex := Node.StateIndex;
 
           //SubItems
           for J := 0 to Node.Count - 1 do
Index: ideintf/listviewpropedit.lfm
===================================================================
--- ideintf/listviewpropedit.lfm	(revision 22267)
+++ ideintf/listviewpropedit.lfm	(working copy)
@@ -12,14 +12,14 @@
   Constraints.MinWidth = 400
   OnCreate = FormCreate
   Position = poScreenCenter
-  LCLVersion = '0.9.27'
+  LCLVersion = '0.9.29'
   object BtnOK: TBitBtn
     AnchorSideRight.Control = BtnCancel
     AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
-    Left = 183
-    Height = 36
-    Top = 204
+    Left = 180
+    Height = 26
+    Top = 214
     Width = 75
     Anchors = [akRight, akBottom]
     AutoSize = True
@@ -36,10 +36,10 @@
     AnchorSideRight.Control = BtnApply
     AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
-    Left = 264
-    Height = 32
-    Top = 208
-    Width = 78
+    Left = 261
+    Height = 26
+    Top = 214
+    Width = 81
     Anchors = [akRight, akBottom]
     AutoSize = True
     BorderSpacing.Around = 6
@@ -57,8 +57,8 @@
     AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
     Left = 348
-    Height = 29
-    Top = 211
+    Height = 25
+    Top = 215
     Width = 75
     Anchors = [akRight, akBottom]
     AutoSize = True
@@ -76,8 +76,8 @@
     AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
     Left = 429
-    Height = 36
-    Top = 204
+    Height = 26
+    Top = 214
     Width = 75
     Anchors = [akRight, akBottom]
     AutoSize = True
@@ -94,13 +94,13 @@
     AnchorSideTop.Control = Owner
     AnchorSideBottom.Control = BtnOK
     Left = 6
-    Height = 192
+    Height = 202
     Top = 6
     Width = 295
     Anchors = [akTop, akLeft, akBottom]
     BorderSpacing.Around = 6
     Caption = 'Items'
-    ClientHeight = 173
+    ClientHeight = 184
     ClientWidth = 291
     TabOrder = 4
     object TreeView1: TTreeView
@@ -109,14 +109,14 @@
       AnchorSideBottom.Control = GroupBox1
       AnchorSideBottom.Side = asrBottom
       Left = 5
-      Height = 163
+      Height = 174
       Top = 5
       Width = 160
       Anchors = [akTop, akLeft, akRight, akBottom]
       BorderSpacing.Left = 5
       BorderSpacing.Top = 5
       BorderSpacing.Bottom = 5
-      DefaultItemHeight = 19
+      DefaultItemHeight = 17
       HideSelection = False
       ReadOnly = True
       TabOrder = 0
@@ -184,22 +184,22 @@
     AnchorSideRight.Side = asrBottom
     AnchorSideBottom.Control = BtnOK
     Left = 307
-    Height = 192
+    Height = 202
     Top = 6
     Width = 197
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Around = 6
     Caption = 'Item Properties'
-    ClientHeight = 173
+    ClientHeight = 184
     ClientWidth = 193
     TabOrder = 5
     object LabelCaption: TLabel
       AnchorSideLeft.Control = GroupBox2
       AnchorSideTop.Control = GroupBox2
       Left = 6
-      Height = 18
+      Height = 16
       Top = 6
-      Width = 54
+      Width = 46
       BorderSpacing.Left = 6
       BorderSpacing.Top = 6
       Caption = 'Caption:'
@@ -211,9 +211,9 @@
       AnchorSideTop.Control = edtText
       AnchorSideTop.Side = asrBottom
       Left = 6
-      Height = 18
-      Top = 55
-      Width = 83
+      Height = 16
+      Top = 53
+      Width = 68
       BorderSpacing.Top = 6
       Caption = 'Image Index:'
       FocusControl = edtIndexImg
@@ -224,14 +224,13 @@
       AnchorSideTop.Control = edtIndexImg
       AnchorSideTop.Side = asrBottom
       Left = 6
-      Height = 18
-      Top = 104
-      Width = 78
+      Height = 16
+      Top = 100
+      Width = 61
       BorderSpacing.Top = 6
       Caption = 'State Index:'
       FocusControl = edtIndexState
       ParentColor = False
-      Visible = False
     end
     object edtText: TEdit
       AnchorSideLeft.Control = LabelCaption
@@ -241,7 +240,7 @@
       AnchorSideRight.Side = asrBottom
       Left = 6
       Height = 23
-      Top = 26
+      Top = 24
       Width = 182
       Anchors = [akTop, akLeft, akRight]
       BorderSpacing.Top = 2
@@ -255,7 +254,7 @@
       AnchorSideTop.Side = asrBottom
       Left = 6
       Height = 23
-      Top = 75
+      Top = 71
       Width = 48
       BorderSpacing.Top = 2
       OnEditingDone = edtIndexStateEditingDone
@@ -267,12 +266,11 @@
       AnchorSideTop.Side = asrBottom
       Left = 6
       Height = 23
-      Top = 124
+      Top = 118
       Width = 48
       BorderSpacing.Top = 2
       OnEditingDone = edtIndexStateEditingDone
       TabOrder = 2
-      Visible = False
     end
   end
 end
Index: ideintf/listviewpropedit.lrs
===================================================================
--- ideintf/listviewpropedit.lrs	(revision 22267)
+++ ideintf/listviewpropedit.lrs	(working copy)
@@ -6,42 +6,42 @@
   +'OK'#11'BorderIcons'#11#12'biSystemMenu'#6'biHelp'#0#7'Caption'#6#21'ListVie'
   +'w Items Editor'#12'ClientHeight'#3#246#0#11'ClientWidth'#3#254#1#21'Constra'
   +'ints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3#144#1#8'OnCreate'#7#10'F'
-  +'ormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.27'#0#7
+  +'ormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#7
   +'TBitBtn'#5'BtnOK'#23'AnchorSideRight.Control'#7#9'BtnCancel'#24'AnchorSideB'
   +'ottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
-  +#183#0#6'Height'#2'$'#3'Top'#3#204#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
+  +#180#0#6'Height'#2#26#3'Top'#3#214#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
   +'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#3'&OK'
   +#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#4'Kind'#7#4'bk'
   +'OK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#9'B'
   +'tnCancel'#23'AnchorSideRight.Control'#7#8'BtnApply'#24'AnchorSideBottom.Con'
-  +'trol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#8#1#6'H'
-  +'eight'#2' '#3'Top'#3#208#0#5'Width'#2'N'#7'Anchors'#11#7'akRight'#8'akBotto'
+  +'trol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#5#1#6'H'
+  +'eight'#2#26#3'Top'#3#214#0#5'Width'#2'Q'#7'Anchors'#11#7'akRight'#8'akBotto'
   +'m'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#6'Cancel'#9#7'Caption'#6#6
   +'Cancel'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#4'Kind'
   +#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#7'TB'
   +'itBtn'#8'BtnApply'#23'AnchorSideRight.Control'#7#7'BtnHelp'#24'AnchorSideBo'
   +'ttom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
-  +'\'#1#6'Height'#2#29#3'Top'#3#211#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
+  +'\'#1#6'Height'#2#25#3'Top'#3#215#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
   +'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#6'&Appl'
   +'y'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidth'#2'K'#9'NumGlyphs'
   +#2#0#7'OnClick'#7#13'btnApplyClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#7'BtnHelp'
   +#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBott'
   +'om'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'a'
-  +'srBottom'#4'Left'#3#173#1#6'Height'#2'$'#3'Top'#3#204#0#5'Width'#2'K'#7'Anc'
+  +'srBottom'#4'Left'#3#173#1#6'Height'#2#26#3'Top'#3#214#0#5'Width'#2'K'#7'Anc'
   +'hors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6
   +#7'Caption'#6#5'&Help'#21'Constraints.MinHeight'#2#25#20'Constraints.MinWidt'
   +'h'#2'K'#4'Kind'#7#6'bkHelp'#9'NumGlyphs'#2#0#8'TabOrder'#2#3#0#0#9'TGroupBo'
   +'x'#9'GroupBox1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont'
   +'rol'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'BtnOK'#4'Left'#2#6#6'Heigh'
-  +'t'#3#192#0#3'Top'#2#6#5'Width'#3''''#1#7'Anchors'#11#5'akTop'#6'akLeft'#8'a'
+  +'t'#3#202#0#3'Top'#2#6#5'Width'#3''''#1#7'Anchors'#11#5'akTop'#6'akLeft'#8'a'
   +'kBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#5'Items'#12'ClientHeig'
-  +'ht'#3#173#0#11'ClientWidth'#3'#'#1#8'TabOrder'#2#4#0#9'TTreeView'#9'TreeVie'
+  +'ht'#3#184#0#11'ClientWidth'#3'#'#1#8'TabOrder'#2#4#0#9'TTreeView'#9'TreeVie'
   +'w1'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9
   +'GroupBox1'#24'AnchorSideBottom.Control'#7#9'GroupBox1'#21'AnchorSideBottom.'
-  +'Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#3#163#0#3'Top'#2#5#5'Width'#3#160
+  +'Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#3#174#0#3'Top'#2#5#5'Width'#3#160
   +#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#18'BorderSpacin'
   +'g.Left'#2#5#17'BorderSpacing.Top'#2#5#20'BorderSpacing.Bottom'#2#5#17'Defau'
-  +'ltItemHeight'#2#19#13'HideSelection'#8#8'ReadOnly'#9#8'TabOrder'#2#0#18'OnS'
+  +'ltItemHeight'#2#17#13'HideSelection'#8#8'ReadOnly'#9#8'TabOrder'#2#0#18'OnS'
   +'electionChanged'#7#25'TreeView1SelectionChanged'#7'Options'#11#17'tvoAutoIt'
   +'emHeight'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'#12't'
   +'voShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#7'TButton'#10'BtnNewItem'
@@ -67,35 +67,34 @@
   +'ox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSideLeft.Side'#7#9
   ,'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'
   +#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Cont'
-  +'rol'#7#5'BtnOK'#4'Left'#3'3'#1#6'Height'#3#192#0#3'Top'#2#6#5'Width'#3#197#0
+  +'rol'#7#5'BtnOK'#4'Left'#3'3'#1#6'Height'#3#202#0#3'Top'#2#6#5'Width'#3#197#0
   +#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.'
-  +'Around'#2#6#7'Caption'#6#15'Item Properties'#12'ClientHeight'#3#173#0#11'Cl'
+  +'Around'#2#6#7'Caption'#6#15'Item Properties'#12'ClientHeight'#3#184#0#11'Cl'
   +'ientWidth'#3#193#0#8'TabOrder'#2#5#0#6'TLabel'#12'LabelCaption'#22'AnchorSi'
   +'deLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.Control'#7#9'GroupBox2'#4'L'
-  +'eft'#2#6#6'Height'#2#18#3'Top'#2#6#5'Width'#2'6'#18'BorderSpacing.Left'#2#6
+  +'eft'#2#6#6'Height'#2#16#3'Top'#2#6#5'Width'#2'.'#18'BorderSpacing.Left'#2#6
   +#17'BorderSpacing.Top'#2#6#7'Caption'#6#8'Caption:'#12'FocusControl'#7#7'edt'
   +'Text'#11'ParentColor'#8#0#0#6'TLabel'#15'LabelImageIndex'#22'AnchorSideLeft'
   +'.Control'#7#12'LabelCaption'#21'AnchorSideTop.Control'#7#7'edtText'#18'Anch'
-  +'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#18#3'Top'#2'7'#5'Wid'
-  +'th'#2'S'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'Image Index:'#12'FocusCo'
+  +'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#16#3'Top'#2'5'#5'Wid'
+  +'th'#2'D'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'Image Index:'#12'FocusCo'
   +'ntrol'#7#11'edtIndexImg'#11'ParentColor'#8#0#0#6'TLabel'#15'LabelStateIndex'
   +#22'AnchorSideLeft.Control'#7#15'LabelImageIndex'#21'AnchorSideTop.Control'#7
   +#11'edtIndexImg'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'
-  +#2#18#3'Top'#2'h'#5'Width'#2'N'#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'St'
-  +'ate Index:'#12'FocusControl'#7#13'edtIndexState'#11'ParentColor'#8#7'Visibl'
-  +'e'#8#0#0#5'TEdit'#7'edtText'#22'AnchorSideLeft.Control'#7#12'LabelCaption'
-  +#21'AnchorSideTop.Control'#7#12'LabelCaption'#18'AnchorSideTop.Side'#7#9'asr'
-  +'Bottom'#23'AnchorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'
-  +#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#23#3'Top'#2#26#5'Width'#3#182#0#7'An'
-  +'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#2#19'Bord'
-  +'erSpacing.Right'#2#5#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2#0#0#0#5'TE'
-  +'dit'#11'edtIndexImg'#22'AnchorSideLeft.Control'#7#7'edtText'#21'AnchorSideT'
-  +'op.Control'#7#15'LabelImageIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L'
-  +'eft'#2#6#6'Height'#2#23#3'Top'#2'K'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2
-  +#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#1#0#0#5'TEdi'
-  +'t'#13'edtIndexState'#22'AnchorSideLeft.Control'#7#11'edtIndexImg'#21'Anchor'
-  +'SideTop.Control'#7#15'LabelStateIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'
-  +#4'Left'#2#6#6'Height'#2#23#3'Top'#2'|'#5'Width'#2'0'#17'BorderSpacing.Top'#2
-  +#2#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#2#7'Visibl'
-  +'e'#8#0#0#0#0
+  +#2#16#3'Top'#2'd'#5'Width'#2'='#17'BorderSpacing.Top'#2#6#7'Caption'#6#12'St'
+  +'ate Index:'#12'FocusControl'#7#13'edtIndexState'#11'ParentColor'#8#0#0#5'TE'
+  +'dit'#7'edtText'#22'AnchorSideLeft.Control'#7#12'LabelCaption'#21'AnchorSide'
+  +'Top.Control'#7#12'LabelCaption'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'An'
+  +'chorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBotto'
+  +'m'#4'Left'#2#6#6'Height'#2#23#3'Top'#2#24#5'Width'#3#182#0#7'Anchors'#11#5
+  +'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#2#19'BorderSpacing.Ri'
+  +'ght'#2#5#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2#0#0#0#5'TEdit'#11'edtI'
+  +'ndexImg'#22'AnchorSideLeft.Control'#7#7'edtText'#21'AnchorSideTop.Control'#7
+  +#15'LabelImageIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Hei'
+  +'ght'#2#23#3'Top'#2'G'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2#13'OnEditingD'
+  +'one'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#1#0#0#5'TEdit'#13'edtInde'
+  +'xState'#22'AnchorSideLeft.Control'#7#11'edtIndexImg'#21'AnchorSideTop.Contr'
+  +'ol'#7#15'LabelStateIndex'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6
+  +#6'Height'#2#23#3'Top'#2'v'#5'Width'#2'0'#17'BorderSpacing.Top'#2#2#13'OnEdi'
+  +'tingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#2#0#0#0#0
 ]);
Index: components/codetools/identcompletiontool.pas
===================================================================
--- components/codetools/identcompletiontool.pas	(revision 22267)
+++ components/codetools/identcompletiontool.pas	(working copy)
@@ -1979,7 +1979,7 @@
       Item.ResultType:=ResultType;
       Item.Params:=TStringList.Create;
       Item.Params.Delimiter:=';';
-      Item.Params.StrictDelimiter:=true;
+//      Item.Params.StrictDelimiter:=true;
       Item.Params.DelimitedText:=Params;
     end;
 
Index: lcl/interfaces/win32/win32wscustomlistview.inc
===================================================================
--- lcl/interfaces/win32/win32wscustomlistview.inc	(revision 22267)
+++ lcl/interfaces/win32/win32wscustomlistview.inc	(working copy)
@@ -421,6 +421,14 @@
       AIndex, MAKELPARAM(ANewPosition.X, ANewPosition.Y)) <> 0;
 end;
 
+class procedure TWin32WSCustomListView.ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer);
+begin
+  if not WSCheckHandleAllocated(ALV, 'ItemSetStateImage')
+  then Exit;
+
+  ListView_SetItemState(ALV.Handle, AIndex, IndexToStateImageMask(AStateImageIndex + 1), LVIS_STATEIMAGEMASK);
+end;
+
 class procedure TWin32WSCustomListView.ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean);
 const
   // lisCut, lisDropTarget, lisFocused, lisSelected
@@ -554,6 +562,55 @@
   Result := SendMessage(ALV.Handle, LVM_GETHOVERTIME, 0, 0);
 end;
 
+class function TWin32WSCustomListView.GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests;
+var
+  HitInfo: LV_HITTESTINFO;
+
+begin
+  Result := [];
+  if not WSCheckHandleAllocated(ALV, 'GetHitTestInfoAt')
+  then Exit;
+
+  with HitInfo do
+  begin
+    pt.X := X;
+    pt.Y := Y;
+    ListView_HitTest( ALV.Handle, HitInfo );
+
+    if ((flags and LVHT_ABOVE) <> 0) and (Y < 0) then
+      Include(Result, htAbove);
+
+    if (flags and LVHT_BELOW) <> 0 then
+      Include(Result, htBelow);
+
+    if (flags and LVHT_NOWHERE) <> 0 then
+      Include(Result, ComCtrls.htNowhere);
+
+    if (flags and LVHT_ONITEM) = LVHT_ONITEM then
+      Include(Result, htOnItem)
+
+    else
+      begin
+      if (flags and LVHT_ONITEMICON) <> 0 then
+        Include(Result, htOnIcon);
+
+      if (flags and LVHT_ONITEMLABEL) <> 0 then
+        Include(Result, htOnLabel);
+
+      if (flags and LVHT_ONITEMSTATEICON) <> 0 then
+        Include(Result, htOnStateIcon);
+
+      end;
+
+    if (flags and LVHT_TOLEFT) <> 0 then
+      Include(Result, htToLeft);
+
+    if (flags and LVHT_TORIGHT) <> 0 then
+      Include(Result, htToRight);
+
+  end;
+end;
+
 class function TWin32WSCustomListView.GetItemAt(const ALV: TCustomListView; x,y: integer): Integer;
 var 
   HitInfo: LV_HITTESTINFO;
Index: lcl/interfaces/win32/win32wscomctrls.pp
===================================================================
--- lcl/interfaces/win32/win32wscomctrls.pp	(revision 22267)
+++ lcl/interfaces/win32/win32wscomctrls.pp	(working copy)
@@ -108,6 +108,7 @@
     class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); override;
     class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
     class function  ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; override;
+    class procedure ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer); override;
     class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
     class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
     class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
@@ -121,6 +122,7 @@
     class function GetBoundingRect(const ALV: TCustomListView): TRect; override;
     class function GetDropTarget(const ALV: TCustomListView): Integer; override;
     class function GetFocused(const ALV: TCustomListView): Integer; override;
+    class function GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests; override;
     class function GetHoverTime(const ALV: TCustomListView): Integer; override;
     class function GetItemAt(const ALV: TCustomListView; x,y: Integer): Integer; override;
     class function GetSelCount(const ALV: TCustomListView): Integer; override;
Index: lcl/comctrls.pp
===================================================================
--- lcl/comctrls.pp	(revision 22267)
+++ lcl/comctrls.pp	(working copy)
@@ -699,6 +699,7 @@
     FCaption: String;
     FData: Pointer;
     FImageIndex: TImageIndex;
+    FStateIndex: TImageIndex;
     FStates: TListItemStates;
     FChecked: Boolean;
     function GetCaption: String; virtual;
@@ -709,6 +710,7 @@
     function GetState(const ALisOrd: Integer): Boolean;
     function GetImageIndex: TImageIndex; virtual;
     function GetIndex: Integer; virtual;
+    function GetStateIndex: TImageIndex; virtual;
     function GetSubItemImages(const AIndex: Integer): Integer;
     function GetSubItems: TStrings; virtual;
     function GetTop: Integer;
@@ -725,6 +727,7 @@
     procedure SetLeft(Value: Integer);
     procedure SetCaption(const AValue : String); virtual;
     procedure SetPosition(const AValue: TPoint);
+    procedure SetStateIndex(const AValue: TImageIndex); virtual;
     procedure SetSubItemImages(const AIndex, AValue: Integer);
     procedure SetSubItems(const AValue: TStrings);
     procedure SetTop(Value: Integer);
@@ -754,6 +757,7 @@
     property Owner: TListItems read FOwner;
     property Position: TPoint read GetPosition write SetPosition;
     property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
+    property StateIndex: TImageIndex read GetStateIndex write SetStateIndex;
     property SubItems: TStrings read GetSubItems write SetSubItems;
     property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
     property Top: Integer read GetTop write SetTop;
@@ -1109,6 +1113,7 @@
     procedure Clear;
     procedure EndUpdate;
     function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem;
+    function GetHitTestInfoAt(X, Y: Integer): THitTests;
     function GetItemAt(x,y: integer): TListItem;
     property BoundingRect: TRect read GetBoundingRect;
     property BorderStyle default bsSingle;
Index: lcl/include/customlistview.inc
===================================================================
--- lcl/include/customlistview.inc	(revision 22267)
+++ lcl/include/customlistview.inc	(working copy)
@@ -733,6 +733,13 @@
   else Result := FHoverTime;
 end;
 
+function TCustomListView.GetHitTestInfoAt(X, Y: Integer): THitTests;
+begin
+  Result := [];
+  if HandleAllocated then
+    Result := TWSCustomListViewClass(WidgetSetClass).GetHitTestInfoAt( Self, X, Y );
+end;
+
 function TCustomListView.GetItemAt(x,y: Integer): TListItem;
 var 
   Item: Integer;
Index: lcl/include/listitem.inc
===================================================================
--- lcl/include/listitem.inc	(revision 22267)
+++ lcl/include/listitem.inc	(working copy)
@@ -659,6 +659,28 @@
 end;
 
 {------------------------------------------------------------------------------}
+{   TListItem SetStateIndex                                                    }
+{------------------------------------------------------------------------------}
+procedure TListItem.SetStateIndex(const AValue: TImageIndex);
+begin
+  if AValue = FImageIndex then Exit;
+
+  FStateIndex := AValue;
+
+  if WSUpdateAllowed then
+    TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemSetStateImage(FOwner.FOwner, GetIndex, Self, 0, FStateIndex);
+
+end;
+
+{------------------------------------------------------------------------------}
+{   TListItem GetStateIndex                                                    }
+{------------------------------------------------------------------------------}
+function TListItem.GetStateIndex: TImageIndex;
+begin
+  Result := FStateIndex;
+end;
+
+{------------------------------------------------------------------------------}
 {   TListItem SetState                                                         }
 {------------------------------------------------------------------------------}
 procedure TListItem.SetState(const ALisOrd: Integer; const AIsSet: Boolean);
Index: lcl/widgetset/wscomctrls.pp
===================================================================
--- lcl/widgetset/wscomctrls.pp	(revision 22267)
+++ lcl/widgetset/wscomctrls.pp	(working copy)
@@ -104,6 +104,7 @@
     class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); virtual;
     class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); virtual;
     class function ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; virtual;
+    class procedure ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer); virtual;
     class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); virtual;
     class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); virtual;
     class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
@@ -116,6 +117,7 @@
     class function GetBoundingRect(const ALV: TCustomListView): TRect; virtual;
     class function GetDropTarget(const ALV: TCustomListView): Integer; virtual;
     class function GetFocused(const ALV: TCustomListView): Integer; virtual;
+    class function GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests; virtual;
     class function GetHoverTime(const ALV: TCustomListView): Integer; virtual;
     class function GetItemAt(const ALV: TCustomListView; x,y: integer): Integer; virtual;
     class function GetSelCount(const ALV: TCustomListView): Integer; virtual;
@@ -358,6 +360,12 @@
   Result := False;
 end;
 
+class procedure TWSCustomListView.ItemSetStateImage(const ALV: TCustomListView;
+  const AIndex: Integer; const AItem: TListItem;
+  const ASubIndex, AStateImageIndex: Integer);
+begin
+end;
+
 class procedure TWSCustomListView.ItemSetState(const ALV: TCustomListView;
   const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
   const AIsSet: Boolean);
@@ -403,6 +411,11 @@
   Result := -1;
 end;
 
+class function TWSCustomListView.GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests;
+begin
+  Result := [];
+end;
+
 class function TWSCustomListView.GetHoverTime(const ALV: TCustomListView): Integer;
 begin
   Result := -1;
listviewpath.patch (26,315 bytes)

Paul Ishenin

2009-10-28 10:44

manager   ~0031755

Thanks, applied but few moments:

1) you included codetools changes to the patch.
2) you made a small error in the TListItem.SetStateIndex

And the biggest problem is that this adds support only to win32. Please try to add at least gtk2 and qt patches.

Please close if ok.

Issue History

Date Modified Username Field Change
2009-10-23 08:05 Boian Mitov New Issue
2009-10-23 08:05 Boian Mitov File Added: listviewpath.patch
2009-10-23 08:05 Boian Mitov Widgetset => Win32/Win64
2009-10-23 12:47 Vincent Snijders LazTarget => 0.9.30
2009-10-23 12:47 Vincent Snijders Status new => acknowledged
2009-10-23 12:47 Vincent Snijders Target Version => 0.9.30
2009-10-27 01:45 Boian Mitov Tag Attached: TListView
2009-10-28 10:44 Paul Ishenin Fixed in Revision => 22310
2009-10-28 10:44 Paul Ishenin Status acknowledged => resolved
2009-10-28 10:44 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-10-28 10:44 Paul Ishenin Resolution open => fixed
2009-10-28 10:44 Paul Ishenin Assigned To => Paul Ishenin
2009-10-28 10:44 Paul Ishenin Note Added: 0031755
2011-12-01 11:22 Marc Weustink Status resolved => closed