Creates a new TForm object and sets the width, height, and caption as specified. Do not attempt to destroy or free forms created with NewForm.
Syntax:
Procedure:Â NewForm(Width, Height: Integer; Caption: String): TForm;
Code Reference:
- Navigate to Plugin Store->Tool Manager and create a new Plugin
- Set the plugin type to Script Code and open the Editor
- Copy Code into the editor
- Press run
API Call:
PlanSwift and FreshDesk Code:
Var
MyForm: TForm;
Procedure CheckboxChange(Sender: TObject);
Begin
IF (Sender is TCheckBox) then
If TCheckBox(Sender).Checked then
TCheckBox(Sender).Caption := 'Check Box Checked'
Else
TCheckBox(Sender).Caption := 'Check Box Not Checked';
If (Sender is TColorBox) then
MyForm.Color:= TColorBox(Sender).Selected;
End;
Function MyDialogExecute(Caption: String): Boolean;
Var
MyLabel: TLabel;
MyEdit: TEdit;
MyRadioButton1, MyRadioButton2: TRadioButton;
MyButton1, MyButton2: TButton;
MyComboBox: TComboBox;
MyCheckbox: TCheckbox;
MyColorBox: TColorBox;
Begin
MyForm := NewForm(300, 300, Caption);
MyLabel := NewLabel(20, 10, 'Name');
MyEdit := NewEdit(20, 25, '');
MyEdit.Width := 260;
MyRadioButton1 := NewRadioButton(20, 55, 'Option 1', True);
MyRadioButton1.Width := 260;
MyRadioButton2 := NewRadioButton(20, 80, 'Option 2', False);
MyRadioButton2.Width:= 260;
MyCheckbox := NewCheckBox(20, 110, 'Check Box Active', True);
MyCheckBox.Width := 260;
MyCheckBox.OnClick := 'CheckBoxChange'; // Handle Onclick event...
MyColorBox := NewColorBox(20, 140, MyForm.Color);
MyColorBox.OnChange := 'CheckBoxChange';
MyComboBox := NewCombobox(20, 170, 'Select One');
MyComboBox.Width := 260;
MyCombobox.items.Add('Option 1');
MyComboBox.Items.Add('Option 2');
MyButton1 := NewButton(60, 220, 'OK', mrOK);
MyButton2 := NewButton(160, 220, 'Cancel', mrCancel);
Result := MyForm.ShowModal = mrOK;
End;
Begin
clearoutput;
output(MyDialogExecute('A Test'));
End;