Form

GPALButton

Everything on Settings Every Control Takes applies here too. GPAL.Button builds one and the text on its face comes from WithText. Default makes it the form's accept button, so Enter presses it and it carries DialogResult.OK, which is what closes a ShowDialog form. Click is the button's primary event, so WithCallback on its own wires the click without needing ForEvent. GPAL.ButtonFor(text) is the one-call shorthand for a button the form only displays.

Examples

GPAL Fluent: High-level fluent C# API

//Default comes before WithName, since WithName narrows the chain. The handler reaches the other controls because each one is a declared field.

GPALButton save = (GPALButton)GPAL.Button

.WithText("Save")

.WithWidth(120)

.WithShortcutKey(Keys.Alt | Keys.S)

.WithCallback<EventHandler>(SaveClicked)

.WithName("save");


GPALButton close = (GPALButton)GPAL.Button

.Default

.WithText("Close")

.WithWidth(120)

.WithCallback<EventHandler>((s, e) => myForm.Hide())

.WithName("close");


void SaveClicked(object sender, EventArgs e)

{

status.Text = $"Saved {rows.Count} rows";

save.Enabled = false;

}

💬 Ask GPAL