Hello everybody :) I'm writing small application about mileage of Polish roads. I'm using C++Builder 6. My application looks like this:
http://s3.postimg.org/u8jp5l5cz/Bez_tytu_u.png
When I choose road from ComboBox, application load information to RadioGroup and Memo from text file, about mileage and polish province. Syntax of this file is:
And now I have problem with RadioGroup, because I want something like that: when user choose some option from RadioGroup I want to display correct value (province) in Memo or Label - it dosen't matter. Of course lists of mileage are different for different roads in Poland. It's not constants.
My code:
Uni1.h
1 2
private: // User declarations
THashedStringList *Lista;
if ( lista == NULL)
delete Lista;
Lista = new THashedStringList;
Lista->LoadFromFile(sFileName);
RadioGroup1->Items->Clear();
Memo1->Clear();
for(int i = 0; i < Lista->Count; i++)
{
RadioGroup1->Items->Add(Lista->Names[i]);
}
create event on groupbox, like onChange, or onClick. Inside it find which radio button is selected and then use this:
1 2 3 4 5
if ( lista != NULL)
{
//find selected radio button
Memo1->Lines->Add(Lista->Values[ Lista->Names[ < here put selected radio button index > ]]);
}