TMiletusWindow
Description
Below is a list of the most important properties and methods for TMiletusWindow
. This component allows the creation of multiple application windows, which can be linked to forms or other sources.
![]() |
![]() |
---|---|
Designtime | Runtime |
Properties for TMiletusWindow
Property | Description |
---|---|
FormClass: TFormClass | Sets the form class of the TMiletusWindow . |
Methods for TMiletusWindow
Property | Description |
---|---|
Close | Method to close the window |
Hide | Method to hide the window. |
LoadFromURL(URL: string) | Method to load from the given URL . It can be a URL or a path to a local file too. |
Show | Method to show the window. |
ShowModal | Method to show the window as a modal It blocks the parent window. |
Events for TMiletusWindow
Property | Description |
---|---|
OnClose | Triggers when the window closes. |
OnHide | Triggered when the window gets hidden. |
OnMaximize | Triggers when the window is maximized. |
OnMinimize | Triggers when the window is minimized. |
OnResize | Triggers when the window is resized. |
OnShow | Triggers when the window is shown. |
Multiple windows using forms
Forms that are added to the project can be used as a source for the page to be shown in the window. In order to achieve this, a few steps have to be made:
-
The form class needs to be assigned to the correct
TMiletusWindow
instance. To do this, first the unit that contains the form has to be added to the uses list. For example: We would like to use theTForm2
from Unit2 in Unit1. Then in the uses list of Unit1 add Unit2. -
After this, in the form's
OnCreate
event we can assign the form class to theTMiletusWindow
with the code below. -
MiletusWindow1.FormClass := TForm2;
From now on, whenever MiletusWindow1.Show
is called, it creates the window for us
automatically.
Please be aware that each form has their own memory and there's no globally shared object
between them.
Multiple windows using other sources
An HTML file or a link to a website can also be used inside a TMiletusWindow
. In this case the
only necessary step is to call the URL
load method in the OnCreate
event of the form.
Showing a window
To show the window after its content had been set, simply call Show
or ShowModal
. The expected
behaviour is that showing a modal window will block the parent window until the modal itself
gets closed.
Communication between forms
It is possible to send messages between forms. Follow these steps to enable your forms for messaging:
//Register your form with a unique name that you can refer to later.
procedure TForm1.MiletusFormCreate(Sender: TObject);
begin
RegisterForm('myFormId');
end;
//Send a message to a registered form with the following call:
procedure TForm2.WebButton1Click(Sender: TObject);
begin
SendMessage('myFormId', 'My message');
end;