View Issue Details

IDProjectCategoryView StatusLast Update
0031595LazarusWidgetsetpublic2017-04-26 09:04
ReporterBambang PranotoAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version12.04
Product Version1.6.4Product Build 
Target Version1.8Fixed in Version1.9 (SVN) 
Summary0031595: Strange behaviour on TListView onChange event
Descriptiona ListView with style vsIcon and LargeImages

Clicking on currently non selected item:

 * makes the clicked item selected
 * the previous selected item becomes non selected.

However, if on OnChange event of the ListView we just access the selected property of the Item parameter, the behaviour changes. Clicking a non selected items still retained the previous selected item.
Steps To ReproduceCompile and run the attachment:

We can see the weird behaviour if we tick the checkbox.
Additional InformationThe OnChange procedure:

procedure TForm1.ListView1Change(Sender: TObject; Item: TListItem;
  Change: TItemChange);
var
  s : String;
begin
  s := Item.Caption ;
  if Self.CheckBox1.Checked then begin
    if Item.Selected then begin
       s := s + ' - selected';
    end
    else begin
      s := s + ' - unselected';
    end;
  end;
  Self.Memo1.Lines.Add( s );
  Self.Memo1.SelStart:=Length( Self.Memo1.Text);
  Self.Memo1.SelLength:=0;
end;
TagsNo tags attached.
Fixed in Revision54694
LazTarget1.8
WidgetsetQT, QT5
Attached Files

Activities

Bambang Pranoto

2017-03-25 07:07

reporter  

tlistviewonchangeeventbug.zip (67,231 bytes)

Bambang Pranoto

2017-03-26 19:36

reporter   ~0099238

Problem only with WidgetSet Qt.
Gtk2 runs fine.

Juha Manninen

2017-03-29 21:40

developer   ~0099268

Added the widgetset.

Zeljan Rikalo

2017-04-23 12:36

developer   ~0099804

Please test and close if ok.
I've also fixed Qt5 which had similar bug. Both will be merged to 1.8 fixes.

Bambang Pranoto

2017-04-26 09:04

reporter   ~0099939

I downloaded qwidgets.pas from 54694 but it didn't compile with lazarus v1.6.4, so I looked and applied the diff manually. The bug is fixed.

Issue History

Date Modified Username Field Change
2017-03-25 07:07 Bambang Pranoto New Issue
2017-03-25 07:07 Bambang Pranoto File Added: tlistviewonchangeeventbug.zip
2017-03-26 19:36 Bambang Pranoto Note Added: 0099238
2017-03-29 21:40 Juha Manninen LazTarget => -
2017-03-29 21:40 Juha Manninen Widgetset => QT
2017-03-29 21:40 Juha Manninen Note Added: 0099268
2017-03-29 21:40 Juha Manninen Category LCL => Widgetset
2017-03-30 08:28 Zeljan Rikalo Assigned To => Zeljan Rikalo
2017-03-30 08:28 Zeljan Rikalo Status new => assigned
2017-04-23 12:36 Zeljan Rikalo Fixed in Revision => 54694
2017-04-23 12:36 Zeljan Rikalo LazTarget - => 1.8
2017-04-23 12:36 Zeljan Rikalo Widgetset QT => QT, QT5
2017-04-23 12:36 Zeljan Rikalo Note Added: 0099804
2017-04-23 12:36 Zeljan Rikalo Status assigned => resolved
2017-04-23 12:36 Zeljan Rikalo Fixed in Version => 1.9 (SVN)
2017-04-23 12:36 Zeljan Rikalo Resolution open => fixed
2017-04-23 12:36 Zeljan Rikalo Target Version => 1.8
2017-04-26 09:04 Bambang Pranoto Note Added: 0099939
2017-04-26 09:04 Bambang Pranoto Status resolved => closed