Introduction to MAI 2 programming

    This brief description contains enough information to let a programmer understand how easy it is to implement a MAI interface in practice, but it does not contain any "useful" information. To actually program using MAI, you need Pascal sources of the root MAI objects, i.e. maiOBJ.pas

    MAI is at the moment a potentially great concept mostly for internal use. Few projects have been developed by third parties using MAI until now, but I am open for business proposals. This is the main reason why this description is published.

    An other reason to publish this description is to establish who and when started these ideas. I released my first MAI application (a prototype) at the end of 2001 and commercial level applications during 2002 and 2003. The current MAI version is version 2, the first version including "floating".

    If you are planning to develop an application and think MAI would be a great thing for it, please don't hesitate in contacting me. MAI is written in "distilled" delphi pascal (called dd3 pascal) not using any Borland unit (not even system.pas). MAI can be translated into C (Borland, C at best) easily. Please, use mai@dybot.com to contact me.


     Any dd3 pascal application using a GUI interface (not a console application) uses these three basic libraries:

WinObj32     Basic dd3 objects
--------

        TWindow
            |
            +-> TAppWindow
            |
            +-> TBitmapButton
            |
            +-> TTextButton
            |
            +-> TToolbar (toolbars.pas)
                    |
                    +-> TextStyleBar (extrabar.pas)
                    |
                    +-> LCD_Display  (extrabar.pas)

        TApplication

    Any main application window (the window owning the application's menu) is a descendant of the object TAppWindow, any other window is a descendant of TWindow

MAIobj       MAI 2 objects
------

        TWindow (WinObj32.pas)
            |
            +-> TAppWindow (WinObj32.pas)
            |       |
            |       +-> TMaiAppWindow   // MAI = Multiple Area Interface (The container)
            |
            +-> TMaiSeparator           // MAI interface separating tabs (PRIVATE)
            |
            +-> TMaiClient              // MAI = Multiple Area Interface (Each area/window)
                    |
                    +-> TTextEditor     // Pure .txt unformatted text editor/browser client
                    |
                    +-> TRecordBrowser  // CGD modeless dialog area client

    MAI just declares two new TWindow and TAppWindow descendants called TMaiClient and TMaiAppWindow. These two clients contain all MAI functionality. Any MAI area is a descendant of a TMaiClient. Any MAI application window is a descendant of TMaiAppWindow. By just inheriting these objects instead of their ancestors, your windows behave MAI-like. The most complicated functionality, such as supporting mitosis typically requires six lines of source code. This is the actual method used by GoKnot boards to support mitosis (nothing else is required).

Function gkChildWin.maiMitoticDiv (divTyp,ChildNum  : longint) : pMaiClient;
begin
    result := HeapAlloc(dd3Heap, SizeOf(gkChildWin));

    if result = nil then exit;

    pGkChildWin(result)^.InitObject(pParentW, bano, false);
    pGkChildWin(result)^.Game.CopyObject(@Game);
    pGkChildWin(result)^.sgf := sgf;
    pGkChildWin(result)^.sgf.Tit := '<Child of:>' + sgf.Tit
end;

    Since MAI is reusable, you can just pick up "ready to use" objects from their libraries. E.g. the HTML browser:

maiHTML      An HTML client
-------

        TWindow (WinObj32.pas)
            |
            +-> TMaiClient (MAIobj.pas)
                    |
                    +-> THTMLEditor     // MAI area client to browse HTML help

MAIN PAGE

Jacques Basaldúa (c) 2003

MAI page