FreeForm

From SCAR Divi Manual
Jump to: navigation, search

Definition

function FreeForm(const Form: TForm): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

This function frees a form given by Form that was created with CreateForm, it returns true if the form was assigned and found in the forms resource manager.

Example

var
  TestForm: TForm;

procedure TestForm_Init;
begin
  TestForm := CreateForm;
  with TestForm do
  begin
    Left := -1147;
    Top := 335;
    Caption := 'Test Form';
    ClientHeight := 202;
    ClientWidth := 304;
    Color := clBtnFace;
    Font.Charset := DEFAULT_CHARSET;
    Font.Color := clWindowText;
    Font.Height := -11;
    Font.Name := 'Tahoma';
    Font.Style := [];
    OldCreateOrder := False;
    PixelsPerInch := 96;
  end;
end;

procedure TestForm_SafeInit;
var
  v: TVariantArray;
begin
  SetLength(v, 0);
  ThreadSafeCall('TestForm_Init', v);
end;

function TestForm_ShowModal: Boolean;
begin
  Result := TestForm.ShowModal = mrOk;
end;

function TestForm_SafeShowModal: Boolean;
var
  v: TVariantArray;
begin
  SetLength(v, 0);
  Result := ThreadSafeCall('TestForm_ShowModal', v);
end;

begin
  TestForm_SafeInit;
  if TestForm_SafeShowModal then
    WriteLn('Form returned modalresult ok');
  FreeForm(TestForm);
end.

See Also