Board index » delphi » TDBradiogroup is a sheat

TDBradiogroup is a sheat

I have a tdbradiogroup linked to a table. My problem is that in the click
event i cannot detect what is the new choice, but only the prior one. How
can i solve the problem.

thank you in advance.

 

Re:TDBradiogroup is a sheat


Quote
"Santos" <isi...@mail.comport.pt> wrote:
> I have a tdbradiogroup linked to a table. My problem is that in the click
> event i cannot detect what is the new choice, but only the prior one. How
> can i solve the problem.

You are probably accessing the Value property, which is a reflection
of the TField in the Dataset's cache... To get the new selected value,
use OnChange for that. Either of the following two work:

        procedure TForm1.DBRadioGroup1Click(Sender: TObject);
        begin
          Label1.Caption := DBRadioGroup1.Items[DBRadioGroup1.ItemIndex];
        end;

        procedure TForm1.DBRadioGroup1Change(Sender: TObject);
        begin
          Label2.Caption := DBRadioGroup1.Value;
        end;

Happy programming!

Jasper

Other Threads