View Issue Details

IDProjectCategoryView StatusLast Update
0023014LazarusLCLpublic2012-09-29 14:08
ReporterJohn Kelly Assigned ToZeljan Rikalo  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.1 (SVN) 
Summary0023014: Calling listview.itemfocused.editcaption causes TApplication.HandleException Access violation
DescriptionWith one listview item selected -

Calling listview1.selected.editcaption works
Calling listview1.itemfocused.editcaption crashes

TApplication.HandleException Access violation
  Stack trace:
  $00000000006C1E60 line 380 of include/listitem.inc
  $00000000004DC907 line 65 of main.pas
  $00000000006858C1 line 2718 of include/control.inc
  $00000000006B480E line 56 of include/buttoncontrol.inc
  $00000000006B5111 line 175 of include/buttons.inc
  $00000000006B58BD line 355 of include/buttons.inc
  $00000000006B4731 line 26 of include/buttoncontrol.inc
  $00000000004ABBA9
  $000000000067546C line 5322 of include/wincontrol.inc
  $000000000075E6D5 line 117 of lclmessageglue.pas
  $000000000076D9FA line 2393 of gtk2wsstdctrls.pp
  $00007F6BC2651943
WARNING: TLCLComponent.Destroy with LCLRefCount>0. Hint: Maybe the component is processing an event?
Additional Information(Sorry for raising all the listview issues - I'm converting a Delphi project.)

Run the attached project, select an item and press one button at a time.

Left button calls listview.selected.editcaption

Right button calls listview.itemfocused.editcaption and crashes.

Running on Fedora 17, x86_64, KDE4. Latest SVN lazarus version.
TagsNo tags attached.
Fixed in Revision38895
LazTarget-
WidgetsetGTK 2
Attached Files

Activities

2012-09-28 18:39

 

listview.tgz (3,137 bytes)

Zeljan Rikalo

2012-09-29 08:19

developer   ~0062718

Please test and close if ok. Note that qt is fixed also in 38894 - both will be merged to fixes_1.0

John Kelly

2012-09-29 10:30

reporter   ~0062720

Last edited: 2012-09-29 10:32

Well it doesn't crash any more, but it isn't right. ItemFocused should be the last item to be selected. I.e. the one with the focus. This now just acts on the first selected item in the list in the same way as selected.

Don't want to sound ungrateful but ItemFocused should be a way of picking a specific item from a list of selected items. If it doesn't work on the item with focus then it isn't of use.

Demonstration -
Ctrl+click the first item
ctrl+click the third item
ctrl+click the second item
Now itemfocused SHOULD be the second item. However it edits the first.
Now move the selection up and down using arrow keys and the selection is confused. I.e. two selections move up and down.

John Kelly

2012-09-29 10:31

reporter   ~0062721

Not crashing any more but not itemfocused either,. See notes above.

John Kelly

2012-09-29 11:03

reporter   ~0062722

Another demonstration ..

Click the bottom item (item4)
Move the focus to another item using ctrl+up-arrow
(So we have the focus on an unselected item.)
Click the button and itemfocused.editcaption works on the selected item.

Zeljan Rikalo

2012-09-29 11:25

developer   ~0062726

This FocusedItem is maded by using TListView.Selected. I understand that you want it behave in different way but that's all I can do atm.

Zeljan Rikalo

2012-09-29 11:50

developer   ~0062727

I won't fix that scenario because it works same as in Delphi.As I already mentioned, in case of MultiSelect=True ItemFocused = Selected.Also tried to get it work like you want but it's not possible since gtk2 returns selected items list in listview order, not order of selection - so no way to fix it under gtk2.
Your primary issue (crash) is fixed so pls. close. If you want ItemFocused behaviour to be changed and you need it badly, find in lcl/include where Selected is setted up when MultiSelect := True and set FFocused to last selected item instead of first.

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ComCtrls_TCustomListView_ItemFocused.html

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ComCtrls_TCustomListView_Selected.html

John Kelly

2012-09-29 13:50

reporter   ~0062729

I have Delphi Personal 7 and in that the item with focus is edited regardless of selections.
I will attach a compiled example from delphi (runs in wine). Try both demonstrations from the notes above.

2012-09-29 13:51

 

listview.zip (246,186 bytes)

Zeljan Rikalo

2012-09-29 13:56

developer   ~0062730

As I said: crash is fixed , so pls close this issue. Open another one about focus problem. It's hard to track things when many issues are connected to one.

John Kelly

2012-09-29 14:08

reporter   ~0062731

Ok, understood. Thanks

Issue History

Date Modified Username Field Change
2012-09-28 18:39 John Kelly New Issue
2012-09-28 18:39 John Kelly File Added: listview.tgz
2012-09-28 18:39 John Kelly Widgetset => GTK 2
2012-09-29 06:55 Zeljan Rikalo Status new => assigned
2012-09-29 06:55 Zeljan Rikalo Assigned To => Zeljan Rikalo
2012-09-29 08:19 Zeljan Rikalo Fixed in Revision => 38895
2012-09-29 08:19 Zeljan Rikalo LazTarget => -
2012-09-29 08:19 Zeljan Rikalo Status assigned => resolved
2012-09-29 08:19 Zeljan Rikalo Resolution open => fixed
2012-09-29 08:19 Zeljan Rikalo Note Added: 0062718
2012-09-29 10:30 John Kelly Note Added: 0062720
2012-09-29 10:31 John Kelly Status resolved => assigned
2012-09-29 10:31 John Kelly Resolution fixed => reopened
2012-09-29 10:31 John Kelly Note Added: 0062721
2012-09-29 10:32 John Kelly Note Edited: 0062720
2012-09-29 11:03 John Kelly Note Added: 0062722
2012-09-29 11:25 Zeljan Rikalo Note Added: 0062726
2012-09-29 11:50 Zeljan Rikalo Status assigned => resolved
2012-09-29 11:50 Zeljan Rikalo Resolution reopened => fixed
2012-09-29 11:50 Zeljan Rikalo Note Added: 0062727
2012-09-29 13:50 John Kelly Note Added: 0062729
2012-09-29 13:51 John Kelly File Added: listview.zip
2012-09-29 13:52 John Kelly Status resolved => assigned
2012-09-29 13:52 John Kelly Resolution fixed => reopened
2012-09-29 13:56 Zeljan Rikalo Status assigned => resolved
2012-09-29 13:56 Zeljan Rikalo Resolution reopened => fixed
2012-09-29 13:56 Zeljan Rikalo Note Added: 0062730
2012-09-29 14:08 John Kelly Status resolved => closed
2012-09-29 14:08 John Kelly Note Added: 0062731