Class GPALForm
Form object that contains the fluent methods to create interactive forms.
Instatiated using GPAL.Form
Inheritance
Implements
Inherited Members
Namespace: GenerallyPositive.GPALForm
Assembly: GPAL.dll
Syntax
public class GPALForm : IAllowFormSettingsAndActions, IAllowFormSettings, IAllowFormActionsAndFillIn, IAllowFillInFrom, IAllowFormActions, IAllowCallBack
Examples
static GPALButton gPalButton1 = (GPALButton)GPAL.Button
.WithName("button1")
.WithText("Exit")
.WithCallback(ExitButtonClickHandler)
.WithShortcutKey(System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.E); // Alt-E
static void Main(string[] args)
{
Form myForm = (Form)GPAL.Form
.WithTitle("Simple Form Test")
.WithFormControl(gPalButton1)
.ShowDialog();
}
private static void ExitButtonClickHandler(object sender, EventArgs e)
{
Control control = (Control)sender;
while (null != control.Parent)
control = control.Parent;
control.Hide();
}
Properties
FormName
The name of your form Currently not used, but will be used for Information and Exceptional channel messages.
Declaration
public string FormName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
AppendFrom(GPALDatabase)
Append to the end of the forms inputs using tokens derived from the database.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions AppendFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | GPAL Database object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
AppendFrom(IGPALFile)
Append to the end of the forms inputs using tokens derived from the file.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions AppendFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | GPAL File object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
AppendFrom(IGPALGrid<String>)
Append to the end of the forms inputs using tokens derived from the GPALGrid.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions AppendFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | Input tokens rows/column in nested lists |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
CallAfterFillIn(GPALForm.CallAfterFillInDelegate)
Add a handler to call after a row of tokens is consumed and after all inputs are filled in with data.
Only one CallAfterFillIn handler exists.
Use FillInFrom[Database|File|GPALGrid] to loop thru data in your main workflow and then perform next workflow steps in the CallAfter handler.
Declaration
public IAllowFormSettingsAndActions CallAfterFillIn(GPALForm.CallAfterFillInDelegate callAfterFillIn)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALForm.CallAfterFillInDelegate | callAfterFillIn | Your callback |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
FillInFrom(GPALDatabase)
Fill in (overwrite) the forms inputs using tokens derived from the database.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions FillInFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | GPAL Database object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
FillInFrom(IGPALFile)
Fill in (overwrite) the forms inputs using tokens derived from the file.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions FillInFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | GPAL File object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
FillInFrom(IGPALGrid<String>)
Fill in (overwrite) the forms inputs using tokens derived from the GPALGrid.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions FillInFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | Input tokens rows/column in nested lists |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
Hide()
Hide the GPAL form. This will essentially terminate the program if .ShowDialog() is the last method in main and hide is called via a button click handler.
Declaration
public IAllowFormActions Hide()
Returns
| Type | Description |
|---|---|
| IAllowFormActions | Fluent interface which allows you to control your form. |
Examples
static GPALButton gPalButton1 = (GPALButton)GPAL.Button
.WithName("button1")
.WithText("Exit")
.WithCallback(ExitButtonClickHandler)
.WithShortcutKey(System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.E); // Alt-E
static void Main(string[] args)
{
Form myForm = (Form)GPAL.Form
.WithTitle("Simple Form Test")
.WithFormControl(gPalButton1)
.ShowDialog();
}
private static void ExitButtonClickHandler(object sender, EventArgs e)
{
Control control = (Control)sender;
while (null != control.Parent)
control = control.Parent;
control.Hide();
}
InsertFrom(GPALDatabase)
Insert at the beginning of the forms inputs using tokens derived from the database.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions InsertFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | GPAL Database object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
InsertFrom(IGPALFile)
Insert at the beginning of the forms inputs using tokens derived from the file.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions InsertFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | GPAL File object |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
InsertFrom(IGPALGrid<String>)
Insert at the beginning of the forms inputs using tokens derived from the GPALGrid.
Used after .Show()
Use with CallAfterFillIn to automate your form
Declaration
public IAllowFormSettingsAndActions InsertFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | Input tokens rows/column in nested lists |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
Show()
Show the GPAL form so it may be automated by tokens. Use ShowDialog when the form workflow ends.
Declaration
public IAllowFormActionsAndFillIn Show()
Returns
| Type | Description |
|---|---|
| IAllowFormActionsAndFillIn | Fluent interface which allows you to automate entering tokens |
Examples
GenerallyPositive.Form.Form myForm = (GenerallyPositive.Form.Form)GPAL.Form
.WithTitle("Simple Form Test")
.WithLeft(1500)
.WithTop(100)
.WithWidth(350)
.WithFormControl(gPALLabel)
.WithFormControl(gPalInput)
.WithFormControl(gPALTextArea)
.CallAfterFillIn(CallAFterFillIn) // call after the form inputs are filled with tokens
.Show()
.FillInFrom(inputFile) // fill in the two input using tokens (eg., "test, this")
.ShowDialog();
ShowDialog()
Show the GPAL form as a modal. Use LAST in a form workflow.
NOTE: This blocks workflows and FillIn methods, use Show() with FillIns
Declaration
public IAllowFormActions ShowDialog()
Returns
| Type | Description |
|---|---|
| IAllowFormActions | Fluent interface allowing you to show or hide your GPAL form |
ToGPALObject()
Return a GPALForm so that GPAL.Form does not have to be cast.
Declaration
public dynamic ToGPALObject()
Returns
| Type | Description |
|---|---|
| System.Object | A GPALForm object |
Examples
GPALForm myForm = GPAL.Form
.WithTitle("Simple Form Test")
.WithLeft(1500)
.WithTop(100)
.WithWidth(350)
.WithFormControl(gPALLabel)
.WithFormControl(gPalExitButton)
.ToGPALObject();
WithFormControl(Object)
Add a form control (GPALButton, GPALChart, etc.) to a GPALForm.
Controls are displayed on one line in the order added.
Declaration
public IAllowFormSettingsAndActions WithFormControl(object gPALControl)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | gPALControl |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
Examples
Form myForm = (Form)GPAL.Form
.WithTitle("Simple Form Test")
.WithFormControl(gPalButton1)
.ShowDialog();
WithHeight(Int32)
Define the initial height of your GPAL form
Declaration
public IAllowFormSettingsAndActions WithHeight(int height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | height | Height in pixels |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
WithLeft(Int32)
Define the initial coordinate of the left side of your GPAL form
Declaration
public IAllowFormSettingsAndActions WithLeft(int left)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | left |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
WithTitle(String)
The title to display at the top of your form.
Declaration
public IAllowFormSettingsAndActions WithTitle(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | title | Title to display |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
WithTop(Int32)
Define the initial coordinate of the top side of your GPAL form
Declaration
public IAllowFormSettingsAndActions WithTop(int top)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | top |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |
WithWidth(Int32)
Define the initial width of your GPAL form
Declaration
public IAllowFormSettingsAndActions WithWidth(int width)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | width | Width in pixels |
Returns
| Type | Description |
|---|---|
| IAllowFormSettingsAndActions | Fluent interface for defining your GPAL form |