View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0025158||Lazarus||LCL||public||2013-10-07 02:03||2013-10-30 20:20|
|Reporter||Bobi Hot||Assigned To||Bart Broersma|
|Summary||0025158: TRadioGroup with set value ItemIndex at design time miss after saving and building|
|Description||TRadioGroup with set value ItemIndex at design time miss after saving and (or) building (starting) aplication.|
|Steps To Reproduce||Make a new form.|
Place TRadioGroup with many possibilities (1, 2, 3, 4, 5...).
Set value ItemIndex at design time (to 5). After saving and (or) building this value was reset to zero (0, not -1).
|Additional Information||I do not observe befour this.|
|Tags||No tags attached.|
|Fixed in Revision||r43163|
||Probably caused by r42772|
> Probably caused by r42772
I don't see anything in that revision that would explain that for me...
It's easy to check.
@Bobi: can you try r42771 and see the bug has gone?
If so try r42772 and see if the bug appears.
||@Bobi Hot: Please, always attach compileable example. It's waste of time for developers to create example projects for every issue which does not have it.|
Didn't check if existed before that, but I could reproduce it latest svn here:
Line sets itemindex to zero
if (FItemIndex>=FItems.Count) then FItemIndex:=FItems.Count-1;
So what to do ? Keep FItemIndex and set it after UpdateItems if it's in range ?
Or better remember what item was "ItemIndex" and set that item as ItemIndex (since eg. list was changed, some items added or removed) ?
This piece of code was called too, before I made that change.
Only relevant change now is that UpdateItems (which adds or removes radiobuttons) is also called inside Items.BeginUpdate/Items.EndUpdate (which is necessary, otherwise: crash).
if (FItemIndex>=FItems.Count) then FItemIndex:=FItems.Count-1
This line can only happen if you have ItemIndex set to Count-1 (last item) and then remove one item from the list.
||Target 1.2 (it's a regression).|
Please test and close if OK.
And yes, it was my revision that broke it in the first place.
RadioGroup1199err.zip (321,822 bytes)
I was busy to give up project and now I can to try some other and replay to You.
1.The project is save correctly. I open .lfm and property is setting right:
ItemIndex = 4
2. But then running programm is set to zero (0)? I debug and at initialize
TCustomRadioGroup.SetItemIndex(Value : integer);
is set with correct value (4). But showing window is back set with zero index, less to enter again to this procedure? I make show to label.caption in OnCreate and value is "0".
3. I try with other visual components which have ItemIndex property (TComboBox,TListBox) and they work properly.
4. I attach .zip file (RadioGroup1199err.zip) with initialy test project to see this. (I do not see where is :) )
@Bobi: the issue is fixed in trunk and merged (r43266) in fixes branch:
r43223 TRadioGroup: fix resetting ItemIndex to -1 when calling Items.Assign (regression introduced by me in r42772).
Which Lazarus version and which revision are you using?
||I tested with r43338 of Fixes_1_2 branch (1.99pre-release) and it behaves as expected.|
I use Lazarus 1.1.99 pre release.
Thanks for fixed . I was haste to be correct before final release.
I transfer source from 1.3-43331 and work pretty. :)
|2013-10-07 02:03||Bobi Hot||New Issue|
|2013-10-07 02:03||Bobi Hot||File Added: TRadioGroupErr1199.PNG|
|2013-10-07 09:13||ocean||Note Added: 0070600|
|2013-10-07 11:17||Jonas Maebe||Project||FPC => Lazarus|
|2013-10-07 11:35||Bart Broersma||Note Added: 0070605|
|2013-10-07 11:39||Zeljan Rikalo||Note Added: 0070606|
|2013-10-07 12:22||ocean||Note Added: 0070607|
|2013-10-07 14:11||Zeljan Rikalo||Note Added: 0070611|
|2013-10-07 15:55||Bart Broersma||Note Added: 0070616|
|2013-10-07 16:06||Bart Broersma||LazTarget||=> 1.2|
|2013-10-07 16:06||Bart Broersma||Note Added: 0070618|
|2013-10-07 16:06||Bart Broersma||Product Version||2.6.2 =>|
|2013-10-07 16:06||Bart Broersma||Target Version||=> 1.2.0|
|2013-10-07 19:19||Bart Broersma||Fixed in Revision||=> r43163|
|2013-10-07 19:19||Bart Broersma||Note Added: 0070624|
|2013-10-07 19:19||Bart Broersma||Status||new => resolved|
|2013-10-07 19:19||Bart Broersma||Resolution||open => fixed|
|2013-10-07 19:19||Bart Broersma||Assigned To||=> Bart Broersma|
|2013-10-29 09:30||Bobi Hot||File Added: RadioGroup1199err.zip|
|2013-10-29 09:50||Bobi Hot||Note Added: 0071018|
|2013-10-29 13:31||Bart Broersma||Note Added: 0071023|
|2013-10-29 13:31||Bart Broersma||Status||resolved => feedback|
|2013-10-29 19:11||Bart Broersma||Note Added: 0071028|
|2013-10-30 19:49||Bobi Hot||Note Added: 0071045|
|2013-10-30 19:49||Bobi Hot||Status||feedback => assigned|
|2013-10-30 20:20||Bart Broersma||Note Added: 0071046|
|2013-10-30 20:20||Bart Broersma||Status||assigned => resolved|