# Form Utilities Forms and components extensions. The following contains custom components and methods to be used in a `TLazForm`. - - - ## TFormUtils Type that olds several method utilities for `TLazForms`. - - - ## FormUtils.NumberField ```pascal procedure TFormUtils.NumberField(sender: TLazObject; var key: Char); ``` Callback method to limit user input to numbers only and backspace. This numbers can be `Integers` only. For `Doubles` check {ref}`FormUtils.FloatField` - - - ## FormUtils.FloatField ```pascal procedure TFormUtils.FloatField(sender: TLazObject; var key: Char); ``` Callback method to limit user input to numbers only and backspace. This numbers can be `Integers` or `Doubles` only. For `Integers` only check {ref}`FormUtils.FloatField` - - - ## FormUtils.MailField ```pascal procedure TFormUtils.MailField({$H-}sender: TLazObject;{$H+} var key: Char); ``` Callback method to limit user input to characters used in email addresses. - - - ## FormUtils.TimeField ```pascal procedure TFormUtils.TimeField(sender: TLazObject; var key: Char); ``` Callback method to limit user input to numbers only, backspace and a few characters used in time like ":", "-", "_", ",", etc. - - - ## FormUtils.NumberArrayField ```pascal procedure TFormUtils.NumberArrayField(sender: TLazObject; var key: Char); ``` Callback method to limit user input to a `TIntegerArray`. Brackets not included. - - - ## FormUtils.OpenURL ```pascal procedure TLazControl.OpenURL(sender: TLazObject); ``` Opens the URL in the control caption if there's any. - - - ## FormUtils.OnMouseEnterURL ```pascal procedure TFormUtils.OnMouseEnterURL(sender: TLazObject); ``` Mouse hover callback for URLs. Basically changes the control text color to blue. If you use this you should also use {ref}`FormUtils.OnMouseLeaveURL` to restore the color to the default when the mouse leaves the control. - - - ## FormUtils.OnMouseLeaveURL ```pascal procedure TFormUtils.OnMouseLeaveURL(sender: TLazObject); ``` Mouse leave callback for URLs. Basically changes the control text color to the default. This should only be used if you are also using {ref}`FormUtils.OnMouseEnterURL` to change the control text color to blue. - - - ## TLazControl.SetFontColor ```pascal procedure TLazControl.SetChildsFontColor(value: Integer); ``` Recursevely sets all childrens fonts colors to `value`. - - - ## TLazComponent.GetChild ```pascal function TLazComponent.GetChild(name: String): TLazComponent; ``` Recursively search for a children with the specified name. - - - ## TLazComponent.RemoveChildren ```pascal procedure TLazComponent.RemoveChildren(release: Boolean = False); ``` Recursively remove children from a parent. To also free the parent set **release** to true. All children are freed when using this. - - - ## CustomEdit.IsEmpty ```pascal function TCustomEdit.IsEmpty(): Boolean; ``` Returns true or false if the `TCustomEdit` are empty. This includes: - `TCustomEdit` - `TLazEdit` - `TLazMemo` - - - ## CustomEdit.GetIntegerArray ```pascal function TCustomEdit.GetIntegerArray(): TIntegerArray; ``` Returns the TIntegerArray in the TCustomEdit (TLazEdit and TLazMemo). It's probably a good idea to limit the TCustomEdit input with **TLazComponent.IntArrayField()**. - - - ## TLazControl.CreateEx ```pascal function TLazPanel.CreateEx(owner: Pointer): TLazPanel; static; function TLazPanel.CreateEx(owner: Pointer; width, height: Integer): TLazPanel; static; overload; function TLazLabel.CreateEx(owner: Pointer): TLazLabel; static; function TLazLabel.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazLabel; static; overload; function TLazEdit.CreateEx(owner: Pointer): TLazEdit; static; function TLazEdit.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazEdit; static; overload; function TLazMemo.CreateEx(owner: Pointer): TLazMemo; static; function TLazMemo.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazMemo; static; overload; function TLazButton.CreateEx(owner: Pointer): TLazButton; static; function TLazButton.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazButton; static; overload; function TLazCheckBox.CreateEx(owner: Pointer): TLazCheckBox; static; function TLazCheckBox.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazCheckBox; static; overload; function TLazRadioButton.CreateEx(owner: Pointer): TLazRadioButton; static; function TLazRadioButton.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazRadioButton; static; overload; function TLazComboBox.CreateEx(owner: Pointer): TLazComboBox; static; function TLazComboBox.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazComboBox; static; overload; function TLazListBox.CreateEx(owner: Pointer): TLazListBox; static; function TLazListBox.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazListBox; static; overload; function TLazTrackBar.CreateEx(owner: Pointer): TLazTrackBar; static; function TLazTrackBar.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TLazTrackBar; static; overload; function TImageBox.CreateEx(owner: Pointer): TImageBox; static; function TImageBox.CreateEx(owner: Pointer; caption: String; hint: String = ''; left, top, width, height: Integer = 0): TImageBox; static; overload; ``` Constructor functions for most `TLazControls`. - - - ## TLazControl.LoadImage ```pascal procedure TLazControl.LoadImage(path: String); procedure TLazControl.LoadImage(img: TImage); overload; ``` Load a image file and set it as the background for a TLazControl. This can be used to set images for TLazPanels, TLazPageControls, TLazTabSheet, TLazButtons, etc. - - - ## CheckBox.SetChecked ```pascal procedure TLazCheckBox.SetChecked(value: Boolean); ``` Sets the checkbox checked or unchecked with a boolean. - - - ## CheckBox.IsChecked ```pascal function TLazCheckBox.IsChecked(): Boolean; ``` Gets the checkbox state, checked or unchecked with a boolean. - - - ## CheckBox.Toggle ```pascal procedure TLazCheckBox.Toggle(); ``` Inverts the checkbox.