Form

GPALRadioButton

Everything on Settings Every Control Takes applies here too. GPAL.RadioButton builds one, WithText sets the label and WithChecked presets which is on. Checked reads and writes the state at runtime. Windows makes radio buttons exclusive per container, so a set that belongs together goes in the same GPALGroupBox, a tab, or a splitter pane; two sets on the same bare form fight each other. CheckedChanged is the primary event. GPAL.RadioButtonFor(text, isChecked) is the shorthand.

WARNING

Two groups of radio buttons on the same form with nothing between them behave as a single group, and picking one clears the other. Put each set in its own group box, tab or pane.

Examples

GPAL Fluent: High-level fluent C# API

//The group box is what makes these three one set. Without a container around them, every radio button on the form is in the same group.

GPALRadioButton chrome = (GPALRadioButton)GPAL.RadioButton.WithChecked(true).WithText("Chrome").WithName("chrome");

GPALRadioButton edge = (GPALRadioButton)GPAL.RadioButton.WithText("Edge").WithName("edge");

GPALRadioButton firefox = (GPALRadioButton)GPAL.RadioButton.WithText("Firefox").WithName("firefox");


GPALGroupBox browsers = (GPALGroupBox)GPAL.GroupBox

.WithText("Browser")

.WithFormControl(chrome)

.WithFormControl(edge)

.WithFormControl(firefox);


BrowserType chosen = true == chrome.Checked ? BrowserType.Chrome

: true == edge.Checked ? BrowserType.Edge

: BrowserType.FireFox;

💬 Ask GPAL