Forum > LCL

Is there a bug in TListBox?

<< < (2/3) > >>

Marc:

--- Quote from: vfclists on May 04, 2010, 01:45:58 am ---It crashes on this line:

--- Code: ---if lbEventsToMonitorA.Selected[i] = true then
--- End code ---

and the crash occurs when the item is not selected, ie always crashes on the first on selected item.

--- End quote ---

is lbEventsToMonitorA visible ?

vfclists:
It is populated at design time. As I said, it crashes when the index hits the first unselected item.


--- Quote from: eny on May 04, 2010, 06:46:43 am ---Just a thought: is your listbox populated, the first time you call 'GetEventsList'?

--- End quote ---

vfclists:

--- Quote from: Marc on May 04, 2010, 08:51:16 am ---
--- Quote from: vfclists on May 04, 2010, 01:45:58 am ---It crashes on this line:

--- Code: ---if lbEventsToMonitorA.Selected[i] = true then
--- End code ---

and the crash occurs when the item is not selected, ie always crashes on the first on selected item.

--- End quote ---

is lbEventsToMonitorA visible ?

--- End quote ---

It is visible, fully upfront. Something appears to be wrong with code generation.

Bart:
Similar code:

--- Code: ---var
  i: Integer;
begin
  for i := 0 to listbox1.Items.Count - 1 do
    if listbox1.Selected[i] then
      debugln('Selected[',dbgs(i),'] = True, Value = ',Listbox1.Items[i])
    else
      debugln('Selected[',dbgs(i),'] = False, Value = ',Listbox1.Items[i]);
end;

--- End code ---

runs perfectly fine here.

Q: Is list assigned (created) when you pass it to the procedure?

Bart

vfclists:

I have checked and the code is correct. There were problems further down in the source code, but the debugger was executing them without moving the highlight to them.

The highlight would be in one place where as the code was executing somewhere else. Is that a known feature? (Lazarus 0.9.28 Windows)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version