Syntax

code

Function: NewRadioButton(Left, Top: Integer; Caption: String; Checked: Boolean): TRadioButton;


Description

Creates a new TRadioButton and sets the Left, Top, Caption and Checked Properties as specified. Do not attempt to destroy or free a TRadioButton created with NewRadioButton.


Code Reference

  • 1. Navigate to Plugin Store->Tool Manager and create a new Plugin
  • 2. Set the plugin type to Script Code and open the Editor
  • 3. Copy Code into the editor
  • 4. press run

code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

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;