You can use this snippet:
if Form2.RadioButton1.Checked then
begin
// Do something
end else
if Form2.RadioButton2.Checked then
begin
// Do something else
end;
If this is going to be a bigger application, you should consider creating a global settings object, which can be changed by your options screen and is read by the procedures which need to know about certain settings.
Important: Directly accessing your forms from all over your code just increases coupling. When your application get's a little large it'll be a nightmare to maintain it.
// Form2
Config.DoSomething = RadioButton1.Checked
Config.DoSomethingElse = RadioButton2.Checked
// Form1
if Config.DoSomething then
begin
// Do something
end else
if Config.DoSomethingElse then
begin
// Do something else
end;
You could also add methods to your config
uration object to save the settings to disk and reload them the next time your application starts.
Others suggested using a RadioGroup, but personally I don't like them as a long term solution, because I find them hard to adapt to my personal UI needs. (Mostly borders and distances) They may also become problematic if someday you want to reorder the items or insert a new item anywhere else than the end: Suddenly ItemIndex
2 means something completly different :) But as a quick-and-dirty solution they sure are useful.