- This topic has 6 replies, 2 voices, and was last updated 10 years, 5 months ago by
JohnG.
-
AuthorPosts
-
November 3, 2014 at 10:58 am #52694
Support
KeymasterHello, thank you for the demo.
I'm not sure where is a reason of the problem, but I see a same behaviour with standard controls.
Maybe I not quite understand a problem…
November 4, 2014 at 7:57 pm #52706JohnG
ParticipantQuote:but I see a same behaviour with standard controls.
Yes, I see that now. So the problem lies somewhere in the original component.
Quote:Maybe I not quite understand a problem…
The problem is that the Radiogroup's ItemIndex changes unexpectedly (when there is more than 1 Radiogroup). If I replace the sRadioGroup with sComboBox, then setting/getting config values works as expected. Now, when I set an ItemIndex := 1 it stays as configured.
I do think the visual presentation using a Radiogroup looks better for this particular case, though. Perhaps you could consider this an opportunity to improve on the original component? 😉
John
November 10, 2014 at 12:38 pm #52713Support
KeymasterI should make an easier test app firstly, because your application has a many code which can have influence.
I'll try make such application soon.
November 11, 2014 at 12:31 am #52718JohnG
ParticipantHello,
The first demo was more complex than needed. But there was a reason for that: to demonstrate and confirm that my config set/get technique was working correctly — it was, except for the Radiogroups.
Attached is a stripped-down demo, using only 2 Radiogroups. There is also a Combobox demo attached. Both projects use the exact same code, except for the Radiogroup vs the Combobox on the Config form.
It's hard to believe that there are such problems with a Radiogroup, after all these years of Delphi development. I would be happy to be shown the error of my ways. 🙂
John
[attachment=6953:Radiogroup Test.zip]
[attachment=6954:Combobox Test.zip]
November 11, 2014 at 7:20 am #52721Support
KeymasterI found a reason of the prob, look this code:
Code:procedure TfrmConfig.GetConfigVals;
begin
rgSw1.ItemIndex := dmMyDM.Sw[1]; // Here rgSw1Click called and array is changed. Before – (0,0), after (0, 1)
rgSw2.ItemIndex := dmMyDM.Sw[2];
end;procedure TfrmConfig.rgSw1Click(Sender: TObject);
begin
with dmMyDM do
begin
Sw[1] := rgSw1.ItemIndex;
Sw[2] := rgSw2.ItemIndex;
end;
end;So, dmMyDM.Sw array is changed when you changes the ItemIndex (because rgSw1Click called).
November 14, 2014 at 8:08 am #52730JohnG
ParticipantThankyou! I was stuck in my own view and couldn't see this.
Not an AC problem, so especially thanks for taking the time to look.
John
-
AuthorPosts
- You must be logged in to reply to this topic.