Functions - New Label
Text:
API Call:Creates and returns a new TLabel object and sets the Left, Top and Caption properties. Do not attempt to destroy or free labels created with NewLabel.
Declaration:
<!--startsyntax-->
Function
: NewLabel(Left, Top:
Integer
; Caption:
String
): TLabel;<!--endsyntax-->
API Calls
Delphi
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<!--startdelphi-->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;
<!--enddelphi--> |