Form

GPALInput

GPALInput is the primary text entry control for interactive GPAL forms. WithText sets the starting text and WithPlaceholder sets the grey prompt shown while the field is empty. IsPassword masks what is typed with bullets, and supplies "Enter Password" as the placeholder when none was given. ShowPassword is a runtime property rather than a fluent setting, because revealing a password is something a user does while the form is up: set it true to make the text readable and false to mask it again, which is all a show-password button has to do. WithReadOnly displays a value without allowing it to be edited, useful for a field a workflow fills in and the user only reads. When FillInFrom is used with a data source, the input value is set from the corresponding column in the data grid, and the value is extracted when the form data is read back. AppendFrom and InsertFrom make non-destructive edits.

Examples

GPAL Fluent: High-level fluent C# API

//WithReadOnly and WithPlaceholder come before WithName in a chain, since WithName narrows the interface. ShowPassword is not a fluent method and returns nothing to chain: it is read and written like any property, from the UI thread or from a workflow thread, and GPAL marshals it. Each GPALInput added to a form corresponds to one column in the grid produced by FillInFrom, populated in the order they were added.

// Text, password, and read-only in one form

GPALInput user = GPAL.Input

.WithPlaceholder("you@example.com")

.WithName("email")

.ToGPALObject();


GPALInput secret = GPAL.Input

.IsPassword

.WithName("password")

.ToGPALObject();


GPALInput server = GPAL.Input

.WithReadOnly()

.WithText("smtp.example.com")

.WithName("server")

.ToGPALObject();


GPALButton reveal = GPAL.Button

.WithText("Show")

.WithCallback<EventHandler>(ToggleReveal)

.WithName("reveal")

.ToGPALObject();


GPAL.Form

.WithTitle("Sign In")

.WithFormControl(user)

.WithFormControl(secret)

.WithFormControl(server)

.WithFormControl(reveal)

.ShowDialog();


// The whole of a show-password button

void ToggleReveal(object sender, EventArgs e)

{

secret.ShowPassword = false == secret.ShowPassword;

}

💬 Ask GPAL