View Issue Details

IDProjectCategoryView StatusLast Update
0003051JEDI VCL00 JVCL Componentspublic2005-08-09 08:45
ReporterlaplaceAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0003051: Index out of bound on clicking on embty list box
DescriptionFor any jvCustomListBox descendant, when setting DragMode to dmAutomatic and clicking on the list while embty, it produces the error "List out of bound List(0)".
I've traced the error and found that the cause of the problem that when embty, ListIndex still hold 0, while it should hold -1.

My fast solution is to change the DefaultStartDrag of TjvCustomListBox to be as following:

procedure TJvCustomListBox.DefaultStartDrag(var DragObject: TDragObject);
begin
  If Items.Count = 0 Then //Ahmed Fouad 23/06/05 3:15:38 PM Solve problem with embty list
    ItemIndex := -1;
  FDragIndex := ItemIndex;
  if not IsProviderSelected and (FDragIndex >= 0) then
    CreateDragImage(Items[FDragIndex])
  else
    CancelDrag;
end;
TagsNo tags attached.

Activities

2005-06-23 06:07

 

JvListBox.pas (64,094 bytes)

obones

2005-06-23 11:08

administrator   ~0007484

I've just dropped a TJvListBox on an empty form, and I could not reproduce this problem.
Please create a sample application, zip up the sources, and attach it to the issue.
Thanks.

laplace

2005-06-23 11:20

reporter   ~0007485

Sorry about that,
i forgot one detail, set MultiSelect to True

the scenario is , drop any jvListBox on a form, set DragMode to dmAutomatic and set MultiSelect to True.
run and just click on it, it will produce the error

obones

2005-06-23 12:29

administrator   ~0007486

Nope, not even with this.
I'm using Delphi 6 here, which version do you use?

2005-06-26 02:19

 

TestJVClListBox.zzz (274,017 bytes)

anonymous

2005-06-26 02:21

viewer   ~0007491

The problem produces on Delphi 7, i've tested it on Delphi 5 and it doesn't show.

i've sent a file with the source and the executable, just rename the extension to .zip

obones

2005-06-27 00:36

administrator   ~0007496

Well, I've just tested with the Delphi 7 here, yes, ItemIndex is 0, but that's windows returning this, not us (see TCustomListBox.GetItemIndex)
Anyway, I just compiled your application, I don't have a single problem with the application. Sure, the exe you provided does display the problem, but I suspect an issue with your setup, something specific to your operating system and/or version of Delphi. Have you applied all the patches?

obones

2005-08-09 08:45

administrator   ~0007748

Well, no answers in more than a month, this is considered fixed.

Issue History

Date Modified Username Field Change
2005-06-23 06:07 laplace New Issue
2005-06-23 06:07 laplace File Added: JvListBox.pas
2005-06-23 11:08 obones Note Added: 0007484
2005-06-23 11:08 obones Status new => feedback
2005-06-23 11:20 laplace Note Added: 0007485
2005-06-23 12:29 obones Note Added: 0007486
2005-06-26 02:19 anonymous File Added: TestJVClListBox.zzz
2005-06-26 02:21 anonymous Note Added: 0007491
2005-06-27 00:36 obones Note Added: 0007496
2005-08-09 08:45 obones Status feedback => resolved
2005-08-09 08:45 obones Resolution open => fixed
2005-08-09 08:45 obones Assigned To => obones
2005-08-09 08:45 obones Note Added: 0007748