Wrapper to use Amiga MUI Objects with standard Pascal objects
Dokumentation created from the docu folder: MUIClass Docu
Binaries (IDE, examples, units) for all Amiga systems: MUIClass Binaries
Unit Name | Objects |
MUIClass.Base | RootClass, Notify, Application, Family, Semaphore, Dataspace, HSpace, VSpace, HBar, VBar, BarTitle, Timer |
MUIClass.Area | Area, Rectangle, Balance, Gauge, Scale, Colorfield, Text, PenDisplay, PopPen, Button |
MUIClass.Group | Group, ListView, Register, Virtgroup, Scrollgroup, Radio, Cycle, Coloradjust, Palette |
MUIClass.Window | Window, AboutMUI |
MUIClass.Gadget | Gadget, String, Prop, Scrollbar |
MUIClass.Image | Image, Bitmap, PopButton, Checkmark |
MUIClass.List | List, FloatText, VolumeList, DirList |
MUIClass.Popstring | Popstring, PopObject, PopList, PopASL |
MUIClass.Menu | Menustrip, Menu, Menuitem |
MUIClass.Numeric | Numeric, Knop, Levelmeter, NumericButton, Slider |
MUIClass.Tree | TreeView |
MUIClass.StringGrid | StringGrid |
MUIClass.Dialog | FileDialog, FontDialog, ScreenModeDialog |
MUIClass.Datytypes | DatatypesObject |
MUIClass.DrawPanel | DrawPanel |
MUIClass.Dialog | FileDialog, FontDialog, ScreenModeDialog |
Make a new class for your Window.
type TMyWindow = class(TMUIWindow) end; var Win: TMyWindow;
In your main routine, create your window class.
Win := TMUIWindow.Create;
Set some properties, for example the window title text.
Win.Title := 'Test Window';
Create some contents for the Window, for example a Button and a Text with some properties.
Text := TMUIText.Create; Text.Contents := 'Not Clicked'; Button := TMUIButton.Create; Button.Contents := 'Click me';
Now connect both to the Window by assigning the Parents to the window.
The order of Parent assignment defines the order in the Window later. By default the window aligns the Items vertically, one over the other (By setting Win.Horizontal := True;
you get them side by side).
Text.Parent := Win; Button.Parent := Win;
We want also some Action in the Window, create an Event Function inside your Window Class:
type TMyWindow = class(TMUIWindow) procedure ButtonClick(Sender: TObject); end; procedure TMyWindow.ButtonClick(Sender: TObject); begin Text.Contents := 'Clicked'; end;
The Event should be called when the Button is clicked. Connect it to the OnClick Event.
Button.OnClick := @Win.ButtonClick;
Now everythis is ready to run. We start our created application. (There is no need to create a application object or connect the Windows to the application object, this is done automatically). The application is started with
MUIApp.Run;
MUIApp is a global Application object in MUIClass.Base. It has the usual fields you would expect, like application description, events for iconify and so on.
If the main Window is closed the application will terminate. (you can also call MUIApp.Terminate
to end the application).
When the Application quits it will destroy everything which is connected to MUIApp (also nested through other classes or objects) it will free all MUI objects and Pascal Classes.
MUI objects have several fields which can only be changed before the actual object is created, make sure to set them before you start MUIApp.Run. If you try to set such a field in runtime you will get a warning in the debug log and the value will be ignored.
You can find that complete Source of this example in examples/HelloWorld2.pas
How to Handle other problems like dynamic creation/destruction of Windows other event types an Drawing to a Panel check the examples/TestApp.pas which contains many objects and Event connections.