Difference between revisions of "CreateForm"
From SCAR Divi Manual
(Created page with "==Definition== <func>function CreateForm: TForm;</func> ==Availability== SCAR Divi 3.00 > Current ==Description== This function creates and returns a new form object of the [[T...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Definition== | ==Definition== | ||
− | < | + | <source lang="scar" lines="false"> |
+ | function CreateForm: TForm; | ||
+ | </source> | ||
==Availability== | ==Availability== | ||
Line 6: | Line 8: | ||
==Description== | ==Description== | ||
− | This function creates and returns a new form object of the [[TForm]] class which is stored internally in the forms resource manager. It will be automatically freed if the script stops and you | + | This function creates and returns a new form object of the [[TForm]] class which is stored internally in the forms resource manager. It will be automatically freed if the script stops and you have not freed it yourself with [[FreeForm]]. '''You have to use FreeForm to destroy a form created with CreateForm, trying to achieve this any other way will result in errors.''' |
==Example== | ==Example== |
Latest revision as of 11:28, 26 June 2011
Definition
function CreateForm: TForm;
Availability
SCAR Divi 3.00 > Current
Description
This function creates and returns a new form object of the TForm class which is stored internally in the forms resource manager. It will be automatically freed if the script stops and you have not freed it yourself with FreeForm. You have to use FreeForm to destroy a form created with CreateForm, trying to achieve this any other way will result in errors.
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.