导出的MF_ToolBar文件xpo

Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: FTM

; Microsoft Dynamics AX MENUITEM : MF_QueryBrowser unloaded
; --------------------------------------------------------------------------------
  VERSION 1
  MENUITEM #MF_QueryBrowser
    Type: 1
    PROPERTIES
      Name                #MF_QueryBrowser
      Label               #Browse query
      HelpText            #Browse query
      ObjectType          #Class
      Object              #MF_QueryBrowser
    ENDPROPERTIES
  ENDMENUITEM

***Element: FTM

; Microsoft Dynamics AX MENUITEM : MF_showField unloaded
; --------------------------------------------------------------------------------
  VERSION 1
  MENUITEM #MF_showField
    Type: 1
    PROPERTIES
      Name                #MF_showField
      Object              #MF_ShowField
    ENDPROPERTIES
  ENDMENUITEM

***Element: FTM

; Microsoft Dynamics AX MENUITEM : MF_CopyFieldsToClipboard unloaded
; --------------------------------------------------------------------------------
  VERSION 1
  MENUITEM #MF_CopyFieldsToClipboard
    Type: 3
    PROPERTIES
      Name                #MF_CopyFieldsToClipboard
      Label               #Copy Table FieldList
      HelpText            #Copy Table FieldList to Clipboard
      ObjectType          #Class
      Object              #MF_CopyFieldsToClipboard
      ConfigurationKey    #SysDevelopmentXPP
    ENDPROPERTIES
  ENDMENUITEM

***Element: FTM

; Microsoft Dynamics AX MENUITEM : MF_CreateNewProject unloaded
; --------------------------------------------------------------------------------
  VERSION 1
  MENUITEM #MF_CreateNewProject
    Type: 3
    PROPERTIES
      Name                #MF_CreateNewProject
      Label               #Create new project (hold Ctrl to edit/duplicate the selected project)
      HelpText            #Create a new project with selected project groups or Update an existing project
      ObjectType          #Class
      Object              #MF_CreateNewProject
      SecurityKey         #SysDevelopment
    ENDPROPERTIES
  ENDMENUITEM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_TabBar2009
  PROPERTIES
    Name                #MF_TabBar2009
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      #// http://www.axaptapedia.com/index.php/Tabax
      #public class FormRun extends ObjectRun
      #{
      #    #define.v('0.3.2')
      #    #localmacro.tabax_license
      #@'Copyright (c) 2006-2007, Max Belugin
      #All rights reserved.
      #
      #Redistribution and use in source and binary forms, with or without modification, are permitted provided
      #that the following conditions are met:
      #
      #  *Redistributions of source code must retain the above copyright notice, this list of conditions
      #   and the following disclaimer.
      #
      #  *Redistributions in binary form must reproduce the above copyright notice,
      #   this list of conditions and the following
      #   disclaimer in the documentation and/or other materials provided with the distribution.
      #
      #  *Neither the name of the Max Belugin nor the names of its contributors may be used to endorse or
      #   promote products derived from this software without specific prior written permission.
      #
      #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
      #BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
      #EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
      #OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
      #OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
      #OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
      #ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      #'
      #    #endmacro
      #
      #// =========== configuration ==============
      #    // prefixes of widow titles whist have
      #    // to have project icon.
      #    // add your prefix if you use localization other
      #    // than russian and english
      #    #localmacro.projectPrefixes
      #        #prefix("Projects\\Shared")
      #        #prefix("Проект ")
      #        #prefix("Development project ")
      #        #prefix("Project ")
      #    #endmacro
      #    // timer interval in milliseconds for active windows scanning
      #    #define.windowsScanTimer(300)
      #//========= configuration end =========
      #    Map windows;
      #    Map titles;
      #    #resAppl
      #    #winAPI
      #    HWND topmost;
      #    HWND second;
      #    ObjectIdent currentFormRun;
      #    HWND currentFormRun_hwnd;
      #    imageListAppl_AOT imgApp;
      #    container p;
      #    DLL user32;
      #    DLLFunction isWindowVisibleFun;
      #    DLLFunction isIconicFun;
      #    DLLFunction isZoomedFun;
      #    DLLFunction openIconFun;
      #    DLLFunction getDesktopWindow;
      #    DLLFunction lockWindowUpdate;
      #    DLLFunction peekMessage;
      #    DLLFunction TranslateMessage;
      #    DLLFunction dispatchMessage;
      #    List mainMenu;
      #    Map mainMenuItems;
      #    boolean menuTree_notOpen;
      #    container MRUProjects;
      #    container editorSuffixes;
      #    int hand;
      #    HWND MdiClient;
      #    boolean fitMaximized;
      #
      #    boolean collapsed;
      #    Set maximized;
      #    container maximizedIdentities;
      #    FormTreeItem loadingMenuItem;
      #    str windowToolTip;
      #    str menuToolTip;
      #    str historyToolTip;
      #    FormButtonControl activeBut;
      #    FormTabPageControl activeTab;
      #    str v;
      #    Map openedProjects;
      #    // iteration:
      #        TreeNode current;
      #        Array iterators;
      #        Array lists;
      #        TreeNodeIterator tniterator;
      #        int sp, lists_sp;
      #        List currentList;
      #    //Map menuUsageStatistics;
      #    container packedMenuUsageStatistics;
      #    boolean menuOnlyPopular;
      #    boolean inDeletion;
      #    int maxCaptionSize;
      #    int windowsScanTimer;
      #    boolean paused;
      #    int heightDecrement;
      #     // Normal sizes for restore after maximization
      #    Map normalPositions;
      #    // Map hWnd --> FormName, MenuItemname
      #    Map formIdentity;
      #    // Map identity -> normal position;
      #    Map identityNormalPositions;
      #    Set retoreIfRestored;
      #    Map oldWindows;
      #    // Windows which probably have fixed size
      #    Map fixedWindows;
      #// === tabs parameters
      #    boolean sameTabSize;
      #    int maxTabSize;
      #    int minTabSize;
      #    int desktopWindow;
      #
      #    #define.SWP_NOACTIVATE(0x10)
      #
      #
      #    #define.CurrentVersion(8)
      #    #localmacro.List5
      #        maxCaptionSize
      #    #endmacro
      #    #localmacro.List6
      #        maxCaptionSize, fitMaximized
      #    #endmacro
      #    #localmacro.List7
      #        maxCaptionSize, fitMaximized, maximizedIdentities
      #    #endmacro
      #    #localmacro.List8
      #        maxCaptionSize, fitMaximized, maximizedIdentities, minTabSize, maxTabSize, sameTabSize
      #    #endmacro
      #    #localmacro.CurrentList
      #        #List8
      #    #endmacro
      #    #define.TCM_FIRST(0x1300)
      #    #define.TCM_GETIMAGELIST(#TCM_FIRST + 2)
      #    #define.TCM_SETIMAGELIST(#TCM_FIRST + 3)
      #    #define.TCM_GETITEMCOUNT(#TCM_FIRST + 4)
      #    #define.TCM_SETITEM(#TCM_FIRST + 6)
      #    #define.TCM_GETITEMRECT(#TCM_FIRST + 10)
      #    #define.TCM_SETITEMSIZE(#TCM_FIRST + 41)
      #    #define.TCM_SETMINTABWIDTH(#TCM_FIRST + 49)
      #    #define.TCM_GETCURSEL(#TCM_FIRST + 11)
      #    #define.TCM_SETCURSEL(#TCM_FIRST + 12)
      #    #define.TCM_HITTEST(#TCM_FIRST + 13)
      #    #define.TCS_FIXEDWIDTH(0x0400)
      #    #define.TCS_TOOLTIPS(0x4000)
      #    #define.TCS_FORCELABELLEFT(0x0020)
      #    #define.TCIF_IMAGE(0x0002)
      #    #define.GWL_STYLE(-16)
      #// === axPath
      #    #define.AxPath_Prefix('AxPath')
      #    #define.AxPath_AOTName('AOT')
      #    #define.AxPath_MenuItemName('MenuItem')
      #    #define.URL_PART_NONE(0)
      #    #define.URL_PART_SCHEME(1)
      #    #define.URL_PART_HOSTNAME(2)
      #    #define.URL_PART_USERNAME(3)
      #    #define.URL_PART_PASSWORD(4)
      #    #define.URL_PART_PORT(5)
      #    #define.URL_PART_QUERY(6)
      #    #define.WM_GETMINMAXINFO(0x24)
      #    #AOT
      #
      #
      #    #if.ReferencesPath
      #        #define.PaneWindowCL("AxPaneWnd")
      #        #define.ImageExt('png')
      #        #localmacro.recID2str
      #            int642str(%1)
      #        #endmacro
      #        #localmacro.str2recID
      #            str2int64(%1)
      #        #endmacro
      #        #define.Ax4
      #    #endif
      #
      #    #ifnot.ReferencesPath
      #        #define.PaneWindowCL("PaneWindowCL")
      #        #define.ImageExt('bmp')
      #        #localmacro.recID2str
      #            uint2str(%1)
      #        #endmacro
      #        #localmacro.str2recID
      #            str2int(%1)
      #        #endmacro
      #        #define.Ax3
      #    #endif
      #
      #// === i18n
      #    Session session;
      #    Map translations;
      #    #localmacro._
      #        element.getText(%1)
      #    #endmacro
      #
      #    #localmacro.language
      #        if (session.interfaceLanguage()=="%1")
      #        {
      #            translations=new Map(Types::String, Types::String);
      #    #endmacro
      #    #localmacro.endLanguage
      #        }
      #    #endmacro
      #// === events
      #    Map events;
      #    #localmacro.fireEvent
      #        __eventHandlersEnumerator__ = element.getEvent(identifierStr(%1)).getEnumerator();
      #        while(__eventHandlersEnumerator__.moveNext())
      #            __eventHandlersEnumerator__.current().%1%2;
      #    #endMacro
      #    SetEnumerator __eventHandlersEnumerator__;
      #}
    ENDSOURCE
    SOURCE #WinApi_GetClassName
      #str WinApi_getClassName(int _hWnd)
      #{
      #    DLL         _Userdll        = new DLL("User32.dll");
      #    DLLFunction _getClassName   = new DLLFunction(_Userdll, "GetClassNameA");
      #    Binary      className       = new Binary(100);
      #    ;
      #    _getClassName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #    _getClassName.returns(ExtTypes::DWord);
      #    if (_getClassName.call(_hWnd, className, 100))
      #        return className.string(0);
      #    else
      #        return "";
      #}
      #
    ENDSOURCE
    SOURCE #window_isContentPane
      #boolean window_isContentPane(HWND _hwnd)
      #{
      #    return element.WinApi_getClassName(_hwnd) == 'ContentFrame';
      #}
    ENDSOURCE
    SOURCE #window_close
      #void window_close(HWnd _hWnd)
      #{
      #;
      #    if (!element.window_isContentPane(_hWnd))
      #        WinAPI::sendMessageEx(_hWnd, #WM_SYSCOMMAND, #SC_CLOSE, 0);
      #}
    ENDSOURCE
    SOURCE #AxPath_findCommon
      #Common AxPath_findCommon(TableID _tableID, container _params)
      #{
      #    Query q=new Query();
      #    QueryBuildDataSource ds = q.addDataSource(_tableID);
      #    Common ret;
      #    QueryRun qr;
      #;
      #    if (this.AxPath_filterFromParams(ds, _params))
      #    {
      #        qr = new QueryRun(q);
      #        qr.next();
      #        ret = qr.get(_tableID);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_real2str
      #str AxPath_real2str(real _value)
      #{
      #    str ret = num2str(_value, 0, 16, 1, 0);
      #    int pointPos = strFind(ret, '.', 1, strLen(ret));
      #    int nonZeroPos;
      #;
      #    if (pointPos)
      #    {
      #        nonZeroPos = strNFind(ret, '0', strLen(ret), -strLen(ret));
      #        ret = nonZeroPos ? subStr(ret, 1, nonZeroPos) : '0';
      #        if (this.strEndsWith(ret, '.'))
      #            ret = subStr(ret, 1, strLen(ret) - 1);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_valueFromString
      #AnyType AxPath_valueFromString(Types _type, str _asString)
      #{
      #    switch (_type)
      #    {
      #        case Types::Date:
      #            return str2date(_asString, 321);
      #        case Types::Real:
      #            return str2num(_asString);
      #        case Types::Integer:
      #            return str2int(_asString);
      #        #if.ax4
      #            case Types::Int64:
      #                return str2int64(_asString);
      #        #endif
      #        default:
      #            return _asString;
      #    }
      #}
      #
    ENDSOURCE
    SOURCE #AxPath_filterFromParams
      #boolean AxPath_filterFromParams(QueryBuildDataSource _ds, container _params)
      #{
      #    int i;
      #    str name;
      #    str value;
      #    RecID recID;
      #    FieldID field;
      #    SysDictTable table = SysDictTable::newTableId(_ds.table());
      #    boolean ret;
      #;
      #    for (i=1; i<=conLen(_params); i++)
      #    {
      #        [name, value] = conPeek(_params, i);
      #        if (name != fieldStr(Common, dataAreaId))
      #        {
      #            field = fieldName2ID(_ds.table(), name);
      #
      #            if (!field)
      #                throw error(strFmt(this.getText("Field '%2' is not found in the table '%1'"), tableID2Name(_ds.table()), name));
      #
      #            _ds.addRange(field).value(
      #                queryValue(this.AxPath_valueFromString(
      #                    table.fieldObject(field).type(),
      #                    value
      #                ))
      #            );
      #            ret = true;
      #        }
      #    }
      #    return ret;
      #}
      #
    ENDSOURCE
    SOURCE #AxPath_keyFields
      #container AxPath_keyFields(TableID _table)
      #{
      #    SysDictTable table = SysDictTable::newTableId(_table);
      #    container ret;
      #    IndexID primaryIndexID = table.primaryIndex();
      #    SysDictIndex primaryIndex;
      #    int i;
      #;
      #    if (primaryIndexID)
      #    {
      #        primaryIndex = table.indexObject(primaryIndexID);
      #        for (i=1; i<=primaryIndex.numberOfFields(); i++)
      #            ret += primaryIndex.field(i);
      #    }
      #    else
      #        ret += fieldName2ID(_table, 'RecID');
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_keyByCommon
      #str AxPath_keyByCommon(Common _record)
      #{
      #    container fields = element.AxPath_keyFields(_record.TableId);
      #    int i;
      #    str ret;
      #    FieldID field;
      #    str strValue()
      #    {
      #        AnyType value = _record.(field);
      #        Types type = typeOf(value);
      #    ;
      #        switch(type)
      #        {
      #            case Types::Date:
      #                return date2str(value, 321, 2, 0, 2, 0, 4);
      #            case Types::Real:
      #                return this.AxPath_real2str(value);
      #            case Types::Enum, Types::Integer:
      #                return int2str(value);
      #
      #            default:
      #                return strFmt('%1', value);
      #        }
      #    }
      #;
      #    for (i=1; i<=conLen(fields); i++)
      #    {
      #        if (ret)
      #            ret += '&';
      #        field = conPeek(fields, i);
      #        ret += fieldId2name(_record.TableId, field) + '=' + this.urlEscape(strValue());
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #resourceName
      #str resourceName(str _subPath)
      #{
      #    return 'Tabax_' + strReplace(strReplace(_subPath, '.', '_'), '\\', '_');
      #}
    ENDSOURCE
    SOURCE #getResourcePath
      #str getResourcePath(str _subPath)
      #{
      #    str ret = this.fullInculdePath(_subPath);
      #    if (WinApi::fileExists(ret))
      #        return ret;
      #    return this.filePathFromResource(_subPath);
      #}
    ENDSOURCE
    SOURCE #fullInculdePath
      #str fullInculdePath(str _subpath)
      #{
      #    return this.pathCombine(XInfo::directory(DirectoryType::Include), 'tabax\\' + _subpath);
      #}
    ENDSOURCE
    SOURCE #filePathFromResource
      #str filePathFromResource(str _subPath)
      #{
      #    return SysResource::getImagePath(this.resourceName(_subPath));
      #}
    ENDSOURCE
    SOURCE #getDataFieldTreeNode
      #TreeNode getDataFieldTreeNode(FormRun _form)
      #{
      #    TreeNode ret;
      #    Object formControlEditField = _form.selectedControl();
      #    TreeNode getDataSourceNode()
      #    {
      #        int         dataSourceId;
      #        int         fieldExtId;
      #        str         dataMethodName;
      #        TreeNode    fieldNode;
      #    ;
      #        dataSourceId    = formControlEditField.dataSource();
      #        fieldExtId      = formControlEditField.dataField();
      #        dataMethodName  = formControlEditField.dataMethod();
      #        if (dataSourceId)
      #        {
      #            if (fieldExtId)
      #            {
      #                fieldNode = TreeNode::findNode(#TablesPath + #AOTRootPath + tableId2Name(_form.form().dataSource(dataSourceId).table()) + "\\Fields");
      #                if (fieldNode)
      #                    fieldNode = fieldNode.AOTfindChild(fieldId2Name(_form.form().dataSource(dataSourceId).table(), fieldExt2Id(fieldExtId)));
      #                return fieldNode;
      #            }
      #            else
      #            {
      #                if (dataMethodName)
      #                {
      #                    fieldNode = TreeNode::findNode(strFmt(#DataSourceMethodPath, #FormsPath + #AOTRootPath + _form.name(), _form.form().dataSource(dataSourceId).name(), dataMethodName));
      #                    if (!fieldNode)
      #                    {
      #                        fieldNode = TreeNode::findNode(strFmt(#MethodPath, #TablesPath + #AOTRootPath + tableId2Name(_form.form().dataSource(dataSourceId).table()), dataMethodName));
      #                        return fieldNode;
      #                    }
      #                }
      #            }
      #        }
      #        return null;
      #    }
      #;
      #    switch (formControlEditField.handle())
      #    {
      #        case classNum(FormStringControl):
      #        case classNum(FormRealControl):
      #        case classNum(FormIntControl):
      #        case classNum(FormDateControl):
      #        case classNum(FormComboBoxControl):
      #        case classNum(FormRadioControl):
      #        case classNum(FormTimeControl):
      #            if (formControlEditField.extendedDataType())
      #                ret = new SysDictType(formControlEditField.extendedDataType()).treeNode();
      #            else
      #                ret = getDataSourceNode();
      #            break;
      #        case classNum(FormCheckBoxControl):
      #            ret = getDataSourceNode();
      #            break;
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #showControlInfo
      #public void showControlInfo(FormRun _form)
      #{
      #    #define.taskCtrlQ(264)
      #    SysDictField        dictField;
      #    FormControl         formControl = _form.selectedControl();
      #    FormStringControl   formStringControl;
      #    FormButtonControl   formButtonControl;
      #    SysDictEnum         dictEnum = new SysDictEnum(enumNum(Types));
      #    SysDictEnum         dictEnums;
      #    FormDataSource      formDataSource =  _form.objectSet();
      #    TreeNode node;
      #;
      #
      #    if(formControl && formDataSource)
      #    {
      #        node = element.controlByName(element.formByName(_form.name()), formControl.name());
      #        switch(SysFormRun::controlType(classIdGet(formControl)))
      #        {
      #            case FormControlType::CheckBox :
      #            case FormControlType::ComboBox :
      #            case FormControlType::Date :
      #            case FormControlType::Grid :
      #            case FormControlType::Group :
      #            case FormControlType::Integer :
      #            case FormControlType::RadioButton :
      #            case FormControlType::Real :
      #            case FormControlType::StaticText :
      #            case FormControlType::String :
      #            case FormControlType::Time :
      #                formStringControl = formControl;
      #                if(formStringControl.dataField() && formDataSource.table())
      #                {
      #                    info(strfmt("Control Name   -> %1", formStringControl.name()), '', new SysInfoAction_Properties(node.treeNodePath()));
      #                    dictField = new SysDictField(formDataSource.table(), fieldExt2Id(formStringControl.dataField()));
      #                    info(strfmt('Table.Field       -> %2.%1',
      #                        fieldId2Name(formDataSource.table(), fieldExt2Id(formStringControl.dataField())),
      #                        tableId2Name(formDataSource.table())), '',
      #                        dictField ?  new SysInfoAction_Properties(dictField.treeNode().treeNodePath()): null);
      #
      #                    if(dictField)
      #                    {
      #                        info(strfmt('Type                -> %1', dictEnum.index2Symbol(dictField.baseType())));
      #
      #                        if(dictField.baseType() == typeOf(Types::Enum))
      #                        {
      #                            dictEnums = new SysDictEnum(dictField.enumId());
      #                            info(strfmt('Base Enum       -> %1', dictEnums.name()));
      #                        }
      #
      #                        info(strfmt('Ext Data Type -> %1', extendedTypeId2name(dictField.typeId())));
      #                        info(strfmt('Size                  ->  %1', int2str(dictField.stringLen())));
      #                        info(strfmt('Max Right        -> %1', dictField.rights()));
      #                        info(strfmt('Label                -> %1:  %2', dictField.labelLabel(), dictField.label()));
      #                        info(strfmt('Help                 -> %1:  %2', dictField.helpLabelId(),dictField.help()));
      #                    }
      #                }
      #
      #                if(formStringControl.dataMethod())
      #                {
      #                    info(strfmt('Method %1.%2', tableId2Name(formDataSource.table()), formStringControl.dataMethod()));
      #                }
      #                break;
      #            }
      #        }
      #}
    ENDSOURCE
    SOURCE #AxPath_getDataAreaId
      #//+ Dcs 04.04.2007 СБРFI-200703_02 KC
      #DataAreaId AxPath_getDataAreaId(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int line;
      #    int pos;
      #    int i;
      #    str name;
      #    str value;
      #    DataAreaId DataAreaId;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='Area')
      #            DataAreaId = value;
      #    }
      #    return DataAreaId;
      #}
      #//- Dcs 04.04.2007 СБРFI-200703_02 KC
    ENDSOURCE
    SOURCE #fitAndRemember
      #void fitAndRemember(HWND _child)
      #{
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #;
      #    [fixedWidth, fixedHeight] = this.fitWindow(_child);
      #    if (fixedWidth || fixedHeight)
      #        fixedWindows.insert(_child, [fixedWidth, fixedHeight]);
      #
      #}
    ENDSOURCE
    SOURCE #GetMaxSize
      #container getMaxSize(HWnd _hwnd)
      #{
      #//typedef struct {
      #//    POINT ptReserved; 0 (x:0, y:4)
      #//    POINT ptMaxSize;  8 (x:8, y:12)
      #//    POINT ptMaxPosition; 16 (x:16, y:20)
      #//    POINT ptMinTrackSize; 24 (x:24, y:28)
      #//    POINT ptMaxTrackSize; 32 (x:32, y:36)
      #//} MINMAXINFO; 40
      #    Binary ret=new Binary(4*2*5);
      #    Binary ptr=new Binary(4);
      #    int msx;
      #    int msy;
      #    int mpx;
      #    int mpy;
      #    int mtx;
      #    int mty;
      #    int mxtx;
      #    int mxty;
      #;
      #    ptr.binary(0, ret);
      #
      #//        WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, 0, ptr.dWord(0));
      #    WinApi::sendMessageEx(_hwnd, #WM_GETMINMAXINFO,  0, ptr.dWord(0));
      #    msx = ret.dWord(8);
      #    msy = ret.dWord(12);
      #    mpx = ret.dWord(16);
      #    mpy = ret.dWord(20);
      #    mtx = ret.dWord(24);
      #    mty = ret.dWord(28);
      #    mxtx = ret.dWord(32);
      #    mxty = ret.dWord(36);
      #    return [ret.dWord(32), ret.dWord(36)];
      #}
    ENDSOURCE
    SOURCE #pathCombine
      #str pathCombine(str _path, str _part)
      #{
      #    return  _path + (this.strEndsWith(_path, '\\') ? '' : '\\') + _part;
      #}
    ENDSOURCE
    SOURCE #loadLanguageFile
      #void loadLanguageFile(str _fileName)
      #{
      #    AsciiIO io=new AsciiIO(_fileName, 'r');
      #    container data;
      #;
      #    if (!translations)
      #        translations=new Map(Types::String, Types::String);
      #    io.inFieldDelimiter('\r\n\r\n');
      #    io.inRecordDelimiter('\r\n---\r\n');
      #    data = io.read();
      #    while (data)
      #    {
      #        data = io.read();
      #        this.translate(conPeek(data, 1), conPeek(data, 2));
      #    }
      #}
    ENDSOURCE
    SOURCE #editConfiguration
      #void editConfiguration()
      #{
      #    boolean successful;
      #    Dialog d=new Dialog(#_('Tabax ')+v+#_(' preferences'));
      #    DialogField dialogMaxCaptionSize=d.addFieldValue(typeID(MaximumLength), maxCaptionSize,
      #        #_('Maximal caption size'));
      #    DialogField dialogFitMaximized=d.addFieldValue(typeID(NoYes), fitMaximized,
      #        #_('Fit maximized windows'), #_('Fit maximized windows to the client area'));
      #    DialogField dialogSameSize = d.addFieldValue(typeID(NoYes), sameTabSize, #_("Tabs have same size"));
      #    DialogField dialogMinTabSize = d.addFieldValue(typeID(Integer), minTabSize, #_("Minimal tab size"));
      #    DialogField dialogMaxTabSize = d.addFieldValue(typeID(Integer), maxTabSize, #_("Maximal tab size"));
      #    #fireEvent(beforeSetupDialog, (element, d))
      #    successful = d.run();
      #    if(successful)
      #    {
      #        maxCaptionSize = dialogMaxCaptionSize.value();
      #        fitMaximized = dialogFitMaximized.value();
      #        minTabSize = dialogMinTabSize.value();
      #        maxTabSize = dialogMaxTabSize.value();
      #        maxTabSize = max(0, maxTabSize);
      #        minTabSize = max(0, minTabSize);
      #        if (maxTabSize)
      #            minTabSize = min(minTabSize, maxTabSize);
      #        sameTabSize = dialogSameSize.value();
      #    }
      #    #fireEvent(afterSetupDialog, (element, d, successful))
      #}
    ENDSOURCE
    SOURCE #rememberOldWindow
      #void rememberOldWindow(Hwnd _hwnd)
      #{
      #;
      #    oldWindows.insert(_hwnd, [this.isIconic(_hwnd), this.getMdiClientRelativeRect(_hwnd)]);
      #}
    ENDSOURCE
    SOURCE #wasIconic
      #boolean wasIconic(HWnd _hwnd)
      #{
      #    boolean wasIconic;
      #    container oldPosition;
      #;
      #    if (oldWindows.exists(_hwnd))
      #    {
      #        [wasIconic, oldPosition] = oldWindows.lookup(_hwnd);
      #        return wasIconic;
      #    }
      #    return false;
      #}
    ENDSOURCE
    SOURCE #positionChanged
      #boolean positionChanged(HWnd _hwnd)
      #{
      #    boolean wasIconic;
      #    container oldPosition;
      #;
      #    if (oldWindows.exists(_hwnd))
      #    {
      #        [wasIconic, oldPosition] = oldWindows.lookup(_hwnd);
      #        return oldPosition!=this.getMdiClientRelativeRect(_hwnd);
      #    }
      #    return false;
      #}
    ENDSOURCE
    SOURCE #restoreNormalPosition
      #void restoreNormalPosition(Hwnd _hwnd)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #    container normal;
      #;
      #    if (normalPositions.exists(_hwnd))
      #    {
      #        normal = normalPositions.lookup(_hwnd);
      #        [x1, y1, x2, y2] = normal;
      #        element.prepareToSide(_hwnd);
      #        WinApi::setWindowPos(_hwnd, x1, y1, x2-x1+1, y2-y1+1);
      #    }
      #}
    ENDSOURCE
    SOURCE #rememberNormalPosition
      #void rememberNormalPosition(Hwnd _hwnd)
      #{
      #    container position;
      #;
      #    position = element.getMdiClientRelativeRect(_hwnd);
      #    normalPositions.insert(_hwnd, position);
      #}
    ENDSOURCE
    SOURCE #openIcon
      #boolean openIcon(int _handle)
      #{
      #    return openIconFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #loadDictionary
      #void loadDictionary()
      #{
      #    str lngFilePath;
      #;
      #    session = new Session();
      #    lngFilePath = this.getResourcePath('lang\\' + session.interfaceLanguage() + '.txt');
      #    if (lngFilePath)
      #        this.loadLanguageFile(lngFilePath);
      #}
    ENDSOURCE
    SOURCE #getText
      #str getText(str _s)
      #{
      #    return (translations && translations.exists(_s)) ? translations.lookup(_s) : _s;
      #}
    ENDSOURCE
    SOURCE #processMaximizations
      #void processMaximizations(HWnd _child)
      #{
      #    int idx;
      #    boolean wasIconic;
      #    container oldPosition;
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #    void deleteFromMaximized()
      #    {
      #    ;
      #        maximized.remove(_child);
      #        if (formIdentity.exists(_child))
      #        {
      #            idx = conFind(maximizedIdentities, formIdentity.lookup(_child));
      #            if (idx)
      #                maximizedIdentities = conDel(maximizedIdentities, idx, 1);
      #        }
      #    }
      #    if (this.isZoomed(_child))
      #    {
      #        if (maximized.in(_child) && !this.wasIconic(_child))
      #        {
      #            this.restoreNormalPosition(_child);
      #            deleteFromMaximized();
      #        }
      #        else
      #        {
      #            maximized.add(_child);
      #            if (formIdentity.exists(_child))
      #            {
      #                idx = conFind(maximizedIdentities, formIdentity.lookup(_child));
      #                if (!idx)
      #                    maximizedIdentities += formIdentity.lookup(_child);
      #                if (normalPositions.exists(_child))
      #                    identityNormalPositions.insert(formIdentity.lookup(_child), normalPositions.lookup(_child));
      #            }
      #            this.fitAndRemember(_child);
      #        }
      #    }
      #    else
      #    {
      #        if (maximized.in(_child))
      #        {
      #            if (!this.isIconic(_child))
      #            {
      #                if(this.positionChanged(_child))
      #                {
      #                    deleteFromMaximized();
      #                    this.rememberNormalPosition(_child);
      #                }
      #                else
      #                {
      #                    fixedWidth = false;
      #                    fixedHeight = false;
      #                    if (fixedWindows.exists(_child))
      #                    {
      #                        [fixedWidth, fixedHeight] = fixedWindows.lookup(_child);
      #                        this.fitWindow(_child, true, fixedWidth, fixedHeight);
      #                    }
      #                    else
      #                        this.fitAndRemember(_child);
      #                }
      #            }
      #            else
      #            {
      #                retoreIfRestored.add(_child);
      #                deleteFromMaximized();
      #            }
      #        }
      #        else
      #        {
      #            if (!this.isIconic(_child))
      #            {
      #                if (retoreIfRestored.in(_child))
      #                {
      #                    this.restoreNormalPosition(_child);
      #                    retoreIfRestored.remove(_child);
      #                }
      #                else
      #                {
      #                    this.rememberNormalPosition(_child);
      #                }
      #            }
      #        }
      #    }
      #    if (this.isIconic(_child))
      #        this.processIconic(_child);
      #    this.rememberOldWindow(_child);
      #}
      #
    ENDSOURCE
    SOURCE #processFormIdentity
      #void processFormIdentity()
      #{
      #    FormRun formRun;
      #;
      #    if (infolog.parmLastActivatedForm() && infolog.parmLastActivatedForm().object())
      #    {
      #        formRun = infolog.parmLastActivatedForm().object();
      #        if (formRun && formRun.args())
      #            formIdentity.insert(formRun.hWnd(), enum2str(formRun.args().menuItemType()) + ' ' + formRun.args().menuItemName() + ' ' + formRun.name());
      #    }
      #}
    ENDSOURCE
    SOURCE #getMdiClientRelativeRect
      #// returns rectangle relative to mdiClient
      #container getMdiClientRelativeRect(HWND _hwnd)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #;
      #    [x1, y1, x2, y2] = this.getWindowRect(_hwnd);
      #    [x1, y1] = WinApi::screenToClient(mdiClient, x1, y1);
      #    [x2, y2] = WinApi::screenToClient(mdiClient, x2, y2);
      #    return [x1, y1, x2, y2];
      #}
    ENDSOURCE
    SOURCE #processFormIdentity_closing
      #void processFormIdentity_closing(HWnd _hwnd)
      #{
      #    FormRun formRun;
      #;
      #    if (formIdentity.exists(_hwnd))
      #        formIdentity.remove(_hwnd);
      #}
    ENDSOURCE
    SOURCE #getEvent
      #Set getEvent(str _id)
      #{
      #    Set ret;
      #    if (!events)
      #        events = new Map(Types::String, Types::Class);
      #    if (events.exists(_id))
      #        ret = events.lookup(_id);
      #    else
      #    {
      #        ret = new Set(Types::Class);
      #        events.insert(_id, ret);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #processWindowAdd
      #void processWindowAdd(Hwnd _hwnd)
      #{
      #    int idx;
      #    str identity;
      #    if (formIdentity.exists(_hwnd))
      #    {
      #        idx = conFind(maximizedIdentities, formIdentity.lookup(_hwnd));
      #        if (idx)
      #        {
      #            //maximizedIdentities = conDel(maximizedIdentities, idx, 1);
      #            this.fitAndRemember(_hwnd);
      #            this.rememberOldWindow(_hwnd);
      #            maximized.add(_hwnd);
      #            identity = conPeek(maximizedIdentities, idx);
      #            if (identityNormalPositions.exists(identity))
      #                normalPositions.insert(_hwnd, identityNormalPositions.lookup(identity));
      #
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #translate
      #void translate(str _en, str _local)
      #{
      #    ;
      #    translations.insert(_en, _local);
      #}
    ENDSOURCE
    SOURCE #subscribe
      #void subscribe(str _eventID, Object _o)
      #{
      #    this.getEvent(_eventID).add(_o);
      #}
    ENDSOURCE
    SOURCE #autoheight
      #void autoHeight()
      #{
      #    int x,y,w,h;
      #    int xt,yt,wt,ht;
      #    int h2;
      #    ;
      #    [xt,yt,wt,ht]=element.getWindowRect(tabs.Hwnd());
      #    [x,y,w,h]=element.getWindowRect(this.Hwnd());
      #    //ht = tabs.heightValue();
      #//    this.moveWindow(this.resizeHwnd(),x,y,_value,h-5,true);
      #    ht -= heightDecrement;
      #    if (ht!=h)
      #    {
      #        WINAPI::setWindowPos(this.Hwnd(),0,0, w - x, ht - y, true,false,
      #            32 //#SWP_FRAMECHANGED
      #            +
      #            256 //#SWP_NOCOPYBITS
      #        );
      #    }
      #}
    ENDSOURCE
    SOURCE #confirm
      #boolean confirm(str _message)
      #{
      #    return Box::yesNo(_message,
      #                DialogButton::No, 'tabax') == DialogButton::Yes;
      #}
    ENDSOURCE
    SOURCE #isZoomed
      #boolean isZoomed(int _handle)
      #{
      #    return isZoomedFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #isAltButtonDown
      # // returns true if the shift button is pressed at the time of invocation
      ##define.VK_ALT(0x12)
      #static boolean isAltButtonDown()
      #{
      #    DLL         _winApiDLL      = new DLL('USER32');
      #    DLLFunction _getKeyState    = new DLLFunction(_winApiDLL, 'GetKeyState');
      #    int retval;
      #
      #    _getKeyState.returns(ExtTypes::Word);
      #    _getKeyState.arg(ExtTypes::DWord);
      #
      #    retval = _getKeyState.call(#VK_ALT);
      #
      #    return retval > 0x7FFF;
      #}
    ENDSOURCE
    SOURCE #license
      #str license()
      #{
      #    return #tabax_license;
      #}
    ENDSOURCE
    SOURCE #topmost
      #HWND topmost()
      #{
      #    return topmost;
      #}
    ENDSOURCE
    SOURCE #formByName
      #TreeNode formByName(str _name)
      #{
      #    return TreeNode::findNode(@'\Forms\'+_name);
      #}
    ENDSOURCE
    SOURCE #controlByName
      #/// returns control from form _form with the name _name
      #TreeNode controlByName(TreeNode _form, str _name)
      #{
      #    TreeNodeTraverser i = new TreeNodeTraverser(_form);
      #    TreeNode node = i.next();
      #    while (node)
      #    {
      #        if (match(@": +name: +#"+_name+': +', node.AOTgetProperties()))
      #            return node;
      #        node = i.next();
      #    }
      #    return null;
      #}
    ENDSOURCE
    SOURCE #tabIsSelected
      #boolean tabIsSelected(FormTabPageControl _page)
      #{
      #    return this.tabIndex(_page) ==
      #            WinApi::sendMessageEx(this.getParent(_page.hWnd()), #TCM_GETCURSEL, 0, 0);
      #}
    ENDSOURCE
    SOURCE #tabIndex
      #int tabIndex(FormTabPageControl tabPageControl)
      #{
      #    int hWnd;
      #    int i;
      #    int pos;
      #    str GetClassName(int _hWnd)
      #    {
      #        DLL         _Userdll        = new DLL("User32.dll");
      #        DLLFunction _getClassName   = new DLLFunction(_Userdll, "GetClassNameA");
      #        Binary      className       = new Binary(100);
      #        ;
      #        _getClassName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        _getClassName.returns(ExtTypes::DWord);
      #        if (_getClassName.call(_hWnd, className, 100))
      #            return className.string(0);
      #        else
      #            return "";
      #    }
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        pos = 0;
      #        hWnd = tabPageControl.hWnd();
      #        while (hWnd)
      #        {
      #            hWnd = winapi::getWindow(hWnd, #GW_HWNDPREV);
      #            if (hWnd && GetClassName(hWnd) == #PaneWindowCL)
      #                pos++;
      #        }
      #    }
      #    return pos;
      #}
    ENDSOURCE
    SOURCE #setTabSelected
      #int setTabSelected(FormTabPageControl _page)
      #{
      #    int ret = WinApi::sendMessageEx(this.getParent(_page.hWnd()), #TCM_SETCURSEL, this.tabIndex(_page), 0);
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #asserthasAccess
      #void assertHasAccess(SecurityKeyID _key, AccessType _type=AccessType::Edit, str _message='')
      #{
      #    DictSecurityKey key=new DictSecurityKey(_key);
      #    ;
      #    if (!hasSecuritykeyAccess(_key, _type))
      #        throw new error(
      #            _message ? _message :
      #            strFmt(
      #                element.getText('There is no access to "%1"'),
      #                key.label()
      #            )
      #         );
      #}
    ENDSOURCE
    SOURCE #assertDevelopment
      #void assertDevelopment()
      #{
      #;
      #    this.assertHasAccess(securityKeyNum(SysDevelopment));
      #}
    ENDSOURCE
    SOURCE #processEditBox
      #void processEditBox(str _s)
      #{
      #    TreeNode node = TreeNode::findNode(_s);
      #    boolean  skipDefault;
      #    str restOfString()
      #    {
      #        return subStr(_s, 2, strLen(_s)-1);
      #    }
      #;
      #    __eventHandlersEnumerator__                  = element.getEvent(identifierStr(beforeStringInput)).getEnumerator();
      #    while(__eventHandlersEnumerator__.moveNext() && !skipDefault)
      #        skipDefault                              = __eventHandlersEnumerator__.current().beforeStringInput(this, _s);
      #    if         (!skipDefault)
      #    {
      #        if     (node)
      #        {
      #            if (node.handle() == classNum(MemberFunction))
      #                node.AOTedit();
      #            else
      #                node.AOTnewWindow();
      #        }
      #        else   if (this.AxPath_accepts(_s))
      #            this.AxPath_go(_s);
      #        else   if (this.strStartsWith(_s, '?'))
      #            this.eval(restOfString());
      #        else   if (this.strStartsWith(_s, '!'))
      #            this.runScript(restOfString());
      #        //else
      #           //  this.axSearch(searchEd.text());
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_fromFormRun
      #str AxPath_fromFormRun(FormRun _form, Args _args = _form.args())
      #{
      #    str ret;
      #    SysDictEnum menuItemTypeEnum;
      #    RecID recID;
      #;
      #    if (!_args.caller())
      #    {
      #        menuItemTypeEnum = new SysDictEnum(enumNum(MenuItemType));
      #        ret = #AxPath_prefix + '://' + #AxPath_MenuItemName + '/' +
      #            menuItemTypeEnum.value2Symbol(_args.menuItemType())
      #            + '/' + _args.menuItemName();
      #
      #        ret += '?' + fieldStr(Common, dataAreaId) + '=' + curext(); // Dcs 04.04.2007 СБРFI-200703_02 KC
      #
      #        if (_form.dataSourceCount())
      #        {
      #            recID = _form.dataSource(1).cursor().RecId;
      #            if (recID)
      #                ret += '&' + this.AxPath_keyByCommon(_form.dataSource(1).cursor());
      #        }
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_getLineAndPos
      #container AxPath_getLineAndPos(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int line;
      #    int pos;
      #    int i;
      #    str name;
      #    str value;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='line')
      #            line=str2int(value);
      #        if (name=='pos')
      #            pos=str2int(value);
      #    }
      #    return [line, pos];
      #}
    ENDSOURCE
    SOURCE #menuItemTypeBySymbol
      #MenuItemType menuItemTypeBySymbol(str _symbol)
      #{
      #    return new SysDictEnum(enumNum(MenuItemType)).symbol2Value(_symbol);
      #}
    ENDSOURCE
    SOURCE #strStartsWith
      #boolean strStartsWith(str _s, str _possiblePrefix)
      #{
      #    return subStr(_s, 1, strLen(_possiblePrefix)) == _possiblePrefix;
      #}
    ENDSOURCE
    SOURCE #treeNode2TableID
      #TableID treeNode2TableID(TreeNode _node)
      #{
      #    TreeNode currentNode=_node;
      #    TableID ret;
      #    while (currentNode &&  !ret)
      #    {
      #        ret = SysTableBrowser::treeNode2TableId(currentNode);
      #        currentNode = currentNode.AOTparent();
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #currentSysContextMenu
      #SysContextMenu currentSysContextMenu()
      #{
      #    SysContextMenu ret;
      #    TreeNode node;
      #;
      #    if (this.isEditor(topmost))
      #        node = this.getCurMethod(topmost);
      #
      #    if (node)
      #        ret = new SysContextMenuTreeNode(node);
      #    else
      #        ret = new SysContextMenuAOT();
      #
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #strEndsWith
      #boolean strEndsWith(str _sourceText, str _possibleSuffix)
      #{
      #    return subStr(_sourceText, strLen(_sourceText), -strLen(_possibleSuffix)) == _possibleSuffix;
      #}
      #
    ENDSOURCE
    SOURCE #isEditor
      #boolean isEditor(HWND _hwnd)
      #{
      #    str name = winapi::getWindowText(_hWnd);
      #    int i;
      #;
      #    for(i=1; i<=conLen(editorSuffixes); i++)
      #        if (this.strEndsWith(name, conPeek(editorSuffixes, i)))
      #            return true;
      #    return false;
      #}
    ENDSOURCE
    SOURCE #urlEscape
      #str urlEscape(str _s)
      #{
      #    DLL             dll = new DLL("shlwapi.dll");
      #    DLLFunction     URLEscape = new DLLFunction(dll, "UrlEscapeA");
      #    Binary          escaped = new Binary(strlen(_s)+1);
      #    Binary          cnt = new Binary(4);
      #    #define.E_POINTER(0x80004003)
      #    ;
      #    URLEscape.arg(ExtTypes::String, ExtTypes::Pointer, ExtTypes::Pointer, ExtTypes::DWord);
      #    URLEscape.returns(ExtTypes::DWord);
      #    cnt.dWord(0, strlen(_s)+1);
      #    if (URLEscape.call(_s, escaped, cnt, 0) == #E_POINTER)
      #    {
      #        escaped = new Binary(cnt.dWord(0)+1);
      #        URLEscape.call(_s, escaped, cnt, 0);
      #    }
      #    return escaped.string(0);
      #}
    ENDSOURCE
    SOURCE #axSearch
      #void axSearch(str _text)
      #{
      #;
      #    WinApi::shellExecute(
      #    @'http://www.google.com/custom?cx=017570198198700603454%3A2g4miqgpmoe&q='
      #    +
      #    this.urlEscape(_text)
      #    +
      #    @'&cof=CX%3AAxSearch%3BFORID%3A0'
      #    );
      #}
    ENDSOURCE
    SOURCE #task
      #public int task(int _taskId)
      #{
      #    #task
      #    int ret;
      #
      #    if (_taskId != #taskEsc)
      #        ret = super(_taskId);
      #
      #    //if (_taskID==#taskEnter)
      #    //    this.processEditBox(searchEd.text());
      #
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #currentTable
      #tableID currentTable()
      #{
      #    #TreeNodeSysNodeType
      #    SysFormRun formRun;
      #    FormDataSource ds;
      #    TableID tableID;
      #    SysContextMenu context;
      #    TreeNode node;
      #;
      #    formRun=element.currentFormRun();
      #    if (!formRun)
      #        formRun=Infolog.setLastActivatedForm().object();
      #
      #    if(formRun && formRun.dataSourceCount()>0)
      #    {
      #        ds=formRun.objectSet();
      #        if (ds)
      #            tableID=ds.table();
      #    }
      #    if (!tableID)
      #    {
      #        context = this.currentSysContextMenu();
      #        if (context)
      #        {
      #            node = context.first();
      #            while (node && !tableID)
      #            {
      #                tableID = this.treeNode2TableID(node);
      #                if (tableID)
      #                    tableID = this.treeNode2TableID(node);
      #                node = context.next();
      #            }
      #        }
      #    }
      #    return tableID;
      #}
    ENDSOURCE
    SOURCE #installPlugs
      #void installPlugs()
      #{
      #    #File
      #    container parseName(str _s)
      #    {
      #        int pos=strscan(_s, '_', 1, strLen(_s));
      #        return [subStr(_s, 1, pos-1), subStr(_s, pos+1, strLen(_s) - pos)];
      #    }
      #
      #    void addButton(str _path, str _fileName)
      #    {
      #        str name = subStr(_fileName, 1, strLen(_fileName) - 4);
      #        FormFunctionButtonControl   button;
      #        str type;
      #        str itemName;
      #        ;
      #        [type, itemName] = parseName(name);
      #        //button = plugTools.addControl(FormControlType::MenuFunctionButton, name+'_button');
      #        if (type=='action')
      #            button.menuItemType(MenuItemType::Action);
      #
      #        if (type=='display')
      #            button.menuItemType(MenuItemType::Display);
      #
      #        if (type=='output')
      #            button.menuItemType(MenuItemType::Output);
      #
      #        button.menuItemName(itemName);
      #        button.buttonDisplay(FormButtonDisplay::ImageOnly);
      #        button.border(FormButtonBorder::Flat);
      #        button.backStyle(FormBackStyle::Transparent);
      #        button.normalImage(_path);
      #    }
      #    FileName fullFileName(FileName _path, FileName _fileName)
      #    {
      #        FileName    pathName;
      #        FileName    fileName;
      #        FileName    fileExtension;
      #        ;
      #        [pathName,fileName,fileExtension] = fileNameSplit(_fileName);
      #        return _path + '\\' + fileName + fileExtension;
      #    }
      #
      #    void findFiles(FileName _path, FileName _fileName)
      #    {
      #        FileName    fileName;
      #        int         hdl;
      #        ;
      #        if (WinAPI::folderExists(_path))
      #        {
      #            [hdl, fileName] = WinApi::findFirstFile(fullFileName(_path,_fileName));
      #            while (fileName)
      #            {
      #                if (WinAPI::fileExists(fullFileName(_path,fileName)))
      #                    addButton(fullFileName(_path, fileName), fileName);
      #                fileName = WinApi::findNextFile(hdl);
      #            }
      #            WinApi::findClose(hdl);
      #        }
      #    }
      #;
      #    findFiles(xInfo::directory(DirectoryType::Include)+'Tabax\\Plugs', '*.'+#imageExt);
      #}
    ENDSOURCE
    SOURCE #toStr
      #/// returns the string representation of given argument
      #str toStr(AnyType _value)
      #{
      #    Object o;
      #    int i;
      #    str ret;
      #;
      #    if(typeOf(_value)==Types::AnyType && !_value)
      #        return '<NoResult>';
      #    if(typeOf(_value)==Types::Class)
      #    {
      #        o=_value;
      #        return strFmt('%1', o.toString());
      #    }
      #    if(typeOf(_value)==Types::Container)
      #    {
      #        for(i=1;i<=conLen(_value);i++)
      #        {
      #            if(ret)
      #                ret+=", ";
      #            ret += this.toStr(conPeek(_value, i));
      #        }
      #        return "["+ret+"]";
      #    }
      #    if(typeOf(_value)==Types::String || typeOf(_value)==Types::VarString)
      #    {
      #        return strFmt("'%1'", _value);
      #    }
      #    return strFmt('%1', _value);
      #}
      #
    ENDSOURCE
    SOURCE #run
      #public void run()
      #{
      #    SysGlobalCache cache=infolog.globalCache();
      #    FormRun        formRun;
      #;
      #    cache.set(this.name(), 'instance', this);
      #    super();
      #    this.buildButtons();
      #    //this.play();
      #}
    ENDSOURCE
    SOURCE #isIconic
      #boolean isIconic(int _handle)
      #{
      #    return isIconicFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #runSysContextMenu
      #void runSysContextMenu(identifiername _menuItemName, MenuItemType _menuItemType, SysContextMenu _context = this.currentSysContextMenu())
      #{
      #    MenuFunction menuFunction;
      #    Args         args;
      #;
      #    if (_context)
      #    {
      #        args = new Args();
      #        if(_context.verifyItem(_menuItemName, _menuItemType))
      #        {
      #            menuFunction = new MenuFunction(_menuItemName, _menuItemType);
      #            args.parmObject(_context);
      #            args.caller(this);
      #            menuFunction.run(args);
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #truncHeader
      #str truncHeader(str _h)
      #{
      #    if (maxCaptionSize && (strlen (_h) > maxCaptionSize))
      #    {
      #        _h = strdel (_h, maxCaptionSize, strlen(_h));
      #        _h +=  "...";
      #    }
      #    return _h;
      #}
      #
    ENDSOURCE
    SOURCE #resize
      #public void resize(int _width, int _height)
      #{
      #    super(_width, _height);
      #    element.adjustTabPageSize(tabs);
      #}
    ENDSOURCE
    SOURCE #currentFormRun
      #FormRun currentFormRun()
      #{
      #    return currentFormRun ? currentFormRun.object() : null;
      #}
    ENDSOURCE
    SOURCE #loadImage
      #void loadImage(FormButtonControl _but, str _name)
      #{
      #    str imgDir=XInfo::directory(DirectoryType::Include);
      #    str subPath = _name+'.' + #imageExt;
      #    str imageFilePath = this.getResourcePath(subPath);
      #;
      #    if (!imageFilePath)
      #        warning("Tabax: Image not found: '" + this.fullInculdePath(subPath) + "' or resource '"+ this.resourceName(subPath)+"'");
      #    _but.normalImage(imageFilePath);
      #}
    ENDSOURCE
    SOURCE #isWindowVisible
      #boolean isWindowVisible(int _handle)
      #{
      #    return isWindowVisibleFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #moveWindow
      #boolean moveWindow(HWND _handle, int _x, int _y, int _w, int _h, boolean _repaint)
      #{
      #  boolean ret;
      #    DLL         _DLL             = new DLL('USER32');
      #    DLLFunction _setwPos         = new DLLFunction(_DLL, 'MoveWindow');
      #    int         _dllret;
      #    ;
      #    ret = FALSE;
      #
      #    _setwPos.returns(ExtTypes::DWord); // BOOL
      #    _setwPos.arg(ExtTypes::DWord);     // handle window
      #    _setwPos.arg(ExtTypes::DWord);     // x
      #    _setwPos.arg(ExtTypes::DWord);     // y
      #    _setwPos.arg(ExtTypes::DWord);     // cx
      #    _setwPos.arg(ExtTypes::DWord);     // cy
      #    _setwPos.arg(ExtTypes::DWord);     // repaint;
      #
      #    _dllRet = _setwPos.call(_handle,  _x, _y, _w, _h, _repaint);
      #
      #    return _dllRet?true:false;
      #}
    ENDSOURCE
    SOURCE #setWPos
      #int setWPos(
      #                           int              _handle,
      #                           int              _hWndInsertAfter,
      #                           int              _left,
      #                           int              _top,
      #                           int              _width,
      #                           int              _height,
      #                           int              _flags    = 0     )
      #
      #{
      #  boolean ret;
      #    DLL         _DLL             = new DLL('USER32');
      #    DLLFunction _setwPos         = new DLLFunction(_DLL, 'SetWindowPos');
      #    int         _dllret;
      #    ;
      #    ret = FALSE;
      #
      #    _setwPos.returns(ExtTypes::DWord); // BOOL
      #    _setwPos.arg(ExtTypes::DWord);     // handle window
      #    _setwPos.arg(ExtTypes::DWord);     // handle to Z Order window
      #    _setwPos.arg(ExtTypes::DWord);     // x
      #    _setwPos.arg(ExtTypes::DWord);     // y
      #    _setwPos.arg(ExtTypes::DWord);     // cx
      #    _setwPos.arg(ExtTypes::DWord);     // cy
      #    _setwPos.arg(ExtTypes::DWord);     // flags;
      #
      #    _dllRet = _setwPos.call(_handle, _hWndInsertAfter, _left, _top, _width, _height, _flags );
      #    if (_dllRet) {
      #        ret = TRUE;
      #    }
      #
      #  return ret;
      #}
    ENDSOURCE
    SOURCE #openedProjects
      #Map openedProjects()
      #{
      #    if(!openedProjects)
      #        openedProjects=new Map(Types::String, Types::Integer);
      #    return openedProjects;
      #}
    ENDSOURCE
    SOURCE #setCap
      #void setCap(str _txt)
      #{
      #    this.design().caption('tabax '+v+'\\'+_txt);
      #}
    ENDSOURCE
    SOURCE #fitWindow
      #container fitWindow(hwnd _w, boolean _skipPrepare = false, boolean _skipWidth = false, boolean _skipHeight=false)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #
      #    int wx1;
      #    int wy1;
      #    int wx2;
      #    int wy2;
      #    int maxw;
      #    int maxh;
      #    int w;
      #    int h;
      #    Binary msg = new Binary(30);
      #    int                 i;
      #    boolean ret;
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #;
      #    if (this.isIconic(_w))
      #        this.openIcon(_w);
      #
      #    if (!_skipPrepare)
      #    {
      #        this.prepareToSide(_w);
      #
      #        for (i=1;i<=4;i++)
      #           if (peekMessage.call(msg, 0, 0, 0, 1))
      #           {
      #               TranslateMessage.call(msg);
      #               dispatchMessage.call(msg);
      #           }
      #    }
      #
      #    [x1,y1,x2,y2]=element.getClientRect(MdiClient);
      #
      #    [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #    [maxw, maxh] = this.getMaxSize(_w);
      #    //w=min(x2-x1, maxw);
      #    //h=min(y2-y1, maxh);
      #    w=x2-x1;
      #    h=y2-y1;
      #    if (_skipWidth)
      #        w = wx2 - wx1;
      #    if (_skipHeight)
      #        h = wy2 - wy1;
      #    if ([wx1,wy1,wx2,wy2]!=[0, 0, w, h])
      #    {
      #        ret = WinApi::setWindowPos(_w, 0, 0, w, h, false, false, #SWP_NOACTIVATE);
      #        [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #
      #        for (i=1;i<=4;i++)
      #           if (peekMessage.call(msg, 0, 0, 0, 1))
      #           {
      #               TranslateMessage.call(msg);
      #               dispatchMessage.call(msg);
      #           }
      #        [x1,y1,x2,y2]=element.getClientRect(MdiClient);
      #        w=x2-x1;
      #        h=y2-y1;
      #        if (_skipWidth)
      #            w = wx2 - wx1 + 1;
      #        if (_skipHeight)
      #            h = wy2 - wy1 + 1;
      #
      #        ret = WinApi::setWindowPos(_w, 0, 0, w, h, false, false, #SWP_NOACTIVATE);
      #        [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #        fixedWidth = wx2 != (x2-x1);
      #        fixedHeight = wy2 != (y2-y1);
      #    }
      #    return [fixedWidth, fixedHeight];
      #}
    ENDSOURCE
    SOURCE #saveAll
      #void saveAll()
      #{
      #    ;
      #    xSysLastValue::saveLast(this);
      #}
    ENDSOURCE
    SOURCE #addMRUProject
      #void addMRUProject(str _name)
      #{
      #    int idx=conFind(mruProjects, _name);
      #    if(idx)
      #        mruProjects=conDel(mruProjects, idx, 1);
      #    mruProjects=[_name]+mruProjects;
      #}
    ENDSOURCE
    SOURCE #bottomSide
      #void bottomSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,(y2-y1)/2+1,x2-x1, (y2-y1)/2-2);
      #}
    ENDSOURCE
    SOURCE #topSide
      #void topSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,0,x2-x1, (y2-y1)/2);
      #}
    ENDSOURCE
    SOURCE #getParent
      #hwnd getParent(hwnd _window=this.hWnd())
      #{
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetParent');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord);
      #
      #    return fun.call(_window);
      #}
    ENDSOURCE
    SOURCE #lists_top
      #private List lists_top()
      #{
      #    return lists.value(lists_sp);
      #}
    ENDSOURCE
    SOURCE #newIterator
      #void newIterator(TreeNode _node)
      #{
      #    iterators=new Array(Types::Class);
      #    lists=new Array(Types::Class);
      #    tniterator=_node.AOTiterator();
      #}
    ENDSOURCE
    SOURCE #canClose
      #public boolean canClose()
      #{
      #//    if(!collapsed)
      #//    {
      #//        this.collapse();
      #//        return false;
      #//    }
      #    return true;
      #}
    ENDSOURCE
    SOURCE #prepareToSide
      #container prepareToSide(HWND _w)
      #{
      #    //hWnd MdiClient = WinAPI::FindWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #;
      #    WinAPI::sendMessageEx(_w, #WM_SYSCOMMAND, #SC_RESTORE, 0);
      #    return this.getClientRect(MdiClient);
      #}
    ENDSOURCE
    SOURCE #getClientRect
      #container getClientRect(hwnd _window)
      #{
      #    Binary      data            = new Binary(32);
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetClientRect');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #    fun.call(_window, data);
      #
      #    return [data.dWord(0), data.dWord(4), data.dWord(8), data.dWord(12)];
      #}
    ENDSOURCE
    SOURCE #leftSide
      #void leftSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,0,(x2-x1)/2, y2-y1);
      #}
    ENDSOURCE
    SOURCE #rightSide
      #void rightSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,(x2-x1)/2+1,0,(x2-x1)-((x2-x1)/2+1)-2, y2-y1);
      #}
    ENDSOURCE
    SOURCE #getWindowRect
      #container getWindowRect(hwnd _window)
      #{
      #    Binary      data            = new Binary(32);
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetWindowRect');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #    fun.call(_window, data);
      #
      #    return [data.dWord(0), data.dWord(4), data.dWord(8), data.dWord(12)];
      #}
    ENDSOURCE
    SOURCE #close
      #public void close()
      #{
      #    str name=this.name();
      #    SysGlobalCache cache=infolog.globalCache();
      #;
      #    #fireEvent(beforeClose, (this))
      #    cache.remove(name, 'instance');
      #   // this.pause();
      #    super();
      #    element.removeTabPageImageList(tabs);
      #    this.saveAll();
      #}
    ENDSOURCE
    SOURCE #applyChanges
      #void applyChanges()
      #{
      #    container          forRemove;
      #    container          forUpd;
      #    container          forAdd;
      #    FormDesign         fd = element.design();
      #    int                i;
      #    int                id;
      #                       // FormTreeItem item;
      #    HWnd               handle;
      #    int                image;
      #    str                title;
      #    FormTabPageControl itemHandle;
      #    FormTabPageControl activePage;
      #    int                selected;
      #    boolean            updated;
      #    boolean            historyChanged;
      #    str                windowText;
      #    int                tabsCount;
      #    ;
      #    [forRemove, forUpd, forAdd, selected]=this.changes();
      #    if(conLen(forRemove)>0 || conLen(forAdd)>0 || conLen(forUpd)>0)
      #    {
      #        //tabs.lockWindowUpdate(true);
      #        updated=true;
      #
      #        for(i=1;i<=conLen(forUpd);i++)
      #        {
      #            handle=conPeek(forUpd, i);
      #            itemHandle=windows.lookup(handle);
      #            windowText=WinApi::getWindowText(handle);
      #            [image, title]=this.getImageAndTitle(windowText);
      #            itemHandle.caption(element.truncHeader(title));
      #            itemHandle.helpText(title);
      #            titles.insert(handle, windowText);
      #            #fireEvent(afterWindowUpdated, (this, handle, title))
      #        }
      #
      #        //itemHandle=lastAdded;
      #        for(i=1;i<=conLen(forAdd);i++)
      #        {
      #            handle=conPeek(forAdd, i);
      #            windowText=WinApi::getWindowText(handle);
      #            [image, title]=this.getImageAndTitle(windowText);
      #            if(image==imgApp.image(#ImageProject))
      #            {
      #                this.addMRUProject(title);
      #                if(!this.openedProjects().exists(title))
      #                    this.openedProjects().insert(title, handle);
      #                historyChanged=true;
      #            }
      #            //item = new FormTreeItem(title,image,0, handle);
      #            //itemHandle=tree.addItem(0, itemHandle, item);
      #            itemHandle=tabs.addControl(FormControlType::TabPage, 't'+int2str(handle));
      #            #if.ax4
      #                itemHandle.scrollbars(false);
      #            #endif
      #            itemHandle.caption(element.truncHeader(title));
      #            itemHandle.helpText(title);
      #            itemHandle.verticalSpacing(0, AutoMode::Fixed);
      #            itemHandle.topMargin(0, AutoMode::Fixed);
      #            itemHandle.bottomMargin(0, AutoMode::Fixed);
      #            //itemHandle.
      #            //heightDecrement = itemHandle.topMargin() + itemHandle.bottomMargin() / 2;
      #            element.setTabPageImageIndex(itemHandle, image+1);
      #
      #            //itemHandle=tree.addItem(0, 0, item);
      #            //lastAdded=itemHandle;
      #            windows.insert(handle, itemHandle);
      #            titles.insert(handle, windowText);
      #            this.processWindowAdd(handle);
      #            #fireEvent(afterWindowOpened, (this, handle, title))
      #        }
      #        //tabs.lockWindowUpdate(false);
      #    }
      #    if(conLen(forRemove))
      #    {
      #        if(tabs.tabs())
      #        {
      #            inDeletion=true;
      #            itemHandle=tabs.controlNum(1);
      #            itemHandle.activatePage();
      #            inDeletion=false;
      #        }
      #    }
      #
      #    for(i=1;i<=conLen(forRemove);i++)
      #    {
      #        handle=conPeek(forRemove, i);
      #        itemHandle=windows.lookup(handle);
      #        tabsCount = tabs.controlCount();
      #        if (maximized.in(handle))
      #        {
      #//            if (formIdentity.exists(handle))
      #//                maximizedIdentities += formIdentity.lookup(handle);
      #            maximized.remove(handle);
      #        }
      #        this.processFormIdentity_closing(handle);
      #        if (oldWindows.exists(handle))
      #            oldWindows.remove(handle);
      #
      #        if (!itemHandle.isActivePage() || tabsCount==1)
      #        {
      #            windows.remove(handle);
      #            id = itemHandle.id();
      #            if (desktopWindow)
      #                this.apiLockWindowUpdate(desktopWindow);
      #            try
      #            {
      #                element.design().removeControl(id);
      #            }
      #            catch
      #            {
      #            }
      #            if (desktopWindow)
      #                this.apiLockWindowUpdate(0);
      #           titles.remove(handle);
      #        }
      #        if (fixedWindows.exists(handle))
      #            fixedWindows.remove(handle);
      #        #fireEvent(afterWindowClosed, (this, handle))
      #    }
      #    if(updated)
      #        element.adjustTabPageSize(tabs);
      #
      #    if(selected)
      #    {
      #        itemHandle=windows.lookup(selected);
      #        if(!this.tabIsSelected(itemHandle))
      #        {
      #            this.setTabSelected(itemHandle);
      #            itemHandle.activatePage();
      #            updated=true;
      #        }
      #    }
      #    //tabs.lockWindowUpdate(false);
      #    element.autoHeight();
      #}
    ENDSOURCE
    SOURCE #Changes
      #container changes()
      #{
      #    MapIterator i=new MapIterator(windows);
      #    container actual=this.getWindows();
      #    container existing;
      #    int j;
      #    container forRemove;
      #    container forUpd;
      #    container forAdd;
      #    hwnd selected;
      #    ;
      #    [selected]=actual;
      #    while(i.more())
      #    {
      #        if(conFind(actual, i.key()))
      #        {
      #            if(titles.lookup(i.key())!=WinApi::getWindowText(i.key()))
      #                forUpd+=i.key();
      #            existing+=i.key();
      #        }
      #        else
      #        {
      #            forRemove+=i.key();
      #        }
      #        i.next();
      #    }
      #
      #    for(j=1;j<=conLen(actual);j++)
      #    {
      #        if(!conFind(existing, conPeek(actual, j)))
      #            forAdd+=[conPeek(actual, j)];
      #    }
      #    return [forRemove, forUpd, forAdd, selected];
      #}
    ENDSOURCE
    SOURCE #getImageAndTitle
      #container getImageAndTitle(str _header)
      #{
      #    str path;
      #    int i, img;
      #    boolean startsWith(str _s1, str _s2){
      #        return strScan(_s1, _s2, 1, strLen(_s1))==1;
      #    }
      #    ;
      #    for(i=1;i<=conlen(this.pathes());i++)
      #    {
      #        [path, img]=conPeek(this.pathes(),i);
      #        if(startsWith(_header, path))
      #            return [imgApp.image(img),
      #                strDel(_header, 1, strLen(path))];
      #
      #        if (!path)
      #            switch (_header)
      #            {
      #                case "Репозитарий прикладных объектов":
      #                    return [imgApp.image(#ImageAOT), _header];
      #                case @"\Projects":
      #                    return [imgApp.image(#ImageProjects), _header];
      #            }
      #    }
      #
      #    return [0, _header];
      #}
    ENDSOURCE
    SOURCE #pathes
      #container pathes()
      #{
      #    if(!p)
      #        p=
      #        [
      #            ["\\Data Dictionary\\Tables\\", #imageTable],
      #            ["\\Data Dictionary\\Maps\\", #imageTableMap],
      #            ["\\Data Dictionary\\Views\\", #imageView],
      #            ["\\Data Dictionary\\Extended Data Types\\", #imageEDT],
      #            ["\\Data Dictionary\\Base Enums\\", #imageBaseEnum],
      #            #if.imageFeatureKey
      #            ["\\Data Dictionary\\Feature Keys\\", #imageFeatureKey],
      #            #endif
      #            ["\\Data Dictionary\\License Codes\\", #imageLicenseCode],
      #            ["\\Data Dictionary\\Configuration Keys\\", #imageConfigurationKeys],
      #            ["\\Data Dictionary\\Security Keys\\", #imageSecurityKeys],
      #            ["\\Data Dictionary\\Table Collections\\", #imageTableCollections],
      #            ["\\Macros\\", #imageMacros],
      #            ["\\Classes\\", #imageClass],
      #            ["\\Forms\\", #imageForm],
      #            ["\\Reports\\", #imageReport],
      #            ["\\Queries\\", #imageQuery],
      #            ["\\Jobs\\", #imageJob],
      #            ["\\Menus\\", #imageMenu],
      #            ["@SYS71148", #imageMenuMain],
      #            ["\\Menu Items\\Display\\", #ImageMenuDisplayItems],
      #            ["\\Menu Items\\Output\\", #imageMenuActionItems],
      #            ["\\Menu Items\\Action\\", #imageMenuOutputItems],
      #            ["\\System Documentation\\Classes\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Functions\\", #ImageDocumentationItemBlue],
      #            ["\\System Documentation\\Property\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Tables\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Types\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Enums\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Feature Keys\\", #ImageDocumentationItem],
      #            #if.ImageReference
      #            ["\\References\\", #ImageReference],
      #            #endif
      #            #if.imageHelpFile
      #            ["\\HTML Help Files\\", #imageHelpFile],
      #            #endif
      #            #localmacro.prefix
      #                [%1, #ImageProject],
      #            #endmacro
      #            #projectPrefixes
      #            ["", #ImagePlay]
      #        ];
      #    return p;
      #}
    ENDSOURCE
    SOURCE #getWindows
      #container getWindows()
      #{
      #    container ret;
      #    //hWnd MdiClient = WinAPI::FindWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #    hWnd child;
      #    str windowText;
      #    map     children = new map(Types::Integer, Types::String);
      #    int c;
      #    FormRun activeFormRun;
      #    boolean isActiveForm(HWnd _hwnd)
      #    {
      #        return _hwnd == WinApi::getForegroundWindow() || _hwnd == topmost;
      #    }
      #;
      #    topmost=0;
      #    second=0;
      #
      #    for (child = WinAPI::FindWindowEx(MdiClient, 0, '', '');
      #         child && !children.exists(child);
      #         child = WinAPI::FindWindowEx(MdiClient, child, '', ''))
      #    {
      #        if (Child != 0)
      #        {
      #            if (Children.exists(Child))
      #                break;
      #
      #            WindowText = WinAPI::getWindowText(child);
      #
      #            //if (WindowText != "" && isWindowVisible(child))
      #            if(this.isWindowVisible(child))
      #            {
      #                if (fitMaximized)
      #                    this.processMaximizations(child);
      #                if(!topmost)
      #                {
      #                    topmost=Child;
      #                    if(infolog.setLastActivatedForm())
      #                        activeFormRun=infolog.setLastActivatedForm().object();
      #                    //if(activeFormRun && activeFormRun.hWnd()==topmost)
      #                    if(activeFormRun && isActiveForm(activeFormRun.hWnd()))
      #                    {
      #                        currentFormRun=new ObjectIdent(activeFormRun);
      #                        currentFormRun_hwnd = topmost;
      #                    }
      #                    else
      #                    {
      #                        if(this.currentFormRun() && currentFormRun_hwnd!=topmost)
      #                        {
      #                            currentFormRun_hwnd = 0;
      #                            currentFormRun=null;
      #                        }
      #                    }
      #                }
      #                else
      #                    if(!second)
      #                        second=Child;
      #                children.insert(Child, WindowText);
      #                ret+=[Child];
      #            }
      #        }
      #
      #        c ++;
      #        if (c > 1000)
      #            throw error("deadlock interrupted");
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #BuildButtons
      #void buildButtons()
      #{
      #;
      #    this.processFormIdentity();
      #    this.applyChanges();
      #    #fireEvent(tick, (this))
      #    windowsScanTimer = this.setTimeOut(identifierStr(buildButtons), #windowsScanTimer);
      #}
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    str dummy;
      #    int i;
      #    int img;
      #;
      #    v=#v;
      #    super();
      #    this.attachPlugins();
      #    editorSuffixes = [
      #        ' - Редактор',
      #        ' - Editor'
      #    ];
      #    oldWindows = new Map(Types::Integer, Types::Container);
      #    fixedWindows = new Map(Types::Integer, Types::Container);
      #    //menuUsageStatistics=new Map(Types::String, Types::Container);
      #    maximized = new Set(Types::Integer);
      #    this.loadDictionary();
      #    normalPositions = new Map(Types::Integer, Types::Container);
      #    formIdentity = new Map(Types::Integer, Types::String);
      #    identityNormalPositions = new Map(Types::String, Types::Container);
      #    retoreIfRestored  = new Set(Types::Integer);
      #
      #    this.setCap('windows');
      #    //vtxt.text('sidax v'+v);
      #    /*aboutBut.border(
      #    tableBrowserBut.border(
      #    editBut.border(
      #    tileHorBut.border(
      #        tileVerBut.border(
      #        leftBut.border(
      #        rightBut.border(
      #        topBut.border(
      #        bottomBut.border(
      #                FormButtonBorder::Flat
      #            ))))))))); */
      #    this.installPlugs();
      #    hand=WinApi::loadStdCursor(#IDC_CROSS);
      #    //this.loadImages();
      #
      #    user32             = new DLL('USER32');
      #
      #    isIconicFun = new DLLFunction(user32, 'IsIconic');
      #    isIconicFun.returns(ExtTypes::DWord);
      #    isIconicFun.arg(ExtTypes::DWord);
      #
      #    isZoomedFun = new DLLFunction(user32, 'IsZoomed');
      #    isZoomedFun.returns(ExtTypes::DWord);
      #    isZoomedFun.arg(ExtTypes::DWord);
      #
      #
      #    isWindowVisibleFun = new DLLFunction(user32, 'IsWindowVisible');
      #    isWindowVisibleFun.returns(ExtTypes::DWord);
      #    isWindowVisibleFun.arg(ExtTypes::DWord);
      #
      #    OpenIconFun = new DLLFunction(user32, 'OpenIcon');
      #    OpenIconFun.returns(ExtTypes::DWord);
      #    OpenIconFun.arg(ExtTypes::DWord);
      #
      #   peekMessage     = new DLLFunction(user32, 'PeekMessageA');
      #   TranslateMessage= new DLLFunction(user32, 'TranslateMessage');
      #   dispatchMessage = new DLLFunction(user32, 'DispatchMessageA');
      #    peekMessage.arg(ExtTypes::POINTER, ExtTypes::DWORD, ExtTypes::DWORD, ExtTypes::DWORD, ExtTypes::DWORD);
      #    peekMessage.returns(ExtTypes::DWord);
      #
      #    TranslateMessage.arg(ExtTypes::Pointer);
      #    TranslateMessage.returns(ExtTypes::DWORD);
      #
      #    dispatchMessage.arg(ExtTypes::Pointer);
      #    dispatchMessage.returns(ExtTypes::DWord);
      #
      #    GetDesktopWindow = new DllFunction(user32, 'GetDesktopWindow');
      #    GetDesktopWindow.returns(ExtTypes::DWord);
      #
      #    LockWindowUpdate = new DllFunction(user32, 'LockWindowUpdate');
      #    LockWindowUpdate.returns(ExtTypes::DWord);
      #    LockWindowUpdate.arg(ExtTypes::DWord);
      #
      #    desktopWindow = this.GetDesktopWindow();
      #
      #    mdiClient = WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #
      #    imgApp = new ImageListAppl_AOT();
      #    for(i=1;i<=conlen(this.pathes());i++)
      #    {
      #        [dummy, img]=conPeek(this.pathes(), i);
      #        imgApp.add(img);
      #    }
      #    //Tree.setImagelist(imgApp.imageList());
      #    //Tree.setStateImagelist(imgApp.imageList());
      #    element.setTabPageImageList(Tabs, imgApp.imageList());
      #
      #    windows=new Map(Types::Integer, Types::Class);
      #    titles=new Map(Types::Integer, Types::String);
      #    xSysLastValue::getLast(this);
      #}
      #
    ENDSOURCE
    SOURCE #initParmDefault
      #/*MAN
      #This method is called when no SysLastValue record can be found in xSysLastValue.GetLast()
      #*/
      #public void initParmDefault()
      #{
      #;
      #}
    ENDSOURCE
    SOURCE #unpack
      #public boolean unpack(container packedClass)
      #{
      #    int version     = RunBase::getVersion(packedClass);
      #
      #    switch (version)
      #    {
      #        case 5:
      #            [version, #List5] = packedClass;
      #            return true;
      #        case 6:
      #            [version, #List6] = packedClass;
      #            return true;
      #        case 7:
      #            [version, #List7] = packedClass;
      #            return true;
      #        case #CurrentVersion:
      #            [version, #CurrentList] = packedClass;
      #            return true;
      #        default :
      #            return false;
      #    }
      #
      #    return false;
      #}
    ENDSOURCE
    SOURCE #getDesktopWindow
      #HWnd getDesktopWindow()
      #{
      #    return GetDesktopWindow.call();
      #}
    ENDSOURCE
    SOURCE #apiLockWindowUpdate
      #boolean apiLockWindowUpdate(HWND _hwnd)
      #{
      #    return LockWindowUpdate.call(_hwnd);
      #}
    ENDSOURCE
    SOURCE #pack
      #public container pack()
      #{
      #;
      #    return [#CurrentVersion, #CurrentList];
      #}
    ENDSOURCE
    SOURCE #lastValueDataAreaId
      #public dataAreaId lastValueDataAreaId()
      #{
      #    //TODO:return 'dat';
      #    return curExt();
      #}
    ENDSOURCE
    SOURCE #lastValueDesignName
      #public identifiername lastValueDesignName()
      #{
      #    return '';
      #}
    ENDSOURCE
    SOURCE #lastValueElementName
      #public identifiername lastValueElementName()
      #{
      #    return this.name();
      #}
    ENDSOURCE
    SOURCE #lastValueType
      #public UtilElementType lastValueType()
      #{
      #    return UtilElementType::Form;
      #}
    ENDSOURCE
    SOURCE #lastValueUserId
      #public userId lastValueUserId()
      #{
      #    return curUserId();
      #}
    ENDSOURCE
    SOURCE #pop
      #private TreeNodeIterator pop()
      #{
      #    TreeNodeIterator ret=iterators.value(sp);
      #    ;
      #    //iterators.value(sp, null);
      #    sp--;
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #lists_pop
      #private List lists_pop()
      #{
      #    List ret=lists.value(lists_sp);
      #    ;
      #    //lists.value(lists_sp, null);
      #    lists_sp--;
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #push
      #private void push(TreeNodeIterator _iterator)
      #{
      #    ;
      #    sp++;
      #    iterators.value(sp, _iterator);
      #}
    ENDSOURCE
    SOURCE #Lists_push
      #private void lists_push(List _list)
      #{
      #    ;
      #    lists_sp++;
      #    lists.value(lists_sp, _list);
      #}
    ENDSOURCE
    SOURCE #nextNode
      #private TreeNode nextNode()
      #{
      #    return tniterator.next();
      #}
    ENDSOURCE
    SOURCE #next
      #boolean next()
      #{
      #    current=this.nextNode();
      #    while(!current && this.hasIterators())
      #    {
      #        tniterator=this.pop();
      #        currentList=this.lists_pop();
      #        current=this.nextNode();
      #    }
      #    if(current)
      #    {
      #        this.push(tniterator);
      #        this.lists_push(currentList);
      #        currentList=new List(Types::Class);
      #        tniterator=current.AOTiterator();
      #    }
      #    return current? true:false;
      #}
    ENDSOURCE
    SOURCE #hasIterators
      #private boolean hasIterators()
      #{
      #    return sp ? true:false;
      #}
    ENDSOURCE
    SOURCE #AdjustTabPageSize
      ##winapi
      #void adjustTabPageSize(FormTabControl tabPageControl)
      #{
      #    Binary  rect = new Binary(16);
      #    Binary  ptr = new Binary(4);
      #    int     size;
      #    int     style;
      #    int     width;
      #    int     w;
      #    int maxWidth;
      #    int minWidth;
      #    int     i;
      #    int     cnt;
      #    int GetWindowRect(int hWnd, Binary lpRect)
      #    {
      #        DLL             _Userdll            = new DLL('User32.dll');
      #        DLLFunction     _getWindowRect      = new DLLFunction(_Userdll, 'GetWindowRect');
      #        ;
      #        _getWindowRect.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #        _getWindowRect.returns(ExtTypes::DWord);
      #        return _getWindowRect.call(hWnd, lpRect);
      #    }
      #    int setWindowLong(HWND _HWND, int _nIndex, int _dwNewLong)
      #    {
      #        DLL             _Userdll            = new DLL("User32.dll");
      #        DLLFunction     DLLFunction;
      #        ;
      #        DLLFunction = new DLLFunction(_Userdll,'SetWindowLongA');
      #        DLLFunction.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        DLLFunction.returns(ExtTypes::DWord);
      #
      #        return DLLFunction.call(_HWND, _nIndex, _dwNewLong);
      #    }
      #;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        ptr.binary(0, rect);
      #
      #        GetWindowRect(tabPageControl.hWnd() , rect);
      #        width = rect.dWord(8) - rect.dWord(0) - 4;
      #        cnt = 0;
      #        for (i=1;i<=tabPageControl.controlCount();i++)
      #            if (tabPageControl.controlNum(i).visible())
      #                cnt++;
      #        if (!cnt)
      #            cnt = 1;
      #
      #        WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, 0, ptr.dWord(0));
      #
      #        style = winapi::getWindowLong(tabPageControl.hWnd(), #GWL_STYLE);
      #        style = style & ~ #TCS_FIXEDWIDTH;
      #        style = style | #TCS_TOOLTIPS | #TCS_FORCELABELLEFT;
      #
      #        SetWindowLong(tabPageControl.hWnd(), #GWL_STYLE, style);
      #        cnt = WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMCOUNT, 0, size);
      #
      #        w = 0;
      #        for (i=0;i<cnt;i++)
      #        {
      #            winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, i, ptr.dWord(0));
      #            w += rect.dWord(8) - rect.dWord(0);
      #            maxWidth = max(maxWidth, rect.dWord(8) - rect.dWord(0));
      #            minWidth = min(minWidth, rect.dWord(8) - rect.dWord(0));
      #//            if (w > width)
      #//                break;
      #        }
      #
      #        cnt = max(1, cnt);
      #        size = width div cnt;
      #        if (maxTabSize)
      #            size=min(size, maxTabSize);
      #        if (minTabSize)
      #            size=max(size, minTabSize);
      #        if (sameTabSize && (maxTabSize * cnt)<=width)
      #            size = maxTabSize ? maxTabSize : min(maxWidth, w);
      #        size = min(size, width);
      #        size = (size & 0xffff) | ((rect.dWord(12) - rect.dWord(4)) << 16);
      #
      #        if (minTabSize)
      #            Winapi::SendMessageEx(tabPageControl.hWnd(), #TCM_SETMINTABWIDTH, 0, minTabSize);
      #        if (w > width || (maxTabSize && maxWidth > maxTabSize) || sameTabSize)
      #        {
      #            WinApi::SendMessageEx(tabPageControl.hWnd(), #TCM_SETITEMSIZE, 0, size);
      #
      #            style = style | #TCS_FIXEDWIDTH;
      #            SetWindowLong(tabPageControl.hWnd(), #GWL_STYLE, style);
      #        }
      #    }
      #}
      #
    ENDSOURCE
    SOURCE #HitTestTabPage
      #int hitTestTabPage(FormTabControl formTabControl)
      #{
      #    int cx, cy;
      #    Binary  TCHITTESTINFO = new Binary(12);
      #    Binary  ptr = new Binary(4);
      #    ;
      #    if (formTabControl && formTabControl.hWnd())
      #    {
      #        [cx, cy] = winapi::getCursorPos();
      #        [cx, cy] = winapi::screenToClient(FormTabControl.hWnd(), cx, cy);
      #        ptr.binary(0, TCHITTESTINFO);
      #        TCHITTESTINFO.dWord(0, cx);
      #        TCHITTESTINFO.dWord(4, cy);
      #        return winapi::sendMessageEx(FormTabControl.hWnd(), #TCM_HITTEST, 0, ptr.dWord(0)) + 1;
      #    }
      #    else return 0;
      #}
    ENDSOURCE
    SOURCE #RemoveTabPageImageList
      #void removeTabPageImageList(FormTabControl tabPageControl)
      #{
      #    int             hImageList;
      #    DLL             _dll                = new DLL("comctl32.dll");
      #    DLLFunction     ImageList_Destroy   = new DLLFunction(_dll, "ImageList_Destroy");
      #
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        hImageList = winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETIMAGELIST, 0, 0);
      #        if (hImageList)
      #        {
      #            winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_SETIMAGELIST, 0, 0);
      #
      #            ImageList_Destroy.arg(ExtTypes::DWord);
      #            ImageList_Destroy.returns(ExtTypes::DWord);
      #            ImageList_Destroy.call(hImageList);
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #SetTabPageImageIndex
      ##winapi
      #void setTabPageImageIndex(FormTabPageControl tabPageControl, int idx)
      #{
      #    int             hWnd;
      #    Binary          TCITEM;
      #    Binary          pointer;
      #    int             i, pos;
      #    int GetParent(int _hWnd)
      #    {
      #        DLL         _Userdll        = new DLL("User32.dll");
      #        DLLFunction _getParent      = new DLLFunction(_Userdll, "GetParent");
      #        ;
      #        _getParent.arg(ExtTypes::DWord);
      #        _getParent.returns(ExtTypes::DWord);
      #        return _getParent.call(_hWnd);
      #    }
      #
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        pos = 0;
      #        hWnd = tabPageControl.hWnd();
      #        while (hWnd)
      #        {
      #            hWnd = winapi::getWindow(hWnd, #GW_HWNDPREV);
      #            if (hWnd && element.WinApi_getClassName(hWnd) == #PaneWindowCL)
      #                pos++;
      #        }
      #
      #        TCITEM = new Binary(28);
      #        pointer = new Binary(4);
      #        pointer.binary(0, TCITEM);
      #        TCITEM.dWord(0, #TCIF_IMAGE);
      #        TCITEM.dWord(20, idx < 0 ? -1 : idx-1);
      #        winapi::sendMessageEx(GetParent(tabPageControl.hWnd()), #TCM_SETITEM, pos, pointer.dWord(0));
      #    }
      #}
    ENDSOURCE
    SOURCE #SetTabPageImageList
      #void setTabPageImageList(FormTabControl FormTabControl, ImageList imageList, int colorKey = winapi::rgb2int(134, 183, 115))
      #{
      #// colorKey - цвет, который будет заменен на цвет фона окна.
      #// Если в ваших иконках будет присутствовать цевет, предлагаемый по умолчанию,
      #// то подставьте при вызове метода любой другой, которого нет
      #
      #    DLL             _dll                = new DLL("comctl32.dll");
      #    DLL             _Userdll            = new DLL("User32.dll");
      #    DLL             _GDIdll             = new DLL("Gdi32.dll");
      #
      #
      #    DLLFunction     ImageList_Create        = new DLLFunction(_dll, "ImageList_Create");
      #    DLLFunction     ImageList_AddMasked     = new DLLFunction(_dll, "ImageList_AddMasked");
      #    DLLFunction     ImageList_Destroy       = new DLLFunction(_dll, "ImageList_Destroy");
      #
      #
      #    int             i, k;
      #    int             hImageList;
      #    int             hImageListOld;
      #    Image           image;
      #    int             wDC;
      #    int             newDC;
      #    int             hBitmap;
      #    int             hWnd;
      #    Binary          TCITEM;
      #    Binary          pointer;
      #
      #    int GetDC(int _hWnd)
      #    {
      #        DLLFunction     _getDC    = new DLLFunction(_Userdll, "GetDC");
      #        ;
      #        _getDC.arg(ExtTypes::DWord);
      #        _getDC.returns(ExtTypes::DWord);
      #        return _getDC.call(_hWnd);
      #    }
      #    int CreateCompatibleDC(int hdc)
      #    {
      #        DLLFunction     _createCompatibleDC    = new DLLFunction(_GDIdll, "CreateCompatibleDC");
      #        ;
      #        _createCompatibleDC.arg(ExtTypes::DWord);
      #        _createCompatibleDC.returns(ExtTypes::DWord);
      #        return _createCompatibleDC.call(hdc);
      #    }
      #    int CreateCompatibleBitmap(int hdc, int nWidth, int nHeight)
      #    {
      #        DLLFunction     _createCompatibleBitmap = new DLLFunction(_GDIdll, "CreateCompatibleBitmap");
      #        ;
      #        _createCompatibleBitmap.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        _createCompatibleBitmap.returns(ExtTypes::DWord);
      #        return _createCompatibleBitmap.call(hdc, nWidth, nHeight);
      #    }
      #    int SelectObject(int hdc, int hgdiobj)
      #    {
      #        DLLFunction     _selectObject = new DLLFunction(_GDIdll, "SelectObject");
      #        ;
      #        _selectObject.arg(ExtTypes::DWord, ExtTypes::DWord);
      #        _selectObject.returns(ExtTypes::DWord);
      #        return _selectObject.call(hdc, hgdiobj);
      #    }
      #    int DeleteObject(int hgdiobj)
      #    {
      #        DLLFunction     _deleteObject = new DLLFunction(_GDIdll, "DeleteObject");
      #        ;
      #        _deleteObject.arg(ExtTypes::DWord);
      #        _deleteObject.returns(ExtTypes::DWord);
      #        return _deleteObject.call(hgdiobj);
      #    }
      #    int DeleteDC(int hDc)
      #    {
      #        DLLFunction     _deleteDC = new DLLFunction(_GDIdll, "DeleteDC");
      #        ;
      #        _deleteDC.arg(ExtTypes::DWord);
      #        _deleteDC.returns(ExtTypes::DWord);
      #        return _deleteDC.call(hDc);
      #    }
      #    int FillRect(int hDC, container Rect, int hbr)
      #    {
      #        DLLFunction     _fillRect = new DLLFunction(_Userdll, "FillRect");
      #        Binary          _rect   = new Binary(16);
      #        ;
      #        _fillRect.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        _fillRect.returns(ExtTypes::DWord);
      #        _rect.dword(0, conpeek(Rect, 1));
      #        _rect.dword(4, conpeek(Rect, 2));
      #        _rect.dword(8, conpeek(Rect, 3));
      #        _rect.dword(12, conpeek(Rect, 4));
      #        return _fillRect.call(hDc, _rect, hbr);
      #    }
      #    int CreateSolidBrush(int _Color)
      #    {
      #        DLLFunction     _CreateSolidBrush = new DLLFunction(_GDIdll, "CreateSolidBrush");
      #        Binary           LOGBRUSH = new Binary(12);
      #        ;
      #        _CreateSolidBrush.arg(ExtTypes::DWord);
      #        _CreateSolidBrush.returns(ExtTypes::DWord);
      #        return _CreateSolidBrush.call(_Color);
      #    }
      #
      #    #define.ILC_COLOR(0x00000000)
      #    #define.ILC_COLOR24(0x00000018)
      #    #define.ILC_MASK(0x00000001)
      #    #define.TCM_FIRST(0x1300)
      #    #define.TCM_GETIMAGELIST(#TCM_FIRST + 2)
      #    #define.TCM_SETIMAGELIST(#TCM_FIRST + 3)
      #    #define.TCM_GETITEM(#TCM_FIRST + 5)
      #    #define.TCM_SETITEM(#TCM_FIRST + 6)
      #
      #    #define.TCIF_IMAGE(0x0002)
      #    ;
      #    if (formTabControl && formTabControl.hWnd() && imageList)
      #    {
      #        hWnd = formTabControl.hWnd();
      #        ImageList_Create.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        ImageList_Create.returns(ExtTypes::DWord);
      #        hImageList = ImageList_Create.call(imageList.width(), imageList.height(), #ILC_COLOR24 | #ILC_MASK, imageList.count(), 0);
      #
      #        ImageList_AddMasked.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        ImageList_AddMasked.returns(ExtTypes::DWord);
      #
      #        wDC = GetDC(0);
      #        newDC = CreateCompatibleDC(wDC);
      #        if (newDC)
      #        {
      #            hBitmap = CreateCompatibleBitmap(wDC, imageList.width()*imageList.count(), imageList.height());
      #            if (hBitmap && SelectObject(newDC, hBitmap))
      #            {
      #                i = CreateSolidBrush(colorKey);
      #                FillRect(newDC, [0, 0, imageList.width()*imageList.count(), imageList.height()], i);
      #                deleteObject(i);
      #
      #                for (i=0;i<imageList.count();i++)
      #                    imageList.draw(newDC, i, i * imageList.width(), 0, true);
      #
      #                DeleteDC(newDC);
      #
      #                ImageList_AddMasked.call(hImageList, hBitmap, colorKey);
      #                DeleteObject(hBitmap);
      #                hImageListOld = winapi::sendMessageEx(hWnd, #TCM_SETIMAGELIST, 0, hImageList);
      #                if (hImageListOld)
      #                {
      #                    ImageList_Destroy.arg(ExtTypes::DWord);
      #                    ImageList_Destroy.returns(ExtTypes::DWord);
      #                    ImageList_Destroy.call(hImageList);
      #                }
      #
      #                TCITEM = new Binary(28);
      #                pointer = new Binary(4);
      #                pointer.binary(0, TCITEM);
      #                TCITEM.dWord(0, #TCIF_IMAGE);
      #
      #                for (i = 0; i < min(formTabControl.controlCount(), imageList.count()); i++)
      #                {
      #                    TCITEM.dWord(20, i);
      #                    winapi::sendMessageEx(hWnd, #TCM_SETITEM, i, pointer.dWord(0));
      #                }
      #            }
      #            else
      #                DeleteDC(newDC);
      #        }
      #        //winapi::releaseDC(hWnd, wDC);
      #        winapi::releaseDC(0, wDC);
      #    }
      #}
    ENDSOURCE
    SOURCE #getCurMethod
      #/// Thanx to AndyD
      #TreeNode getCurMethod(HWND _editorHWnd)
      #{
      #    int hWnd = _editorHWnd;
      #    int hWndChild;
      #    str name = WinApi::getWindowText(_editorHWnd);
      #    int pos;
      #    boolean editor;
      #    str className;
      #    int childPos;
      #
      #
      #    int listView;
      #    int selectedItem;
      #    str itemName;
      #    str nodeName;
      #    int i;
      #    TreeNode fromMethods(TreeNode _parent, str _name)
      #    {
      #        TreeNode ret = _parent;
      #    ;
      #        if (ret)
      #            ret = ret.AOTfindChild('methods');
      #        if (ret)
      #            ret = ret.AOTfindChild(_name);
      #        return ret;
      #    }
      #    boolean pref(str _prefix, str _name)
      #    {
      #    ;
      #        _prefix = '\\'+_prefix+'\\';
      #        if (subStr(_name, 1, strLen(_prefix)) == _prefix)
      #        {
      #            nodeName = subStr(_name, strLen(_prefix) + 1, strLen(_name) - strLen(_prefix));
      #            return true;
      #        }
      #        return false;
      #    }
      #    #localmacro.pref
      #        pref(@'%1', _name)
      #    #endmacro
      #    TreeNode toTreeNode(str _name, str _methodName)
      #    {
      #        TreeNode parent = TreeNode::findNode(_name);
      #        str controlName;
      #        str controlMethodName;
      #        int delimiterPos;
      #        if (!parent)
      #            return null;
      #        if (#pref(Classes) || #pref(Jobs) || #pref(Macros))
      #            return parent.AOTfindChild(_methodName);
      #        if (#pref(Data Dictionary\Tables) || #pref(Data Dictionary\Maps) || #pref(Data Dictionary\Views))
      #            return fromMethods(parent, _methodName);
      #        if (#pref(Forms) || #pref(Reports))
      #        {
      #            delimiterPos = strFind(_methodName, ':', 1, strLen(_methodName));
      #            if (delimiterPos)
      #            {
      #                controlName = strRTrim(strLTrim(subStr(_methodName, 1, delimiterPos - 1)));
      #                controlMethodName = strRTrim(strLTrim(subStr(_methodName, delimiterPos + 1, strLen(_methodName) - delimiterPos)));
      #                return fromMethods(this.controlByName(parent, controlName), controlMethodName);
      #            }
      #            else
      #                return fromMethods(parent, _methodName);
      #        }
      #        return null;
      #    }
      #    str GetClassName(int _hWnd)
      #    {
      #        DLL             dll = new Dll("user32.dll");
      #        DLLFunction     getCalssName = new DLLFunction(dll, "GetClassNameA");
      #        Binary  classNamePtr = new Binary(256);
      #        ;
      #        getCalssName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        getCalssName.returns(ExtTypes::DWord);
      #        if (getCalssName.call(_hWnd, classNamePtr, 255))
      #            return classNamePtr.string(0);
      #        else
      #            return "";
      #    }
      #    #define.LVM_FIRST(0x1000)
      #    #define.LVM_GETNEXTITEM(#LVM_FIRST + 12)
      #    #define.LVM_GETITEMTEXT(#LVM_FIRST + 45)
      #
      #    #define.LVNI_SELECTED(0x0002)
      #
      #    str getItemText(int     _hWnd, int _item)
      #    {
      #        DLL         _winApiDLL      = new DLL('USER32');
      #        DLLFunction _sendMessage    = new DLLFunction(_winApiDLL, 'SendMessageA');
      #        Binary      LVItem = new Binary(52);
      #        Binary      itemText = new Binary(256);
      #        #define.LVIF_TEXT(0x0001)
      #        ;
      #        LVItem.dWord(0, #LVIF_TEXT); // mask
      #        LVItem.dWord(4, _item); // iItem
      #        LVItem.dWord(8, 0); // iSubItem
      #        LVItem.Binary(20, itemText); // pszText
      #        LVItem.dWord(24, 255); // cchTextMax
      #        _sendMessage.returns(ExtTypes::DWord);
      #        _sendMessage.arg(ExtTypes::DWord,
      #                         ExtTypes::DWord,
      #                         ExtTypes::DWord,
      #                         ExtTypes::Pointer);
      #
      #        return _sendMessage.call(_hWnd, #LVM_GETITEMTEXT, _item, LVItem) ? itemText.string(0) : '';
      #    }
      #
      #
      #    ;
      #    for(i=1; i<=conLen(editorSuffixes) &&  !pos; i++)
      #        if (this.strEndsWith(name, conPeek(editorSuffixes, i)))
      #            pos = strLen(name) - strLen(conPeek(editorSuffixes, i)) + 1;
      #
      #    name = subStr(name, 1, pos-1);
      #    editor = true;
      #    hWndChild = winapi::getWindow(hWnd, #GW_CHILD);
      #    childPos = 1;
      #    ListView = 0;
      #    while (hWndChild && _editorHWnd)
      #    {
      #        className = GetClassName(hWndChild);
      #        switch (childPos)
      #        {
      #            case 1:
      #                #if.ax3
      #                    editor = className == "MDImarginCL";
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxEdTabCtrl";
      #                #endif
      #                childPos++;
      #                break;
      #            case 2:
      #                #if.ax3
      #                    editor = className == "SysListView32";
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxListViewCtrl";
      #                #endif
      #                ListView = hWndChild;
      #                childPos++;
      #                break;
      #            case 3:
      #                #if.ax3
      #                    editor = className == #PaneWindowCL;
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxChidFrame";
      #                #endif
      #                childPos++;
      #                break;
      #            case 4:
      #                #if.ax4
      #                    editor = className == "AxPaneWnd";
      #                #endif
      #                #if.ax3
      #                    editor = className == "SysTabControl32";
      #                #endif
      #                childPos++;
      #                break;
      #            default:
      #                editor = false;
      #                break;
      #        }
      #        hWndChild = winapi::getWindow(hWndChild, #GW_HWNDNEXT);
      #    }
      #    if (editor && listView)
      #    {
      #        selectedItem = winapi::sendMessageEx(listView, #LVM_GETNEXTITEM, -1, #LVNI_SELECTED);
      #        if (selectedItem >= 0)
      #        {
      #            itemName = getItemText(ListView, selectedItem);
      #            if (itemName)
      #            {
      #                return toTreeNode(name, itemName);
      #            }
      #        }
      #    }
      #    return null;
      #}
    ENDSOURCE
    SOURCE #AxPath_goMenuItemForm
      #void AxPath_goMenuItemForm(MenuItemType _itemType, MenuItemName _itemName, str _extra)
      #{
      #    Args args=new Args();
      #    FormRun formRun ;
      #    Common record;
      #    TableID tableID;
      #;
      #    args.menuItemType(_itemType);
      #    args.menuItemName(_itemName);
      #    formRun = new MenuFunction(_itemName, _itemType).create(args);
      #    if (formRun)
      #    {
      #        formRun.run();
      #        if (formRun.dataSourceCount())
      #        {
      #            tableID = formRun.dataSource(1).cursor().TableId;
      #            record = this.AxPath_findCommon(tableID, this.AxPath_parseParams(_extra));
      #            if (record)
      #                formRun.dataSource(1).findRecord(record);
      #        }
      #        formRun.detach();
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_parseParams
      #container AxPath_parseParams(str _params)
      #{
      #    container ret;
      #    container pairs;
      #    int i;
      #;
      #    if (subStr(_params, 1, 1)=='?')
      #    {
      #        pairs = this.str2con(subStr(_params, 2, strLen(_params)-1) , '&');
      #        for(i=1; i<=conLen(pairs); i++)
      #            ret += [this.str2con(conPeek(pairs, i), '=')];
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_accepts
      #boolean AxPath_accepts(str _s)
      #{
      #    return this.urlGetPart(_s, 1)==#AxPath_prefix;
      #}
    ENDSOURCE
    SOURCE #AxPath_fromTreeNode
      #str AxPath_fromTreeNode(TreeNode _node)
      #{
      #    return #AxPath_prefix+'://'+#AxPath_AOTName+this.urlEscape(strReplace(_node.treeNodePath(), '\\', '/'));
      #}
    ENDSOURCE
    SOURCE #internetCrackUrl
      #container internetCrackUrl(str _url, boolean _decode=false, boolean _escape=false)
      #{
      #//    typedef struct {
      #//      DWORD dwStructSize; 0
      #//      LPTSTR lpszScheme;   4
      #//      DWORD dwSchemeLength; 8
      #//      INTERNET_SCHEME nScheme; 12
      #//      LPTSTR lpszHostName; 16
      #//      DWORD dwHostNameLength; 20
      #//      INTERNET_PORT nPort; 24
      #//      LPTSTR lpszUserName; 28
      #//      DWORD dwUserNameLength; 32
      #//      LPTSTR lpszPassword; 36
      #//      DWORD dwPasswordLength; 40
      #//      LPTSTR lpszUrlPath; 44
      #//      DWORD dwUrlPathLength; 48
      #//      LPTSTR lpszExtraInfo; 52
      #//      DWORD dwExtraInfoLength; 56
      #//    } URL_COMPONENTS, 60
      #//
      #//     *LPURL_COMPONENTS;
      #    int maxLen = strLen(_url)+1;
      #    DLL             dll = new DLL('wininet.dll');
      #    DLLFunction     function = new DLLFunction(dll, 'InternetCrackUrlA');
      #    Binary          result = new Binary(60);
      #    Binary          cnt = new Binary(4);
      #    int ret;
      #    #define.E_POINTER(0x80004003)
      #//      LPTSTR lpszScheme;   4
      #    Binary scheme = new Binary(maxLen);
      #//      LPTSTR lpszHostName; 24
      #    Binary hostName = new Binary(maxLen);
      #//      LPTSTR lpszUserName; 36
      #    Binary userName = new Binary(maxLen);
      #//      LPTSTR lpszPassword; 44
      #    Binary password = new Binary(maxLen);
      #//      LPTSTR lpszUrlPath; 52
      #    Binary urlPath = new Binary(maxLen);
      #//      LPTSTR lpszExtraInfo; 60
      #    Binary extraInfo = new Binary(maxLen);
      #;
      #//    BOOL InternetCrackUrl(
      #//      LPCTSTR lpszUrl,
      #//      DWORD dwUrlLength,
      #//      DWORD dwFlags,
      #//      LPURL_COMPONENTS lpUrlComponents
      #//    );
      #
      #
      #//      DWORD dwStructSize; 0
      #    result.dWord(0, 60);
      #//      LPTSTR lpszScheme;   4
      #    result.binary(4, scheme);
      #//      DWORD dwSchemeLength; 8
      #    result.dWord(8, maxLen);
      #//      INTERNET_SCHEME nScheme; 12
      #//      LPTSTR lpszHostName; 16
      #    result.binary(16, hostName);
      #//      DWORD dwHostNameLength; 20
      #    result.dWord(20, maxLen);
      #//      INTERNET_PORT nPort; 24
      #//      LPTSTR lpszUserName; 28
      #    result.binary(28, userName);
      #//      DWORD dwUserNameLength; 32
      #    result.dWord(32, maxLen);
      #//      LPTSTR lpszPassword; 36
      #    result.binary(36, password);
      #//      DWORD dwPasswordLength; 40
      #    result.dWord(40, maxLen);
      #//      LPTSTR lpszUrlPath; 44
      #    result.binary(44, urlPath);
      #//      DWORD dwUrlPathLength; 48
      #    result.dWord(48, maxLen);
      #//      LPTSTR lpszExtraInfo; 52
      #    result.binary(52, extraInfo);
      #//      DWORD dwExtraInfoLength; 56
      #    result.dWord(56, maxLen);
      #    function.arg(ExtTypes::String, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::Pointer);
      #    function.returns(ExtTypes::DWord);
      #    ret = function.call(_url, strlen(_url), (_decode ? 0x10000000 : 0) +  (_escape ? 0x080000000: 0), result);
      #    if (!ret)
      #        throw error(WinApi::formatMessage(WinApi::getLastError()));
      #    return [scheme.string(0), hostName.string(0), result.dWord(24), userName.string(0), password.string(0), urlPath.string(0), extrainfo.string(0)];
      #}
    ENDSOURCE
    SOURCE #str2con
      #container str2con(str _string, str _separator = ",")
      #{
      #    container   con;
      #    int         pos, oldPos = 1;
      #
      #    do
      #    {
      #        pos    =  strScan(_string, _separator, pos ? pos + strLen(_separator) : 1, strLen(_string));
      #        con    += subStr(_string, oldPos, pos ? pos - oldPos : strLen(_string) + 1 - oldPos);
      #        oldPos =  pos + strLen(_separator);
      #    }
      #    while (pos);
      #
      #    return con;
      #}
    ENDSOURCE
    SOURCE #urlGetPart
      #//URL_PART_HOSTNAME
      #//The host name.
      #//URL_PART_PASSWORD
      #//The password.
      #//URL_PART_PORT
      #//The port number.
      #//URL_PART_QUERY
      #//The query portion of the URL.
      #//URL_PART_SCHEME
      #//The URL scheme.
      #//URL_PART_USERNAME
      #//The username.
      #//URL_PART_NONE    = 0,
      #// URL_PART_SCHEME  = 1,
      #// URL_PART_HOSTNAME,
      #// URL_PART_USERNAME,
      #// URL_PART_PASSWORD,
      #// URL_PART_PORT,
      #// URL_PART_QUERY
      #//HRESULT UrlGetPart(
      #//    LPCTSTR pszIn,
      #//    LPTSTR pszOut,
      #//    LPDWORD pcchOut,
      #//    DWORD dwPart,
      #//    DWORD dwFlags
      #//);
      #str urlGetPart(str _in, int _part)
      #{
      #    DLL             dll = new DLL("shlwapi.dll");
      #    DLLFunction     function = new DLLFunction(dll, "UrlGetPartA");
      #    Binary          out = new Binary(strlen(_in)+1);
      #    Binary          cnt = new Binary(4);
      #    #define.E_POINTER(0x80004003)
      #    ;
      #    function.arg(
      #        //    LPCTSTR pszIn,
      #        ExtTypes::String,
      #        //    LPTSTR pszOut,
      #        ExtTypes::Pointer,
      #        //    LPDWORD pcchOut,
      #        ExtTypes::Pointer,
      #        //    DWORD dwPart,
      #        ExtTypes::DWord,
      #        //    DWORD dwFlags
      #        ExtTypes::DWord);
      #    function.returns(ExtTypes::DWord);
      #    cnt.dWord(0, strlen(_in)+1);
      #    function.call(_in, out, cnt, _part, 0);
      #    return out.string(0);
      #}
    ENDSOURCE
    SOURCE #AxPath_go
      #void AxPath_go(str _url)
      #{
      #    str scheme;
      #    str host;
      #    int port;
      #    str user;
      #    str password;
      #    str urlPath;
      #    str extra;
      #    TreeNode node;
      #    int line;
      #    int pos;
      #    container steps;
      #    MenuItemType itemType;
      #    MenuItemName itemName;
      #    //RecID recID;
      #    DataAreaId  dataAreaID  ;  // Dcs 04.04.2007 СБРFI-200703_02 KC
      #;
      #
      #    [scheme, host, port, user, password, urlPath, extra] = this.internetCrackUrl(_url, true);
      #    switch (host)
      #    {
      #        case #AxPath_AOTName:
      #            this.assertDevelopment();
      #            node = TreeNode::findNode(strReplace(urlPath, '/', '\\'));
      #            if (!node)
      #                throw error('Node not found');
      #            [line, pos] = this.AxPath_getLineAndPos(extra);
      #            if (node.handle() == classNum(MemberFunction) || node.handle() == classNum(Job) )
      #                node.AOTedit(line, pos);
      #            else
      #                node.AOTnewWindow();
      #
      #        break;
      #        case #AxPath_MenuItemName:
      #            steps = this.str2con(urlPath, '/');
      #            itemType = this.menuItemTypeBySymbol(conPeek(steps, 2));
      #            itemName = conPeek(steps, 3);
      #            //recID = this.AxPath_getRecID(extra);
      #            //+ Dcs 04.04.2007 СБРFI-200703_02 KC
      #            // orig
      #            // this.goMenuItemForm(itemType, itemName, recID );
      #
      #            dataAreaID = this.AxPath_getDataAreaId(extra);
      #            if(dataAreaID && curExt() != dataAreaID)
      #            {
      #                changeCompany (dataAreaID)
      #                {
      #                    this.AxPath_goMenuItemForm(itemType, itemName, extra);
      #                }
      #            }
      #            else
      #                this.AxPath_goMenuItemForm(itemType, itemName, extra);
      #            //- Dcs 04.04.2007 СБРFI-200703_02 KC
      #        break;
      #        default:
      #            throw error('Unknown host '+host);
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_getRecID
      #RecID AxPath_getRecID(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int i;
      #    str name;
      #    str value;
      #    RecID recID;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='recID')
      #           recID=#str2recID(value);
      #    }
      #    return recID;
      #}
    ENDSOURCE
    SOURCE #runIt
      #void runIt(str _src, boolean _doWrite=true)
      #{
      #    XPPCompiler comp=new XPPCompiler();
      #    ;
      #    if(comp.compile(_src))
      #        if (_doWrite)
      #            this.write(runBuf(_src, element));
      #        else
      #            runBuf(_src, element);
      #    else
      #        info(comp.errorText());
      #}
    ENDSOURCE
    SOURCE #eval
      #void eval(str _s)
      #{
      #    ;
      #    this.assertDevelopment();
      #    this.runIt('AnyType mainFun(Object tabax){return '+_s+";}");
      #}
    ENDSOURCE
    SOURCE #runScript
      #void runScript(str _s)
      #{
      #    ;
      #    this.assertDevelopment();
      #    this.runIt('AnyType mainFun(Object tabax){AnyType ret;  ' + _s + " return ret;}", false);
      #}
    ENDSOURCE
    SOURCE #write
      #/// Prints its arguments on calculator result pane
      #void write(AnyType _p1=0, AnyType _p2=0, AnyType _p3=0, AnyType _p4=0, AnyType _p5=0)
      #{
      #    str s; //=resultEd.text() ? "\n" : "";
      #;
      #    if(!prmIsDefault(_p1))
      #        s+=this.toStr(_p1);
      #    if(!prmIsDefault(_p2))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p2);
      #    }
      #    if(!prmIsDefault(_p3))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p3);
      #    }
      #    if(!prmIsDefault(_p4))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p4);
      #    }
      #    if(!prmIsDefault(_p5))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p5);
      #    }
      #    info(s);
      #}
    ENDSOURCE
    SOURCE #processIconic
      #void processIconic(HWnd _child)
      #{
      #    int x1; int y1;
      #    int x2; int y2;
      #    int dx; int dy;
      #;
      #    [x1, y1, x2, y2] = element.getMdiClientRelativeRect(_child);
      #    dx = max(0, -x1);
      #    dy = max(0, -y1);
      #    if (dx || dy)
      #    {
      #        x1 += dx; x2 +=dx;
      #        y1 += dy; y2 +=dy;
      #        WinApi::setWindowPos(_child, x1, y1, x2-x1+1, y2-y1+1, false, false, #SWP_NOACTIVATE);
      #    }
      #}
    ENDSOURCE
    SOURCE #attachPlugins
      #void attachPlugins()
      #{
      #    UtilElements ue;
      #    Object plugin;
      #;
      #    while select name from ue group by name
      #        where ue.recordType == UtilElementType::Class
      #              &&
      #              ue.name like 'TabaxPlugin_*'
      #    {
      #        plugin = new DictClass(className2ID(ue.name)).makeObject();
      #        plugin.tabax(element);
      #    }
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Top                 #Top edge
      Width               #Column width
      Height              #50
      Caption             #Tabax 0.1
      Frame               #None
      WindowResize        #Dynamic
      WindowType          #Workspace
      SaveSize            #Yes
      AllowDocking        #Yes
      TopMargin           #0
      BottomMargin        #0
      LeftMargin          #0
      RightMargin         #0
      Columnspace         #0
    ENDPROPERTIES
    CONTAINER
      CONTROL TAB
        PROPERTIES
          Name                #Tabs
          AutoDeclaration     #Yes
          Width               #Column width
          VerticalSpacing     #0
          TabLayout           #Tunnel
          Columns             #1
          Columnspace         #0
          HideIfEmpty         #No
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #beginDrag
            #public int beginDrag(int _x, int _y)
            #{
            #    int ret;
            #
            #    ret = super(_x, _y);
            #
            #    ret = element.hitTestTabPage(this);
            #
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #dragOver
            #public FormDrag dragOver(FormControl _dragSource, FormDrag _dragMode, int _x, int _y)
            #{
            #    FormDrag ret;
            #
            #    ret = super(_dragSource, _dragMode, _x, _y);
            #
            #    return FormDrag::Move;
            #}
          ENDSOURCE
          SOURCE #mouseDblClick
            #public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int                 ret;
            #    FormTabPageControl  page;
            #    int                 tabNo;
            #    HWND                hwnd;
            #    ;
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #
            #    tabNo = element.HitTestTabPage(this);
            #
            #    if(tabNo)
            #    {
            #        page = this.controlNum(tabNo);
            #        hwnd = this.pageToHwnd(page);
            #
            #        element.window_close(hwnd);
            #    }
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #pageToHwnd
            #HWND pageToHwnd(FormTabPageControl _page)
            #{
            #    HWnd hwnd;
            #    str hwndStr;
            #;
            #    if(_page)
            #    {
            #        hwndStr=_page.name();
            #        hwnd=str2int(subStr(hwndStr, 2, strLen(hwndStr)-1));
            #    }
            #    return hwnd;
            #}
          ENDSOURCE
          SOURCE #tabChanged
            #public void tabChanged(int _FromTab, int _ToTab)
            #{
            #
            #    FormTabPageControl page;
            #    HWND hwnd;
            #    super(_FromTab, _ToTab);
            #    if(!inDeletion)
            #    {
            #        page=this.controlNum(_ToTab);
            #        if(page)
            #        {
            #            hwnd = this.pageToHwnd(page);
            #            if (element.isIconic(hwnd))
            #                WinAPI::sendMessageEx(hwnd, #WM_SYSCOMMAND, #SC_RESTORE, 0);
            #            infolog.activateWindow(hwnd);
            #        }
            #    }
            #}
          ENDSOURCE
          SOURCE #toolTip
            #public str toolTip()
            #{
            #    int tabNo=element.hitTestTabPage(this);
            #    FormTabPageControl page=tabNo ? this.controlNum(tabNo) : null;
            #;
            #    return page ? page.helpText():'';
            #}
          ENDSOURCE
          SOURCE #closeAllExcept
            #void closeAllExcept(container _hwnds)
            #{
            #    MapIterator i=new MapIterator(windows);
            #    ;
            #    while(i.more())
            #    {
            #        if(!conFind(_hwnds, i.key()))
            #            element.window_close(i.key());
            #        i.next();
            #    }
            #}
          ENDSOURCE
          SOURCE #context
            #public void context()
            #{
            #    FormTabPageControl page;
            #    int tabNo;
            #    PopupMenu menu = new PopupMenu(this.hWnd());
            #    container winList;
            #    int close, toleft, toright, maximize, minimize, copy, totop, tobottom,
            #        fitWindow, sendBack;
            #    int closeAllExceptSelected;
            #    int selection;
            #    int i;
            #    str forCopy;
            #    TextBuffer buf=new TextBuffer();
            #    HWND hwnd;
            #;
            #    tabNo=element.HitTestTabPage(this);
            #    if(tabNo)
            #    {
            #        page=this.controlNum(tabNo);
            #        close = menu.insertItem(#_("Close (doubleclick tab to close)"));
            #        closeAllExceptSelected = menu.insertItem(#_("Close all except selected"));
            #        menu.insertBreak();
            #        fitWindow=menu.insertItem(#_("Fit window"));
            #        toleft=menu.insertItem(#_("To left"));
            #        toright=menu.insertItem(#_("To right"));
            #        totop=menu.insertItem(#_("To top"));
            #        tobottom=menu.insertItem(#_("To bottom"));
            #        maximize=menu.insertItem(#_("Maximize"));
            #        minimize=menu.insertItem(#_("Minimize"));
            #        sendBack=menu.insertItem(#_("Send to back"));
            #        menu.insertBreak();
            #        copy=menu.insertItem(#_("copy title"));
            #        selection = menu.draw();
            #        hwnd=this.pageToHwnd(page);
            #        if(selection!=closeAllExceptSelected)
            #        {
            #                switch (selection)
            #                {
            #                    case close:
            #                        element.window_close(hwnd);
            #                    break;
            #                    case toLeft:
            #                        element.leftSide(hwnd);
            #                    break;
            #                    case toRight:
            #                        element.rightSide(hwnd);
            #                    break;
            #                    case toTop:
            #                        element.topSide(hwnd);
            #                    break;
            #                    case toBottom:
            #                        element.bottomSide(hwnd);
            #                    break;
            #                    case maximize:
            #                        WinAPI::maximizeWindow(hwnd);
            #                    break;
            #                    case minimize:
            #                        WinAPI::minimizeWindow(hwnd);
            #                    break;
            #                    case fitWindow:
            #                        element.fitWindow(hwnd);
            #                    break;
            #                    case sendBack:
            #                        element.setWPos(hwnd,
            #                            1, //#HWND_BOTTOM,
            #                            0,0,0,0,#SWP_NOMOVE + #SWP_NOSIZE);
            #                    break;
            #                    case copy:
            #                        if(forCopy)
            #                            forCopy+="\r\n";
            #                        forCopy+=page.helpText();
            #                    break;
            #                }
            #            if(selection==copy)
            #            {
            #                buf.setText(forCopy);
            #                buf.toClipboard();
            #            }
            #        }
            #        else
            #        {
            #            if (element.confirm(strFmt(element.getText('Close all windows except "%1"'), WinApi::getWindowText(hwnd))))
            #                this.closeAllExcept([hwnd]);
            #        }
            #    }
            #    else
            #        super();
            #}
          ENDSOURCE
          SOURCE #mouseDown
            #public int mouseDown(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int ret;
            #    int i;
            #    int hwnd;
            #
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #    //this.mouseUp(_x, _y, _button, _Ctrl, _Shift);
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #mouseUp
            #public int mouseUp(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int ret;
            #    int i;
            #    int hwnd;
            #
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #//    if(_Shift||_Ctrl)
            #//        return ret;
            #//    if(_button==1)
            #//    {
            #//        i=Tree.getFirstSelected();
            #//        while(i)
            #//        {
            #//            hwnd=tree.getItem(i).data();
            #//            infolog.activateWindow(hWnd);
            #//            i=Tree.getNextSelected(i);
            #//        }
            #//    }
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
        CONTAINER
        ENDCONTAINER
      ENDCONTROL
      CONTROL MENUBUTTON
        PROPERTIES
          Name                #MenuButton
          AutoDeclaration     #Yes
          Left                #Right edge
          Width               #15
          NormalResource      #3400
          Border              #Flat
          ShowShortCut        #No
          MultiSelect         #Yes
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #toolTip
            #public str toolTip()
            #{
            #    return "Toolbar Menus";
            #}
          ENDSOURCE
          SOURCE #showContextMenu
            #public int showContextMenu(int _menuHandle)
            #{
            #    int ret;
            #
            #    ret = super(_menuHandle);
            #
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
        CONTAINER
          CONTROL BUTTON
            PROPERTIES
              Name                #Close
              Text                #Close toolbar
              ButtonDisplay       #Text & Image left
              NormalResource      #7671
              DisabledResource    #7671
              Border              #Flat
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #clicked
                #void clicked()
                #{
                #    ;
                #    if (element.confirm(#_('Really wanna close Tabax?')))
                #        element.close();
                #        MenuButton.showContextMenu(this.handle());
                #}
              ENDSOURCE
              SOURCE #toolTip
                #public str toolTip()
                #{
                #  return #_('Close tabax');
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
          CONTROL BUTTON
            PROPERTIES
              Name                #newProject
              Text                #Create New Project
              ButtonDisplay       #Text & Image left
              NormalResource      #1090
              DisabledResource    #1090
              Border              #Flat
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #toolTip
                #public str toolTip()
                #{
                #    return #_('Create New Project');
                #}
              ENDSOURCE
              SOURCE #clicked
                #void clicked()
                #{
                #    Args    args;
                #    ;
                #
                #    args = new Args();
                #    new MenuFunction(menuitemactionstr("MF_CreateNewProject"),MenuItemType::Action).run(args);
                #
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
          CONTROL BUTTON
            PROPERTIES
              Name                #CopyFields
              Text                #Copy Fields To Clipboard
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #clicked
                #void clicked()
                #{
                #    Args args;
                #    ;
                #    super();
                #    args = new Args();
                #    new MenuFunction(menuitemactionstr("MF_CopyFieldsToClipboard"),MenuItemType::Action).run(args);
                #
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
        ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_QueryBrowser
  PROPERTIES
    Name                #MF_QueryBrowser
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      #// Created by GRR for QueryBrowser on 28.10.2007
      #public class FormRun extends ObjectRun
      #{
      #    Query                   query;
      #    container               cGrayFields;
      #
      #    FormStringControl       stringEditQuery,
      #                            stringEditXML;
      #
      #    FormGroupControl        _ctrlSplitVertical;
      #    SysFormSplitter_Y       _formSplitterVertical;
      #
      #    FormGroupControl        _ctrlGroupSQl;
      #
      #    FormStaticTextControl   fieldNameText;
      #}
    ENDSOURCE
    SOURCE #linkDS
      #void linkDS()
      #{
      #    int     i;
      #    int     dsCnt = query.dataSourceCount();
      #
      #    void joinDS(int _parentDS, int _childDS, int _joinMode, int _fetchMode)
      #    {
      #        FormDataSource      datasource;
      #        FormLinkType        linkType;
      #        ;
      #        datasource = element.dataSource(_childDS);
      #        datasource.joinSource(element.dataSource(_parentDS).id());
      #
      #        switch(_joinMode)
      #        {
      #            case JoinMode::InnerJoin :
      #                linkType = FormLinkType::InnerJoin;
      #            break;
      #
      #            case JoinMode::OuterJoin :
      #                linkType = FormLinkType::OuterJoin;
      #            break;
      #
      #            case JoinMode::ExistsJoin :
      #                linkType = FormLinkType::ExistJoin;
      #            break;
      #
      #            case JoinMode::NoExistsJoin :
      #                linkType = FormLinkType::NotExistJoin;
      #            break;
      #        }
      #        datasource.linktype(linkType);
      #        datasource.onlyFetchActive(_fetchMode);
      #    }
      #    ;
      #
      #    for (i=2; i<=dsCnt; i++)
      #        joinDS(query.dataSourceNo(i).parentDataSource().id(), i, query.dataSourceNo(i).joinMode(), query.dataSourceNo(i).fetchMode());
      #}
    ENDSOURCE
    SOURCE #parmGrayFields
      #container parmGrayFields(container _cGrayFields = cGrayFields)
      #{
      #    ;
      #    cGrayFields = _cGrayFields;
      #
      #    return cGrayFields;
      #}
    ENDSOURCE
    SOURCE #RunTimeControl_gotFocus
      #public void RunTimeControl_gotFocus()
      #{
      #    FormControl     formControl = element.controlCallingMethod();
      #    ;
      #    formControl.gotFocus();
      #    fieldNameText.text(formControl.helpText());
      #
      #    return;
      #}
    ENDSOURCE
    SOURCE #run
      #public void run()
      #{
      #    ;
      #    if(query)
      #    {
      #        element.doQuery();
      #        element.linkDS();
      #
      #        stringEditQuery.text(query.dataSourceNo(1).toString());
      #        stringEditXML.text  (query.xml());
      #    }
      #
      #    super();
      #}
    ENDSOURCE
    SOURCE #doQuery
      #void doQuery()
      #{
      #    if(query)
      #    {
      #        ds_ds.query(query);
      #        ds_ds.executeQuery();
      #    }
      #}
    ENDSOURCE
    SOURCE #parmQuery
      #Query parmQuery(Query _query = query)
      #{
      #    ;
      #    query = _query;
      #
      #    return query;
      #}
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    super();
      #    this.controlMethodOverload(TRUE);
      #
      #    stringEditQuery    = element.control(control::StringEditQueryStr);
      #    stringEditXML      = element.control(control::StringEditXMLStr);
      #
      #    fieldNameText      = element.control(control::StaticTextFieldName);
      #    _ctrlSplitVertical = element.control(control::ctrlSplitVertical);
      #    _ctrlGroupSQL      = element.control(control::GroupSQL);
      #
      #    _formSplitterVertical   = new SysFormSplitter_Y(_ctrlSplitVertical, _ctrlGroupSQL, this);
      #    _ctrlSplitVertical.left(0);
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
    DATASOURCE
      OBJECTPOOL
        PROPERTIES
          Name                #ds
          Table               #Common
          AllowEdit           #No
          AllowCreate         #No
          AllowDelete         #No
          InsertIfEmpty       #No
        ENDPROPERTIES
        FIELDLIST
        ENDFIELDLIST
      ENDOBJECTPOOL
      METHODS
        Version: 3
        SOURCE #displayOption
          #public void displayOption(Common _common, FormRowDisplayOption _options)
          #{
          #    int     len, i;
          #    ;
          #
          #    len = conLen(cGrayFields);
          #    if(len)
          #    {
          #        _options.backColor(winapi::RGB2int(192, 192, 192));
          #        for (i=1; i<=len; i++)
          #            _options.affectedElementsByControl(conpeek(cGrayFields, i));
          #    }
          #
          #    super(_common, _options);
          #}
        ENDSOURCE
        SOURCE #init
          #public void init()
          #{
          #    if(query)
          #        this.query(query);
          #
          #    super();
          #}
        ENDSOURCE
      ENDMETHODS
    ENDDATASOURCE
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Caption             #Analyzer
      TopMargin           #0
      BottomMargin        #0
      LeftMargin          #0
      RightMargin         #0
    ENDPROPERTIES
    CONTAINER
      CONTROL GROUP
        PROPERTIES
          Name                #GroupSQL
          Width               #Column width
          Height              #Column height
          VerticalSpacing     #0
          FrameType           #None
          TopMargin           #0
          BottomMargin        #0
          LeftMargin          #0
          RightMargin         #0
        ENDPROPERTIES
          CONTAINER
            CONTROL STATICTEXT
              PROPERTIES
                Name                #StaticTextFieldName
                Visible             #No
                Text                #
              ENDPROPERTIES
            ENDCONTROL
            CONTROL TAB
              PROPERTIES
                Name                #Tab
                Width               #Column width
                Height              #Column height
                VerticalSpacing     #0
              ENDPROPERTIES
              CONTAINER
                CONTROL TABPAGE
                  PROPERTIES
                    Name                #TabPageSQL
                    Width               #Column width
                    Height              #Column height
                    VerticalSpacing     #0
                    HelpText            #@SYS57539
                    Caption             #@SYS57539
                    TopMargin           #0
                    BottomMargin        #0
                    LeftMargin          #0
                    RightMargin         #0
                  ENDPROPERTIES
                  CONTAINER
                    CONTROL STRINGEDIT
                      PROPERTIES
                        Name                #StringEditQueryStr
                        AllowEdit           #No
                        Width               #Column width
                        Height              #Column height
                        VerticalSpacing     #0
                        HelpText            #@SYS57539
                        MultiLine           #Yes
                        Font                #Courier New
                        FontSize            #9
                        Bold                #Normal
                        ShowLabel           #No
                        LabelAlignment      #Right
                      ENDPROPERTIES
                    ENDCONTROL
                  ENDCONTAINER
                ENDCONTROL
                CONTROL TABPAGE
                  PROPERTIES
                    Name                #TabPageXML
                    Top                 #Top edge
                    Width               #Column width
                    VerticalSpacing     #0
                    HelpText            #XML
                    Caption             #XML
                    TopMargin           #0
                    BottomMargin        #0
                    LeftMargin          #0
                    RightMargin         #0
                  ENDPROPERTIES
                  CONTAINER
                    CONTROL STRINGEDIT
                      PROPERTIES
                        Name                #StringEditXMLStr
                        AllowEdit           #No
                        Width               #Column width
                        Height              #Column height
                        VerticalSpacing     #0
                        HelpText            #XML
                        MultiLine           #Yes
                        Font                #Courier New
                        FontSize            #9
                        Bold                #Normal
                        ShowLabel           #No
                        LabelAlignment      #Right
                      ENDPROPERTIES
                    ENDCONTROL
                    CONTROL BUTTON
                      PROPERTIES
                        Name                #ButtonXML
                        VerticalSpacing     #0
                        HelpText            #XML
                        Text                #XML
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #clicked
                          #void clicked()
                          #{
                          #    TextBuffer  buf      = new TextBuffer();
                          #    str         fileName =  WinApi::getTempPath() + 'query.xml';
                          #    ;
                          #
                          #    super();
                          #
                          #    buf.setText(query.xml());
                          #    buf.ToFile(fileName);
                          #    WinApi::shellExecute(fileName);
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                  ENDCONTAINER
                ENDCONTROL
              ENDCONTAINER
            ENDCONTROL
          ENDCONTAINER
      ENDCONTROL
      CONTROL GROUP
        PROPERTIES
          Name                #CtrlSplitVertical
          Width               #Column width
          Height              #5
          VerticalSpacing     #0
          AlignControl        #Yes
          FrameType           #Raised 3D
          BackgroundColor     #Window background
          TopMargin           #0
          BottomMargin        #0
          LeftMargin          #0
          RightMargin         #0
          HideIfEmpty         #No
          AlignChild          #No
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #mouseDown
            #int mouseDown(int x, int y, int button, Boolean Ctrl, Boolean Shift)
            #{
            #    int ret;
            #
            #    ret = super(x, y, button, Ctrl, Shift);
            #
            #    Return _formSplitterVertical.mouseDown(x, y, button, Ctrl, Shift);
            #}
          ENDSOURCE
          SOURCE #mouseMove
            #int mouseMove(int x, int y, int button, Boolean Ctrl, Boolean Shift)
            #{
            #    int ret;
            #
            #    ret = super(x, y, button, Ctrl, Shift);
            #
            #    Return _formSplitterVertical.mouseMove(x,y,button,ctrl,shift);
            #}
          ENDSOURCE
          SOURCE #mouseUp
            #int mouseUp(int x, int y, int button, Boolean Ctrl, Boolean Shift)
            #{
            #    int ret;
            #
            #    ret = super(x, y, button, Ctrl, Shift);
            #
            #    Return _formSplitterVertical.mouseUp(x, y, button, Ctrl, Shift);
            #}
          ENDSOURCE
        ENDMETHODS
          CONTAINER
          ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_CopyFieldsToClipboard
  PROPERTIES
    Name                #MF_CopyFieldsToClipboard
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      ##define.defaultIndentLevel(4)
      ##define.autoColWidth(-2)
      #public class FormRun extends ObjectRun
      #{
      #    MF_CopyFieldsToClipboard        axCopyTableFieldList;
      #    Source                          sourcePreviewText;
      #
      #    ImageListAppl_Query             imageListSmall;
      #
      #    SourceLine                      tableVariableName;
      #    TableName                       tableName;
      #    NoYes                           insertDeclarationValue;
      #    NoYes                           insertClearMethodValue;
      #    Integer                         NoneInsertUpdateMethodValue;
      #    Set                             fieldListSet;
      #
      #    FieldName                       firstFieldName;
      #    FieldName                       lastFieldName;
      #// > georg, 11.03.2008, Get the table from parameters,  -->
      #    str                             firstFieldValue;
      #    str                             lastFieldValue;
      #    boolean                         firstNeedQuotes;
      #    boolean                         lastNeedQuotes;
      #// < georg, 11.03.2008, Get the table from parameters,  <--
      #
      #    SysDictTable                    dictTable;
      #
      #    #localMacro.FormControlList
      #        tableVariableName,
      #        tableName,
      #        insertDeclarationValue,
      #        insertClearMethodValue,
      #        NoneInsertUpdateMethodValue
      #    #endMacro}
    ENDSOURCE
    SOURCE #indent
      #SourceLine indent()
      #{
      #    return strRep(" ", #defaultIndentLevel);
      #}
    ENDSOURCE
    SOURCE #getFieldsSelectedText
      #Description getFieldsSelectedText()
      #{
      #    return strFmt("%1 out of %2 fields selected", fieldListSet.elements(), ListViewFields.getCount());
      #}
    ENDSOURCE
    SOURCE #resetFieldsListViewChecked
      #void resetFieldsListViewChecked()
      #{
      #    Integer         iField;
      #    int             idx;
      #    FormListItem    item;
      #    SysDictField    dictField;
      #    ;
      #    ListViewFields.deleteAll();
      #    for (iField = 1; iField <= dictTable.fieldCnt(); iField++)
      #    {
      #        dictField = dictTable.fieldObject(dictTable.fieldCnt2Id(iField));
      #        if (this.fieldOK(dictField))
      #        {
      #            item = new FormListItem(dictField.name(), imageListSmall.image(imageListSmall.findFieldImage(dictField.baseType())));
      #            item.idx(iField);
      #            item.stateChecked(true);
      #            item.data(dictField.id());
      #            idx = ListViewFields.addItem(item);
      #            ListViewFields.setText(idx, dictField.label(), 1);
      #
      #            if (fieldListSet.elements() > 0 && fieldListSet.in(dictField.id()))
      #            {
      #                item = ListViewFields.getItem(idx);
      #                item.stateChecked(true);
      #                ListViewFields.setItem(item);
      #            }
      #        }
      #    }
      #    FieldsSelectedText.text(this.getFieldsSelectedText());
      #}
    ENDSOURCE
    SOURCE #runBase
      #RunBase runBase()
      #{
      #    return axCopyTableFieldList;
      #}
      #
    ENDSOURCE
    SOURCE #fieldOK
      #boolean fieldOK(SysDictField _dictField)
      #{
      #    return !_dictField.isSystem() && !match("DEL_+", _dictField.name());
      #}
    ENDSOURCE
    SOURCE #getFirstLastFields
      #void getFirstLastFields()
      #{
      #    SysDictField    dictField;
      #    Integer         iField;
      #    boolean         firstField = true;
      #
      #    ;
      #
      #    for (iField = 1; iField <= dictTable.fieldCnt(); iField++)
      #    {
      #        dictField = dictTable.fieldObject(dictTable.fieldCnt2Id(iField));
      #        if (this.fieldOK(dictField))
      #        {
      #            if (firstField)
      #            {
      #                firstFieldName = dictField.name();
      #// > georg, 11.03.2008, Get the table from parameters,  -->
      #                //firstFieldValue = strfmt('%1',axCopyTableFieldList.RecordBuffer().(dictField.extendedFieldId()));
      #                firstNeedQuotes = ((dictField.baseType()==Types::String) ||
      #                                   (dictField.baseType()==Types::RString) ||
      #                                   (dictField.baseType()==Types::VarString));
      #// < georg, 11.03.2008, Get the table from parameters,  <--
      #                firstField = false;
      #            }
      #// > georg, 11.03.2008, Get the table from parameters,  -->
      #            lastFieldName = dictField.name();
      #            if(dictField.arraySize()==1){
      #                //lastFieldValue = strfmt('%1',axCopyTableFieldList.RecordBuffer().(dictField.extendedFieldId()));
      #                lastNeedQuotes = ((dictField.baseType()==Types::String) ||
      #                                  (dictField.baseType()==Types::RString) ||
      #                                  (dictField.baseType()==Types::VarString));
      #            } else {
      #                lastFieldValue = '[]';
      #                lastNeedQuotes = true;
      #            }
      #// < georg, 11.03.2008, Get the table from parameters,  <--
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #run
      #public void run()
      #{
      #    ;
      #    ListViewFields.setColumnWidth(0, #autoColWidth);
      #    ListViewFields.setColumnWidth(1, #autoColWidth);
      #
      #    super();
      #}
    ENDSOURCE
    SOURCE #initFieldsListView
      ##resAppl
      #void initFieldsListView()
      #{
      #    ;
      #    ListViewFields.addColumn(1, new FormListColumn("Field Name", 1,  #autoColWidth));
      #    ListViewFields.addColumn(2, new FormListColumn("Field Label", 2, #autoColWidth));
      #
      #    imageListSmall = new ImageListAppl_Query();
      #    imageListSmall.build();
      #    ListViewFields.setImagelist(imageListSmall.imageList(), false);
      #
      #    this.resetFieldsListViewChecked();
      #}
    ENDSOURCE
    SOURCE #simpleLine
      #void simpleLine(str _simpleStr)
      #{
      #    ;
      #    sourcePreviewText += this.indent() + _simpleStr + "\n";
      #}
    ENDSOURCE
    SOURCE #reBuildSourcePreview
      #void reBuildSourcePreview(str _varName = szTableVariableName.valueStr())
      #{
      #    Integer     maxFieldNameIndent()
      #    {
      #        return (max(strLen(firstFieldName), strLen(lastFieldName)) div #defaultIndentLevel + 1) * #defaultIndentLevel;
      #    }
      #    SourceLine  neededIndentLevel(FieldName _fieldName)
      #    {
      #        return strRep(" ", maxFieldNameIndent() - strLen(_fieldName));
      #    }
      #    ;
      #    sourcePreviewText = "";
      #    this.simpleLine(InsertTableDeclaration.value() ? strFmt("%1%3%2;", tableName, _varName, this.indent()) : "");
      #
      #    this.simpleLine(sourcePreviewText == this.indent() + "\n" ? "" : ";");
      #    this.simpleLine(InsertClearMethod.value() ? strFmt("%1.clear();", _varName) : "");
      #
      #    this.getFirstLastFields();
      #
      #// > georg, 11.03.2008, Get the table from parameters,  -->
      #if(!InsertValues.value()){
      #// < georg, 11.03.2008, Get the table from parameters,  <--
      #        this.simpleLine(strFmt("%1.%2%3=", _varName, firstFieldName, neededIndentLevel(firstFieldName)));
      #        this.simpleLine("...");
      #        this.simpleLine(strFmt("%1.%2%3=", _varName, lastFieldName, neededIndentLevel(lastFieldName)));
      #// > georg, 11.03.2008, Get the table from parameters,  -->
      #    } else {
      #        this.simpleLine(strFmt("%1.%2%3=%3%5%4%5", _varName, firstFieldName, neededIndentLevel(firstFieldName),firstFieldValue,firstNeedQuotes?'"':''));
      #        this.simpleLine("...");
      #        this.simpleLine(strFmt("%1.%2%3=%3%5%4%5", _varName, lastFieldName, neededIndentLevel(lastFieldName),lastFieldValue,lastNeedQuotes?'"':''));
      #    }
      #// < georg, 11.03.2008, Get the table from parameters,  <--
      #
      #    switch (InsertUpdateInsertmethod.selection())
      #    {
      #        case 0: this.simpleLine("");                                break;
      #        case 1: this.simpleLine(strFmt("%1.insert();", _varName));  break;
      #        case 2: this.simpleLine(strFmt("%1.update();", _varName));  break;
      #    }
      #
      #    SourcePreview.text(sourcePreviewText);
      #}
    ENDSOURCE
    SOURCE #validateVarName
      #boolean validateVarName(str _varName = szTableVariableName.valueStr())
      #{
      #    if (match('<[a-z_][a-z0-9_]', _varname))
      #    {
      #        VariableNameValid.imageResource(1030);
      #        return true;
      #    }
      #    else
      #    {
      #        VariableNameValid.imageResource(1031);
      #    }
      #    return false;
      #}
    ENDSOURCE
    SOURCE #initDataFromClass
      #void initDataFromClass()
      #{
      #    container   fieldListSetPacked;
      #    ;
      #    [#FormControlList] = axCopyTableFieldList.parmFormControlValues();
      #    fieldListSetPacked = axCopyTableFieldList.parmFieldListSet();
      #
      #    szTableVariableName.text(tableVariableName);
      #    insertTableDeclaration.value(insertDeclarationValue);
      #    insertClearMethod.value(insertClearMethodValue);
      #    InsertUpdateInsertmethod.selection(NoneInsertUpdateMethodValue);
      #    fieldListSet = Set::create(fieldListSetPacked);
      #
      #    dictTable = new SysDictTable(tableName2Id(tableName));
      #    if (!dictTable)
      #        throw error(strFmt("An unexpected error occured. Table '%1' not recognized", tableName));
      #
      #    element.design().caption(strFmt("Copy FieldList of '%1' table", tableName));
      #    InsertValues.visible(axCopyTableFieldList.RecordBuffer().RecId!=0);
      #}
    ENDSOURCE
    SOURCE #sendDataToClass
      #void sendDataToClass()
      #{
      #    ;
      #    tableVariableName           = szTableVariableName.valueStr();
      #    insertDeclarationValue      = insertTableDeclaration.value();
      #    insertClearMethodValue      = insertClearMethod.value();
      #    NoneInsertUpdateMethodValue = InsertUpdateInsertmethod.selection();
      #
      #    axCopyTableFieldList.parmFormControlValues([#FormControlList]);
      #    axCopyTableFieldList.parmFieldListSet(fieldListSet.pack());
      #    axCopyTableFieldList.parmUseRecordBuffer(InsertValues.value());
      #}
    ENDSOURCE
    SOURCE #closeOk
      #void closeOk()
      #{
      #    DialogRunbase dialog = element.args().caller();
      #    ;
      #    if (!element.validateVarName(szTableVariableName.valueStr()))
      #    {
      #        warning(strFmt("Variable name '%1' is not valid", szTableVariableName.valueStr()));
      #        return;
      #    }
      #    element.sendDataToClass();
      #
      #    dialog.updateServer();
      #
      #    if (axCopyTableFieldList.checkCloseDialog())
      #        super();
      #}
      #
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    ;
      #    if (!element.args().caller())
      #        throw error(strFmt("Method '%1.%2()' has been incorrectly called", this.name(), funcName()));
      #
      #    axCopyTableFieldList =  element.args().caller().runbase();
      #    fieldListSet = new Set(Types::Integer);
      #
      #    super();
      #
      #    this.initDataFromClass();
      #    this.validateVarName();
      #    this.initFieldsListView();
      #    this.reBuildSourcePreview();
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Caption             #Copy Table FieldList to Cllipboard
      Frame               #Dialog
      WindowType          #Popup
      SaveSize            #Yes
      HideToolbar         #Yes
      Columns             #2
      ArrangeGuide       
        ARRAY INDEX Columns
          #0
          #0
        ENDARRAY
      AllowUserSetup      #No
    ENDPROPERTIES
    CONTAINER
      CONTROL TAB
        PROPERTIES
          Name                #Tab
          Width               #Column width
          Height              #Column height
          Tabs                #1
          ShowTabs            #No
        ENDPROPERTIES
        CONTAINER
          CONTROL TABPAGE
            PROPERTIES
              Name                #TabPage
              Caption             #@SYS2952
            ENDPROPERTIES
            CONTAINER
              CONTROL GROUP
                PROPERTIES
                  Name                #dialogStartGrp
                  Visible             #No
                  FrameType           #None
                ENDPROPERTIES
                  CONTAINER
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #PreviewGrp
                  Width               #Column width
                  FrameType           #Edged 3D Line
                  Caption             #Code Preview
                  HideIfEmpty         #No
                ENDPROPERTIES
                  CONTAINER
                    CONTROL STRINGEDIT
                      PROPERTIES
                        Name                #SourcePreview
                        AutoDeclaration     #Yes
                        Width               #Column width
                        Height              #110
                        Skip                #Yes
                        AlignControl        #No
                        LookupButton        #Never
                        ReplaceOnLookup     #No
                        ChangeCase          #None
                        MultiLine           #Yes
                        ShowLabel           #No
                        LabelPosition       #Above
                        LabelAlignment      #Right
                        ExtendedDataType   
                          ARRAY
                            #Source
                            #
                          ENDARRAY
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #gotFocus
                          #public void gotFocus()
                          #{
                          #    //Prevent Preview modificatoin, but keep the BackGroundColor of the window
                          #    #define.EM_SETREADONLY          (0x00CF)
                          #
                          #    ;
                          #    super();
                          #
                          #    winapi::SendMessageEx(SourcePreview.hWnd(), #EM_SETREADONLY, true, 0);
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #SettingsGrp
                  Width               #Column width
                  FrameType           #Edged 3D Line
                  Caption             #Settings
                ENDPROPERTIES
                  CONTAINER
                    CONTROL GROUP
                      PROPERTIES
                        Name                #VariableNameGrp
                        FrameType           #None
                        Columns             #2
                        ArrangeGuide       
                          ARRAY INDEX Columns
                            #0
                            #0
                          ENDARRAY
                      ENDPROPERTIES
                        CONTAINER
                          CONTROL STRINGEDIT
                            PROPERTIES
                              Name                #szTableVariableName
                              AutoDeclaration     #Yes
                              DisplayLength       #50
                              Label               #Variable Name
                              LabelAlignment      #Right
                              ExtendedDataType   
                                ARRAY
                                  #SourceLine
                                  #
                                ENDARRAY
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #textChange
                                #public void textChange()
                                #{
                                #    super();
                                #
                                #    element.validateVarName(szTableVariableName.valueStr());
                                #    element.reBuildSourcePreview(szTableVariableName.valueStr());
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                          CONTROL WINDOW
                            PROPERTIES
                              Name                #VariableNameValid
                              AutoDeclaration     #Yes
                              Height              #Column height
                              Skip                #Yes
                              ImageResource       #1031
                              Imagemode           #Size to fit
                              BackStyle           #Transparent
                              BackgroundColor     #Button face (3D)
                              ForegroundColor     #Button text
                              ShowLabel           #No
                            ENDPROPERTIES
                          ENDCONTROL
                        ENDCONTAINER
                    ENDCONTROL
                    CONTROL GROUP
                      PROPERTIES
                        Name                #ExtraLinesGrp
                        Width               #Column width
                        FrameType           #None
                        Columns             #2
                        ArrangeGuide       
                          ARRAY INDEX Columns
                            #0
                            #0
                          ENDARRAY
                      ENDPROPERTIES
                        CONTAINER
                          CONTROL CHECKBOX
                            PROPERTIES
                              Name                #InsertTableDeclaration
                              AutoDeclaration     #Yes
                              Label               #Insert Declaration
                              LabelAlignment      #Right
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #clicked
                                #public void clicked()
                                #{
                                #    super();
                                #
                                #    element.reBuildSourcePreview(szTableVariableName.valueStr());
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                          CONTROL CHECKBOX
                            PROPERTIES
                              Name                #InsertClearMethod
                              AutoDeclaration     #Yes
                              Label               #Insert Clear() method
                              LabelAlignment      #Right
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #clicked
                                #public void clicked()
                                #{
                                #    super();
                                #
                                #    element.reBuildSourcePreview(szTableVariableName.valueStr());
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                          CONTROL CHECKBOX
                            PROPERTIES
                              Name                #InsertValues
                              AutoDeclaration     #Yes
                              Label               #InsertValues
                              LabelAlignment      #Right
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #clicked
                                #public void clicked()
                                #{
                                #    super();
                                #    element.reBuildSourcePreview(szTableVariableName.valueStr());
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                          CONTROL COMBOBOX
                            PROPERTIES
                              Name                #InsertUpdateInsertmethod
                              AutoDeclaration     #Yes
                              Left                #Auto (right)
                              Text               
                                ARRAY INDEX Items
                                  #Do not paste any methods
                                  #Paste Insert() method
                                  #Paste Update() method
                                ENDARRAY
                              Items               #3
                              Label               #Insert Update() / Insert() method
                              LabelPosition       #Above
                              LabelAlignment      #Right
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #selectionChange
                                #public int selectionChange()
                                #{
                                #    int ret;
                                #
                                #    ret = super();
                                #
                                #    element.reBuildSourcePreview(szTableVariableName.valueStr());
                                #
                                #    return ret;
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                          CONTROL BUTTONGROUP
                            PROPERTIES
                              Name                #RightButtonGrp
                            ENDPROPERTIES
                            CONTAINER
                            ENDCONTAINER
                          ENDCONTROL
                        ENDCONTAINER
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #ButtonsGrp
                  Width               #Column width
                  VerticalSpacing     #0
                  FrameType           #None
                  Columns             #3
                  ArrangeGuide       
                    ARRAY INDEX Columns
                      #0
                      #0
                      #0
                    ENDARRAY
                ENDPROPERTIES
                  CONTAINER
                    CONTROL BUTTON
                      PROPERTIES
                        Name                #SelectAllBtn
                        Text                #Select All
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #clicked
                          #void clicked()
                          #{
                          #    Integer         iField;
                          #    SysDictField    dictField;
                          #    ;
                          #
                          #    super();
                          #
                          #    fieldListSet = new Set(Types::Integer);
                          #    for (iField = 1; iField <= dictTable.fieldCnt(); iField++)
                          #    {
                          #        dictField = dictTable.fieldObject(dictTable.fieldCnt2Id(iField));
                          #        if (element.fieldOK(dictField))
                          #        {
                          #            fieldListSet.add(dictField.id());
                          #        }
                          #    }
                          #
                          #    element.resetFieldsListViewChecked();
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                    CONTROL BUTTON
                      PROPERTIES
                        Name                #SelectNoneBtn
                        Text                #Select None
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #clicked
                          #void clicked()
                          #{
                          #    super();
                          #
                          #    fieldListSet = new Set(Types::Integer);
                          #    element.resetFieldsListViewChecked();
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #FieldListGrp
                  Width               #Column width
                  Height              #Column height
                  FrameType           #None
                ENDPROPERTIES
                  CONTAINER
                    CONTROL LISTVIEW
                      PROPERTIES
                        Name                #ListViewFields
                        Width               #Column width
                        Height              #Column height
                        ViewType            #Report
                        CheckBox            #Yes
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #keyDown
                          #public boolean keyDown(int _vKey, boolean _Ctrl, boolean _Shift)
                          #{
                          #    #define.VK_SPACE(32)
                          #    FormListItem    item;
                          #    boolean         ret;
                          #    ;
                          #    ret = super(_vKey, _Ctrl, _Shift);
                          #
                          #    if (_vKey == #VK_SPACE)
                          #    {
                          #        item = this.getItem(ListViewFields.getNextItem(FormListNext::Selected));
                          #
                          #        if (item.stateChecked())
                          #            fieldListSet.remove(item.data());
                          #        else
                          #            fieldListSet.add(item.data());
                          #
                          #        FieldsSelectedText.text(element.getFieldsSelectedText());
                          #    }
                          #
                          #    return ret;
                          #}
                        ENDSOURCE
                        SOURCE #mouseDown
                          #public int mouseDown(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
                          #{
                          #    #FormListControl
                          #    int             ret;
                          #    int             focus;
                          #    int             idx;
                          #    FormListItem    item;
                          #    ;
                          #    ret = super(_x, _y, _button, _Ctrl, _Shift);
                          #
                          #    [idx, focus] = this.hitTest(_x, _y);
                          #
                          #    if (focus & #FLCHT_ONITEMSTATEICON && this.getItem(idx))
                          #    {
                          #        item = this.getItem(idx);
                          #
                          #        if (item.stateChecked())
                          #            fieldListSet.remove(item.data());
                          #        else
                          #            fieldListSet.add(item.data());
                          #
                          #        FieldsSelectedText.text(element.getFieldsSelectedText());
                          #    }
                          #
                          #    return ret;
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                    CONTROL STATICTEXT
                      PROPERTIES
                        Name                #FieldsSelectedText
                        AutoDeclaration     #Yes
                        Left                #Auto (right)
                        Text                #
                      ENDPROPERTIES
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
            ENDCONTAINER
          ENDCONTROL
        ENDCONTAINER
      ENDCONTROL
      CONTROL GROUP
        PROPERTIES
          Name                #BottomGrp
          Top                 #Bottom edge
          Width               #Column width
          FrameType           #Edged 3D Line
          Columns             #2
          ArrangeGuide       
            ARRAY INDEX Columns
              #0
              #0
            ENDARRAY
        ENDPROPERTIES
          CONTAINER
            CONTROL BUTTONGROUP
              PROPERTIES
                Name                #BottomButtonGrp
                Left                #Auto (right)
                SizeWidth           #No
                ArrangeMethod       #Horizontal, flush right
              ENDPROPERTIES
              CONTAINER
                CONTROL COMMANDBUTTON
                  PROPERTIES
                    Name                #CommandButtonOK
                    ShowShortCut        #No
                    DefaultButton       #Yes
                    Command             #263
                  ENDPROPERTIES
                ENDCONTROL
                CONTROL COMMANDBUTTON
                  PROPERTIES
                    Name                #CommandButtonCancel
                    ShowShortCut        #No
                    Command             #264
                  ENDPROPERTIES
                ENDCONTROL
              ENDCONTAINER
            ENDCONTROL
          ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_TabBar
  PROPERTIES
    Name                #MF_TabBar
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      #
      #public class FormRun extends ObjectRun
      #{
      #    #define.v('0.3.2')
      #    #localmacro.tabax_license
      #    #endmacro
      #
      #// =========== configuration ==============
      #    // prefixes of widow titles whist have
      #    // to have project icon.
      #    // add your prefix if you use localization other
      #    // than russian and english
      #    #localmacro.projectPrefixes
      #        #prefix("Projects\\Shared")
      #        #prefix("Ïðîåêò ")
      #        #prefix("Development project ")
      #        #prefix("Project ")
      #    #endmacro
      #    // timer interval in milliseconds for active windows scanning
      #    #define.windowsScanTimer(300)
      #//========= configuration end =========
      #    Map windows;
      #    Map titles;
      #    #resAppl
      #    #winAPI
      #    HWND topmost;
      #    HWND second;
      #    ObjectIdent currentFormRun;
      #    HWND currentFormRun_hwnd;
      #    imageListAppl_AOT imgApp;
      #    container p;
      #    DLL user32;
      #    DLLFunction isWindowVisibleFun;
      #    DLLFunction isIconicFun;
      #    DLLFunction isZoomedFun;
      #    DLLFunction openIconFun;
      #    DLLFunction getDesktopWindow;
      #    DLLFunction lockWindowUpdate;
      #    DLLFunction peekMessage;
      #    DLLFunction TranslateMessage;
      #    DLLFunction dispatchMessage;
      #    List mainMenu;
      #    Map mainMenuItems;
      #    boolean menuTree_notOpen;
      #    container MRUProjects;
      #    container editorSuffixes;
      #    int hand;
      #    HWND MdiClient;
      #    boolean fitMaximized;
      #
      #    boolean collapsed;
      #    Set maximized;
      #    container maximizedIdentities;
      #    FormTreeItem loadingMenuItem;
      #    str windowToolTip;
      #    str menuToolTip;
      #    str historyToolTip;
      #    FormButtonControl activeBut;
      #    FormTabPageControl activeTab;
      #    str v;
      #    Map openedProjects;
      #    // iteration:
      #        TreeNode current;
      #        Array iterators;
      #        Array lists;
      #        TreeNodeIterator tniterator;
      #        int sp, lists_sp;
      #        List currentList;
      #    //Map menuUsageStatistics;
      #    container packedMenuUsageStatistics;
      #    boolean menuOnlyPopular;
      #    boolean inDeletion;
      #    int maxCaptionSize;
      #    int windowsScanTimer;
      #    boolean paused;
      #    int heightDecrement;
      #     // Normal sizes for restore after maximization
      #    Map normalPositions;
      #    // Map hWnd --> FormName, MenuItemname
      #    Map formIdentity;
      #    // Map identity -> normal position;
      #    Map identityNormalPositions;
      #    Set retoreIfRestored;
      #    Map oldWindows;
      #    // Windows which probably have fixed size
      #    Map fixedWindows;
      #// === tabs parameters
      #    boolean sameTabSize;
      #    int maxTabSize;
      #    int minTabSize;
      #    int desktopWindow;
      #
      #    #define.SWP_NOACTIVATE(0x10)
      #
      #
      #    #define.CurrentVersion(8)
      #    #localmacro.List5
      #        maxCaptionSize
      #    #endmacro
      #    #localmacro.List6
      #        maxCaptionSize, fitMaximized
      #    #endmacro
      #    #localmacro.List7
      #        maxCaptionSize, fitMaximized, maximizedIdentities
      #    #endmacro
      #    #localmacro.List8
      #        maxCaptionSize, fitMaximized, maximizedIdentities, minTabSize, maxTabSize, sameTabSize
      #    #endmacro
      #    #localmacro.CurrentList
      #        #List8
      #    #endmacro
      #    #define.TCM_FIRST(0x1300)
      #    #define.TCM_GETIMAGELIST(#TCM_FIRST + 2)
      #    #define.TCM_SETIMAGELIST(#TCM_FIRST + 3)
      #    #define.TCM_GETITEMCOUNT(#TCM_FIRST + 4)
      #    #define.TCM_SETITEM(#TCM_FIRST + 6)
      #    #define.TCM_GETITEMRECT(#TCM_FIRST + 10)
      #    #define.TCM_SETITEMSIZE(#TCM_FIRST + 41)
      #    #define.TCM_SETMINTABWIDTH(#TCM_FIRST + 49)
      #    #define.TCM_GETCURSEL(#TCM_FIRST + 11)
      #    #define.TCM_SETCURSEL(#TCM_FIRST + 12)
      #    #define.TCM_HITTEST(#TCM_FIRST + 13)
      #    #define.TCS_FIXEDWIDTH(0x0400)
      #    #define.TCS_TOOLTIPS(0x4000)
      #    #define.TCS_FORCELABELLEFT(0x0020)
      #    #define.TCIF_IMAGE(0x0002)
      #    #define.GWL_STYLE(-16)
      #// === axPath
      #    #define.AxPath_Prefix('AxPath')
      #    #define.AxPath_AOTName('AOT')
      #    #define.AxPath_MenuItemName('MenuItem')
      #    #define.URL_PART_NONE(0)
      #    #define.URL_PART_SCHEME(1)
      #    #define.URL_PART_HOSTNAME(2)
      #    #define.URL_PART_USERNAME(3)
      #    #define.URL_PART_PASSWORD(4)
      #    #define.URL_PART_PORT(5)
      #    #define.URL_PART_QUERY(6)
      #    #define.WM_GETMINMAXINFO(0x24)
      #    #AOT
      #
      #
      #    #if.ReferencesPath
      #        #define.PaneWindowCL("AxPaneWnd")
      #        #define.ImageExt('png')
      #        #localmacro.recID2str
      #            int642str(%1)
      #        #endmacro
      #        #localmacro.str2recID
      #            str2int64(%1)
      #        #endmacro
      #        #define.Ax4
      #    #endif
      #
      #    #ifnot.ReferencesPath
      #        #define.PaneWindowCL("PaneWindowCL")
      #        #define.ImageExt('bmp')
      #        #localmacro.recID2str
      #            uint2str(%1)
      #        #endmacro
      #        #localmacro.str2recID
      #            str2int(%1)
      #        #endmacro
      #        #define.Ax3
      #    #endif
      #
      #// === i18n
      #    Session session;
      #    Map translations;
      #    #localmacro._
      #        element.getText(%1)
      #    #endmacro
      #
      #    #localmacro.language
      #        if (session.interfaceLanguage()=="%1")
      #        {
      #            translations=new Map(Types::String, Types::String);
      #    #endmacro
      #    #localmacro.endLanguage
      #        }
      #    #endmacro
      #// === events
      #    Map events;
      #    #localmacro.fireEvent
      #        __eventHandlersEnumerator__ = element.getEvent(identifierStr(%1)).getEnumerator();
      #        while(__eventHandlersEnumerator__.moveNext())
      #            __eventHandlersEnumerator__.current().%1%2;
      #    #endMacro
      #    SetEnumerator __eventHandlersEnumerator__;
      #}
    ENDSOURCE
    SOURCE #AxPath_findCommon
      #Common AxPath_findCommon(TableID _tableID, container _params)
      #{
      #    Query q=new Query();
      #    QueryBuildDataSource ds = q.addDataSource(_tableID);
      #    Common ret;
      #    QueryRun qr;
      #;
      #    if (this.AxPath_filterFromParams(ds, _params))
      #    {
      #        qr = new QueryRun(q);
      #        qr.next();
      #        ret = qr.get(_tableID);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_real2str
      #str AxPath_real2str(real _value)
      #{
      #    str ret = num2str(_value, 0, 16, 1, 0);
      #    int pointPos = strFind(ret, '.', 1, strLen(ret));
      #    int nonZeroPos;
      #;
      #    if (pointPos)
      #    {
      #        nonZeroPos = strNFind(ret, '0', strLen(ret), -strLen(ret));
      #        ret = nonZeroPos ? subStr(ret, 1, nonZeroPos) : '0';
      #        if (this.strEndsWith(ret, '.'))
      #            ret = subStr(ret, 1, strLen(ret) - 1);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_valueFromString
      #AnyType AxPath_valueFromString(Types _type, str _asString)
      #{
      #    switch (_type)
      #    {
      #        case Types::Date:
      #            return str2date(_asString, 321);
      #        case Types::Real:
      #            return str2num(_asString);
      #        case Types::Integer:
      #            return str2int(_asString);
      #        #if.ax4
      #            case Types::Int64:
      #                return str2int64(_asString);
      #        #endif
      #        default:
      #            return _asString;
      #    }
      #
      #    return null;
      #}
      #
    ENDSOURCE
    SOURCE #AxPath_filterFromParams
      #boolean AxPath_filterFromParams(QueryBuildDataSource _ds, container _params)
      #{
      #    int i;
      #    str name;
      #    str value;
      #    RecID recID;
      #    FieldID field;
      #    SysDictTable table = SysDictTable::newTableId(_ds.table());
      #    boolean ret;
      #;
      #    for (i=1; i<=conLen(_params); i++)
      #    {
      #        [name, value] = conPeek(_params, i);
      #        if (name != fieldStr(Common, dataAreaId))
      #        {
      #            field = fieldName2ID(_ds.table(), name);
      #
      #            if (!field)
      #                throw error(strFmt(this.getText("Field '%2' is not found in the table '%1'"), tableID2Name(_ds.table()), name));
      #
      #            _ds.addRange(field).value(
      #                queryValue(this.AxPath_valueFromString(
      #                    table.fieldObject(field).type(),
      #                    value
      #                ))
      #            );
      #            ret = true;
      #        }
      #    }
      #    return ret;
      #}
      #
    ENDSOURCE
    SOURCE #AxPath_keyFields
      #container AxPath_keyFields(TableID _table)
      #{
      #    SysDictTable table = SysDictTable::newTableId(_table);
      #    container ret;
      #    IndexID primaryIndexID = table.primaryIndex();
      #    SysDictIndex primaryIndex;
      #    int i;
      #;
      #    if (primaryIndexID)
      #    {
      #        primaryIndex = table.indexObject(primaryIndexID);
      #        for (i=1; i<=primaryIndex.numberOfFields(); i++)
      #            ret += primaryIndex.field(i);
      #    }
      #    else
      #        ret += fieldName2ID(_table, 'RecID');
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_keyByCommon
      #str AxPath_keyByCommon(Common _record)
      #{
      #    container fields = element.AxPath_keyFields(_record.TableId);
      #    int i;
      #    str ret;
      #    FieldID field;
      #    str strValue()
      #    {
      #        AnyType value = _record.(field);
      #        Types type = typeOf(value);
      #    ;
      #        switch(type)
      #        {
      #            case Types::Date:
      #                return date2str(value, 321, 2, 0, 2, 0, 4);
      #            case Types::Real:
      #                return this.AxPath_real2str(value);
      #            case Types::Enum, Types::Integer:
      #                return int2str(value);
      #
      #            default:
      #                return strFmt('%1', value);
      #        }
      #    }
      #;
      #    for (i=1; i<=conLen(fields); i++)
      #    {
      #        if (ret)
      #            ret += '&';
      #        field = conPeek(fields, i);
      #        ret += fieldId2name(_record.TableId, field) + '=' + this.urlEscape(strValue());
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #resourceName
      #str resourceName(str _subPath)
      #{
      #    return 'Tabax_' + strReplace(strReplace(_subPath, '.', '_'), '\\', '_');
      #}
    ENDSOURCE
    SOURCE #getResourcePath
      #str getResourcePath(str _subPath)
      #{
      #    str ret = this.fullInculdePath(_subPath);
      #    if (WinApi::fileExists(ret))
      #        return ret;
      #    return this.filePathFromResource(_subPath);
      #}
    ENDSOURCE
    SOURCE #fullInculdePath
      #str fullInculdePath(str _subpath)
      #{
      #    return this.pathCombine(XInfo::directory(DirectoryType::Include), 'tabax\\' + _subpath);
      #}
    ENDSOURCE
    SOURCE #filePathFromResource
      #str filePathFromResource(str _subPath)
      #{
      #    return SysResource::getImagePath(this.resourceName(_subPath));
      #}
    ENDSOURCE
    SOURCE #getDataFieldTreeNode
      #TreeNode getDataFieldTreeNode(FormRun _form)
      #{
      #    TreeNode ret;
      #    Object formControlEditField = _form.selectedControl();
      #    TreeNode getDataSourceNode()
      #    {
      #        int         dataSourceId;
      #        int         fieldExtId;
      #        str         dataMethodName;
      #        TreeNode    fieldNode;
      #    ;
      #        dataSourceId    = formControlEditField.dataSource();
      #        fieldExtId      = formControlEditField.dataField();
      #        dataMethodName  = formControlEditField.dataMethod();
      #        if (dataSourceId)
      #        {
      #            if (fieldExtId)
      #            {
      #                fieldNode = TreeNode::findNode(#TablesPath + #AOTRootPath + tableId2Name(_form.form().dataSource(dataSourceId).table()) + "\\Fields");
      #                if (fieldNode)
      #                    fieldNode = fieldNode.AOTfindChild(fieldId2Name(_form.form().dataSource(dataSourceId).table(), fieldExt2Id(fieldExtId)));
      #                return fieldNode;
      #            }
      #            else
      #            {
      #                if (dataMethodName)
      #                {
      #                    fieldNode = TreeNode::findNode(strFmt(#DataSourceMethodPath, #FormsPath + #AOTRootPath + _form.name(), _form.form().dataSource(dataSourceId).name(), dataMethodName));
      #                    if (!fieldNode)
      #                    {
      #                        fieldNode = TreeNode::findNode(strFmt(#MethodPath, #TablesPath + #AOTRootPath + tableId2Name(_form.form().dataSource(dataSourceId).table()), dataMethodName));
      #                        return fieldNode;
      #                    }
      #                }
      #            }
      #        }
      #        return null;
      #    }
      #;
      #    switch (formControlEditField.handle())
      #    {
      #        case classNum(FormStringControl):
      #        case classNum(FormRealControl):
      #        case classNum(FormIntControl):
      #        case classNum(FormDateControl):
      #        case classNum(FormComboBoxControl):
      #        case classNum(FormRadioControl):
      #        case classNum(FormTimeControl):
      #            if (formControlEditField.extendedDataType())
      #                ret = new SysDictType(formControlEditField.extendedDataType()).treeNode();
      #            else
      #                ret = getDataSourceNode();
      #            break;
      #        case classNum(FormCheckBoxControl):
      #            ret = getDataSourceNode();
      #            break;
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #showControlInfo
      #public void showControlInfo(FormRun _form)
      #{
      #    #define.taskCtrlQ(264)
      #    SysDictField        dictField;
      #    FormControl         formControl = _form.selectedControl();
      #    FormStringControl   formStringControl;
      #    FormButtonControl   formButtonControl;
      #    SysDictEnum         dictEnum = new SysDictEnum(enumNum(Types));
      #    SysDictEnum         dictEnums;
      #    FormDataSource      formDataSource =  _form.objectSet();
      #    TreeNode node;
      #;
      #
      #    if(formControl && formDataSource)
      #    {
      #        node = element.controlByName(element.formByName(_form.name()), formControl.name());
      #        switch(SysFormRun::controlType(classIdGet(formControl)))
      #        {
      #            case FormControlType::CheckBox :
      #            case FormControlType::ComboBox :
      #            case FormControlType::Date :
      #            case FormControlType::Grid :
      #            case FormControlType::Group :
      #            case FormControlType::Integer :
      #            case FormControlType::RadioButton :
      #            case FormControlType::Real :
      #            case FormControlType::StaticText :
      #            case FormControlType::String :
      #            case FormControlType::Time :
      #                formStringControl = formControl;
      #                if(formStringControl.dataField() && formDataSource.table())
      #                {
      #                    info(strfmt("Control Name   -> %1", formStringControl.name()), '', new SysInfoAction_Properties(node.treeNodePath()));
      #                    dictField = new SysDictField(formDataSource.table(), fieldExt2Id(formStringControl.dataField()));
      #                    info(strfmt('Table.Field       -> %2.%1',
      #                        fieldId2Name(formDataSource.table(), fieldExt2Id(formStringControl.dataField())),
      #                        tableId2Name(formDataSource.table())), '',
      #                        dictField ?  new SysInfoAction_Properties(dictField.treeNode().treeNodePath()): null);
      #
      #                    if(dictField)
      #                    {
      #                        info(strfmt('Type                -> %1', dictEnum.index2Symbol(dictField.baseType())));
      #
      #                        if(dictField.baseType() == typeOf(Types::Enum))
      #                        {
      #                            dictEnums = new SysDictEnum(dictField.enumId());
      #                            info(strfmt('Base Enum       -> %1', dictEnums.name()));
      #                        }
      #
      #                        info(strfmt('Ext Data Type -> %1', extendedTypeId2name(dictField.typeId())));
      #                        info(strfmt('Size                  ->  %1', int2str(dictField.stringLen())));
      #                        info(strfmt('Max Right        -> %1', dictField.rights()));
      #                        info(strfmt('Label                -> %1:  %2', dictField.labelLabel(), dictField.label()));
      #                        info(strfmt('Help                 -> %1:  %2', dictField.helpLabelId(),dictField.help()));
      #                    }
      #                }
      #
      #                if(formStringControl.dataMethod())
      #                {
      #                    info(strfmt('Method %1.%2', tableId2Name(formDataSource.table()), formStringControl.dataMethod()));
      #                }
      #                break;
      #            }
      #        }
      #}
    ENDSOURCE
    SOURCE #AxPath_getDataAreaId
      #//+ Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
      #DataAreaId AxPath_getDataAreaId(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int line;
      #    int pos;
      #    int i;
      #    str name;
      #    str value;
      #    DataAreaId DataAreaId;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='Area')
      #            DataAreaId = value;
      #    }
      #    return DataAreaId;
      #}
      #//- Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
    ENDSOURCE
    SOURCE #fitAndRemember
      #void fitAndRemember(HWND _child)
      #{
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #;
      #    [fixedWidth, fixedHeight] = this.fitWindow(_child);
      #    if (fixedWidth || fixedHeight)
      #        fixedWindows.insert(_child, [fixedWidth, fixedHeight]);
      #
      #}
    ENDSOURCE
    SOURCE #GetMaxSize
      #container getMaxSize(HWnd _hwnd)
      #{
      #//typedef struct {
      #//    POINT ptReserved; 0 (x:0, y:4)
      #//    POINT ptMaxSize;  8 (x:8, y:12)
      #//    POINT ptMaxPosition; 16 (x:16, y:20)
      #//    POINT ptMinTrackSize; 24 (x:24, y:28)
      #//    POINT ptMaxTrackSize; 32 (x:32, y:36)
      #//} MINMAXINFO; 40
      #    Binary ret=new Binary(4*2*5);
      #    Binary ptr=new Binary(4);
      #    int msx;
      #    int msy;
      #    int mpx;
      #    int mpy;
      #    int mtx;
      #    int mty;
      #    int mxtx;
      #    int mxty;
      #;
      #    ptr.binary(0, ret);
      #
      #//        WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, 0, ptr.dWord(0));
      #    WinApi::sendMessageEx(_hwnd, #WM_GETMINMAXINFO,  0, ptr.dWord(0));
      #    msx = ret.dWord(8);
      #    msy = ret.dWord(12);
      #    mpx = ret.dWord(16);
      #    mpy = ret.dWord(20);
      #    mtx = ret.dWord(24);
      #    mty = ret.dWord(28);
      #    mxtx = ret.dWord(32);
      #    mxty = ret.dWord(36);
      #    return [ret.dWord(32), ret.dWord(36)];
      #}
    ENDSOURCE
    SOURCE #pathCombine
      #str pathCombine(str _path, str _part)
      #{
      #    return  _path + (this.strEndsWith(_path, '\\') ? '' : '\\') + _part;
      #}
    ENDSOURCE
    SOURCE #loadLanguageFile
      #void loadLanguageFile(str _fileName)
      #{
      #    AsciiIO io=new AsciiIO(_fileName, 'r');
      #    container data;
      #;
      #    if (!translations)
      #        translations=new Map(Types::String, Types::String);
      #    io.inFieldDelimiter('\r\n\r\n');
      #    io.inRecordDelimiter('\r\n---\r\n');
      #    data = io.read();
      #    while (data)
      #    {
      #        data = io.read();
      #        this.translate(conPeek(data, 1), conPeek(data, 2));
      #    }
      #}
    ENDSOURCE
    SOURCE #editConfiguration
      #void editConfiguration()
      #{
      #    boolean successful;
      #    Dialog d=new Dialog(#_('Tabax ')+v+#_(' preferences'));
      #    DialogField dialogMaxCaptionSize=d.addFieldValue(typeID(MaximumLength), maxCaptionSize,
      #        #_('Maximal caption size'));
      #    DialogField dialogFitMaximized=d.addFieldValue(typeID(NoYes), fitMaximized,
      #        #_('Fit maximized windows'), #_('Fit maximized windows to the client area'));
      #    DialogField dialogSameSize = d.addFieldValue(typeID(NoYes), sameTabSize, #_("Tabs have same size"));
      #    DialogField dialogMinTabSize = d.addFieldValue(typeID(Integer), minTabSize, #_("Minimal tab size"));
      #    DialogField dialogMaxTabSize = d.addFieldValue(typeID(Integer), maxTabSize, #_("Maximal tab size"));
      #    #fireEvent(beforeSetupDialog, (element, d))
      #    successful = d.run();
      #    if(successful)
      #    {
      #        maxCaptionSize = dialogMaxCaptionSize.value();
      #        fitMaximized = dialogFitMaximized.value();
      #        minTabSize = dialogMinTabSize.value();
      #        maxTabSize = dialogMaxTabSize.value();
      #        maxTabSize = max(0, maxTabSize);
      #        minTabSize = max(0, minTabSize);
      #        if (maxTabSize)
      #            minTabSize = min(minTabSize, maxTabSize);
      #        sameTabSize = dialogSameSize.value();
      #    }
      #    #fireEvent(afterSetupDialog, (element, d, successful))
      #}
    ENDSOURCE
    SOURCE #rememberOldWindow
      #void rememberOldWindow(Hwnd _hwnd)
      #{
      #;
      #    oldWindows.insert(_hwnd, [this.isIconic(_hwnd), this.getMdiClientRelativeRect(_hwnd)]);
      #}
    ENDSOURCE
    SOURCE #wasIconic
      #boolean wasIconic(HWnd _hwnd)
      #{
      #    boolean wasIconic;
      #    container oldPosition;
      #;
      #    if (oldWindows.exists(_hwnd))
      #    {
      #        [wasIconic, oldPosition] = oldWindows.lookup(_hwnd);
      #        return wasIconic;
      #    }
      #    return false;
      #}
    ENDSOURCE
    SOURCE #positionChanged
      #boolean positionChanged(HWnd _hwnd)
      #{
      #    boolean wasIconic;
      #    container oldPosition;
      #;
      #    if (oldWindows.exists(_hwnd))
      #    {
      #        [wasIconic, oldPosition] = oldWindows.lookup(_hwnd);
      #        return oldPosition!=this.getMdiClientRelativeRect(_hwnd);
      #    }
      #    return false;
      #}
    ENDSOURCE
    SOURCE #restoreNormalPosition
      #void restoreNormalPosition(Hwnd _hwnd)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #    container normal;
      #;
      #    if (normalPositions.exists(_hwnd))
      #    {
      #        normal = normalPositions.lookup(_hwnd);
      #        [x1, y1, x2, y2] = normal;
      #        element.prepareToSide(_hwnd);
      #        WinApi::setWindowPos(_hwnd, x1, y1, x2-x1+1, y2-y1+1);
      #    }
      #}
    ENDSOURCE
    SOURCE #rememberNormalPosition
      #void rememberNormalPosition(Hwnd _hwnd)
      #{
      #    container position;
      #;
      #    position = element.getMdiClientRelativeRect(_hwnd);
      #    normalPositions.insert(_hwnd, position);
      #}
    ENDSOURCE
    SOURCE #openIcon
      #boolean openIcon(int _handle)
      #{
      #    return openIconFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #loadDictionary
      #void loadDictionary()
      #{
      #    str lngFilePath;
      #;
      #    session = new Session();
      #    lngFilePath = this.getResourcePath('lang\\' + session.interfaceLanguage() + '.txt');
      #    if (lngFilePath)
      #        this.loadLanguageFile(lngFilePath);
      #}
    ENDSOURCE
    SOURCE #getText
      #str getText(str _s)
      #{
      #    return (translations && translations.exists(_s)) ? translations.lookup(_s) : _s;
      #}
    ENDSOURCE
    SOURCE #processMaximizations
      #void processMaximizations(HWnd _child)
      #{
      #    int idx;
      #    boolean wasIconic;
      #    container oldPosition;
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #    void deleteFromMaximized()
      #    {
      #    ;
      #        maximized.remove(_child);
      #        if (formIdentity.exists(_child))
      #        {
      #            idx = conFind(maximizedIdentities, formIdentity.lookup(_child));
      #            if (idx)
      #                maximizedIdentities = conDel(maximizedIdentities, idx, 1);
      #        }
      #    }
      #    if (this.isZoomed(_child))
      #    {
      #        if (maximized.in(_child) && !this.wasIconic(_child))
      #        {
      #            this.restoreNormalPosition(_child);
      #            deleteFromMaximized();
      #        }
      #        else
      #        {
      #            maximized.add(_child);
      #            if (formIdentity.exists(_child))
      #            {
      #                idx = conFind(maximizedIdentities, formIdentity.lookup(_child));
      #                if (!idx)
      #                    maximizedIdentities += formIdentity.lookup(_child);
      #                if (normalPositions.exists(_child))
      #                    identityNormalPositions.insert(formIdentity.lookup(_child), normalPositions.lookup(_child));
      #            }
      #            this.fitAndRemember(_child);
      #        }
      #    }
      #    else
      #    {
      #        if (maximized.in(_child))
      #        {
      #            if (!this.isIconic(_child))
      #            {
      #                if(this.positionChanged(_child))
      #                {
      #                    deleteFromMaximized();
      #                    this.rememberNormalPosition(_child);
      #                }
      #                else
      #                {
      #                    fixedWidth = false;
      #                    fixedHeight = false;
      #                    if (fixedWindows.exists(_child))
      #                    {
      #                        [fixedWidth, fixedHeight] = fixedWindows.lookup(_child);
      #                        this.fitWindow(_child, true, fixedWidth, fixedHeight);
      #                    }
      #                    else
      #                        this.fitAndRemember(_child);
      #                }
      #            }
      #            else
      #            {
      #                retoreIfRestored.add(_child);
      #                deleteFromMaximized();
      #            }
      #        }
      #        else
      #        {
      #            if (!this.isIconic(_child))
      #            {
      #                if (retoreIfRestored.in(_child))
      #                {
      #                    this.restoreNormalPosition(_child);
      #                    retoreIfRestored.remove(_child);
      #                }
      #                else
      #                {
      #                    this.rememberNormalPosition(_child);
      #                }
      #            }
      #        }
      #    }
      #    if (this.isIconic(_child))
      #        this.processIconic(_child);
      #    this.rememberOldWindow(_child);
      #}
      #
    ENDSOURCE
    SOURCE #processFormIdentity
      #void processFormIdentity()
      #{
      #    FormRun formRun;
      #;
      #    if (infolog.parmLastActivatedForm() && infolog.parmLastActivatedForm().object())
      #    {
      #        formRun = infolog.parmLastActivatedForm().object();
      #        if (formRun && formRun.args())
      #            formIdentity.insert(formRun.hWnd(), enum2str(formRun.args().menuItemType()) + ' ' + formRun.args().menuItemName() + ' ' + formRun.name());
      #    }
      #}
    ENDSOURCE
    SOURCE #getMdiClientRelativeRect
      #// returns rectangle relative to mdiClient
      #container getMdiClientRelativeRect(HWND _hwnd)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #;
      #    [x1, y1, x2, y2] = this.getWindowRect(_hwnd);
      #    [x1, y1] = WinApi::screenToClient(mdiClient, x1, y1);
      #    [x2, y2] = WinApi::screenToClient(mdiClient, x2, y2);
      #    return [x1, y1, x2, y2];
      #}
    ENDSOURCE
    SOURCE #processFormIdentity_closing
      #void processFormIdentity_closing(HWnd _hwnd)
      #{
      #    FormRun formRun;
      #;
      #    if (formIdentity.exists(_hwnd))
      #        formIdentity.remove(_hwnd);
      #}
    ENDSOURCE
    SOURCE #getEvent
      #Set getEvent(str _id)
      #{
      #    Set ret;
      #    if (!events)
      #        events = new Map(Types::String, Types::Class);
      #    if (events.exists(_id))
      #        ret = events.lookup(_id);
      #    else
      #    {
      #        ret = new Set(Types::Class);
      #        events.insert(_id, ret);
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #processWindowAdd
      #void processWindowAdd(Hwnd _hwnd)
      #{
      #    int idx;
      #    str identity;
      #    if (formIdentity.exists(_hwnd))
      #    {
      #        idx = conFind(maximizedIdentities, formIdentity.lookup(_hwnd));
      #        if (idx)
      #        {
      #            //maximizedIdentities = conDel(maximizedIdentities, idx, 1);
      #            this.fitAndRemember(_hwnd);
      #            this.rememberOldWindow(_hwnd);
      #            maximized.add(_hwnd);
      #            identity = conPeek(maximizedIdentities, idx);
      #            if (identityNormalPositions.exists(identity))
      #                normalPositions.insert(_hwnd, identityNormalPositions.lookup(identity));
      #
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #translate
      #void translate(str _en, str _local)
      #{
      #    ;
      #    translations.insert(_en, _local);
      #}
    ENDSOURCE
    SOURCE #subscribe
      #void subscribe(str _eventID, Object _o)
      #{
      #    this.getEvent(_eventID).add(_o);
      #}
    ENDSOURCE
    SOURCE #autoheight
      #void autoHeight()
      #{
      #    int x,y,w,h;
      #    int xt,yt,wt,ht;
      #    int h2;
      #    ;
      #    [xt,yt,wt,ht]=element.getWindowRect(tabs.Hwnd());
      #    [x,y,w,h]=element.getWindowRect(this.Hwnd());
      #    //ht = tabs.heightValue();
      #//    this.moveWindow(this.resizeHwnd(),x,y,_value,h-5,true);
      #    ht -= heightDecrement;
      #    if (ht!=h)
      #    {
      #        WINAPI::setWindowPos(this.Hwnd(),0,0, w - x, ht - y, true,false,
      #            32 //#SWP_FRAMECHANGED
      #            +
      #            256 //#SWP_NOCOPYBITS
      #        );
      #    }
      #}
    ENDSOURCE
    SOURCE #confirm
      #boolean confirm(str _message)
      #{
      #    return Box::yesNo(_message,
      #                DialogButton::No, 'tabax') == DialogButton::Yes;
      #}
    ENDSOURCE
    SOURCE #isZoomed
      #boolean isZoomed(int _handle)
      #{
      #    return isZoomedFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #isAltButtonDown
      # // returns true if the shift button is pressed at the time of invocation
      ##define.VK_ALT(0x12)
      #static boolean isAltButtonDown()
      #{
      #    DLL         _winApiDLL      = new DLL('USER32');
      #    DLLFunction _getKeyState    = new DLLFunction(_winApiDLL, 'GetKeyState');
      #    int retval;
      #
      #    _getKeyState.returns(ExtTypes::Word);
      #    _getKeyState.arg(ExtTypes::DWord);
      #
      #    retval = _getKeyState.call(#VK_ALT);
      #
      #    return retval > 0x7FFF;
      #}
    ENDSOURCE
    SOURCE #topmost
      #HWND topmost()
      #{
      #    return topmost;
      #}
    ENDSOURCE
    SOURCE #formByName
      #TreeNode formByName(str _name)
      #{
      #    return TreeNode::findNode(@'\Forms\'+_name);
      #}
    ENDSOURCE
    SOURCE #controlByName
      #/// returns control from form _form with the name _name
      #TreeNode controlByName(TreeNode _form, str _name)
      #{
      #    TreeNodeTraverser i = new TreeNodeTraverser(_form);
      #    TreeNode node = i.next();
      #    while (node)
      #    {
      #        if (match(@": +name: +#"+_name+': +', node.AOTgetProperties()))
      #            return node;
      #        node = i.next();
      #    }
      #    return null;
      #}
    ENDSOURCE
    SOURCE #tabIsSelected
      #boolean tabIsSelected(FormTabPageControl _page)
      #{
      #    return this.tabIndex(_page) ==
      #            WinApi::sendMessageEx(this.getParent(_page.hWnd()), #TCM_GETCURSEL, 0, 0);
      #}
    ENDSOURCE
    SOURCE #tabIndex
      #int tabIndex(FormTabPageControl tabPageControl)
      #{
      #    int hWnd;
      #    int i;
      #    int pos;
      #    str GetClassName(int _hWnd)
      #    {
      #        DLL         _Userdll        = new DLL("User32.dll");
      #        DLLFunction _getClassName   = new DLLFunction(_Userdll, "GetClassNameA");
      #        Binary      className       = new Binary(100);
      #        ;
      #        _getClassName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        _getClassName.returns(ExtTypes::DWord);
      #        if (_getClassName.call(_hWnd, className, 100))
      #            return className.string(0);
      #        else
      #            return "";
      #    }
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        pos = 0;
      #        hWnd = tabPageControl.hWnd();
      #        while (hWnd)
      #        {
      #            hWnd = winapi::getWindow(hWnd, #GW_HWNDPREV);
      #            if (hWnd && GetClassName(hWnd) == #PaneWindowCL)
      #                pos++;
      #        }
      #    }
      #    return pos;
      #}
    ENDSOURCE
    SOURCE #setTabSelected
      #int setTabSelected(FormTabPageControl _page)
      #{
      #    int ret = WinApi::sendMessageEx(this.getParent(_page.hWnd()), #TCM_SETCURSEL, this.tabIndex(_page), 0);
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #asserthasAccess
      #void assertHasAccess(SecurityKeyID _key, AccessType _type=AccessType::Edit, str _message='')
      #{
      #    DictSecurityKey key=new DictSecurityKey(_key);
      #    ;
      #    if (!hasSecuritykeyAccess(_key, _type))
      #        throw new error(
      #            _message ? _message :
      #            strFmt(
      #                element.getText('There is no access to "%1"'),
      #                key.label()
      #            )
      #         );
      #}
    ENDSOURCE
    SOURCE #assertDevelopment
      #void assertDevelopment()
      #{
      #;
      #    this.assertHasAccess(securityKeyNum(SysDevelopment));
      #}
    ENDSOURCE
    SOURCE #processEditBox
      #void processEditBox(str _s)
      #{
      #    TreeNode node = TreeNode::findNode(_s);
      #    boolean skipDefault;
      #    str restOfString()
      #    {
      #        return subStr(_s, 2, strLen(_s)-1);
      #    }
      #;
      #    __eventHandlersEnumerator__ = element.getEvent(identifierStr(beforeStringInput)).getEnumerator();
      #    while(__eventHandlersEnumerator__.moveNext() && !skipDefault)
      #        skipDefault = __eventHandlersEnumerator__.current().beforeStringInput(this, _s);
      #    if (!skipDefault)
      #    {
      #        if (node)
      #        {
      #            if (node.handle() == classNum(MemberFunction))
      #                node.AOTedit();
      #            else
      #                node.AOTnewWindow();
      #        }
      #        else if (this.AxPath_accepts(_s))
      #            this.AxPath_go(_s);
      #        else if (this.strStartsWith(_s, '?'))
      #            this.eval(restOfString());
      #        else if (this.strStartsWith(_s, '!'))
      #            this.runScript(restOfString());
      #        //else
      #            //this.axSearch(searchEd.text());
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_fromFormRun
      #str AxPath_fromFormRun(FormRun _form, Args _args = _form.args())
      #{
      #    str ret;
      #    SysDictEnum menuItemTypeEnum;
      #    RecID recID;
      #;
      #    if (!_args.caller())
      #    {
      #        menuItemTypeEnum = new SysDictEnum(enumNum(MenuItemType));
      #        ret = #AxPath_prefix + '://' + #AxPath_MenuItemName + '/' +
      #            menuItemTypeEnum.value2Symbol(_args.menuItemType())
      #            + '/' + _args.menuItemName();
      #
      #        ret += '?' + fieldStr(Common, dataAreaId) + '=' + curext(); // Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
      #
      #        if (_form.dataSourceCount())
      #        {
      #            recID = _form.dataSource(1).cursor().RecId;
      #            if (recID)
      #                ret += '&' + this.AxPath_keyByCommon(_form.dataSource(1).cursor());
      #        }
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_getLineAndPos
      #container AxPath_getLineAndPos(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int line;
      #    int pos;
      #    int i;
      #    str name;
      #    str value;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='line')
      #            line=str2int(value);
      #        if (name=='pos')
      #            pos=str2int(value);
      #    }
      #    return [line, pos];
      #}
    ENDSOURCE
    SOURCE #menuItemTypeBySymbol
      #MenuItemType menuItemTypeBySymbol(str _symbol)
      #{
      #    return new SysDictEnum(enumNum(MenuItemType)).symbol2Value(_symbol);
      #}
    ENDSOURCE
    SOURCE #strStartsWith
      #boolean strStartsWith(str _s, str _possiblePrefix)
      #{
      #    return subStr(_s, 1, strLen(_possiblePrefix)) == _possiblePrefix;
      #}
    ENDSOURCE
    SOURCE #treeNode2TableID
      #TableID treeNode2TableID(TreeNode _node)
      #{
      #    TreeNode currentNode=_node;
      #    TableID ret;
      #    while (currentNode &&  !ret)
      #    {
      #        ret = SysTableBrowser::treeNode2TableId(currentNode);
      #        currentNode = currentNode.AOTparent();
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #currentSysContextMenu
      #SysContextMenu currentSysContextMenu()
      #{
      #    SysContextMenu ret;
      #    TreeNode node;
      #;
      #    if (this.isEditor(topmost))
      #        node = this.getCurMethod(topmost);
      #
      #    if (node)
      #        ret = new SysContextMenuTreeNode(node);
      #    else
      #        ret = new SysContextMenuAOT();
      #
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #strEndsWith
      #boolean strEndsWith(str _sourceText, str _possibleSuffix)
      #{
      #    return subStr(_sourceText, strLen(_sourceText), -strLen(_possibleSuffix)) == _possibleSuffix;
      #}
      #
    ENDSOURCE
    SOURCE #isEditor
      #boolean isEditor(HWND _hwnd)
      #{
      #    str name = winapi::getWindowText(_hWnd);
      #    int i;
      #;
      #    for(i=1; i<=conLen(editorSuffixes); i++)
      #        if (this.strEndsWith(name, conPeek(editorSuffixes, i)))
      #            return true;
      #    return false;
      #}
    ENDSOURCE
    SOURCE #togglePause
      #void togglePause()
      #{
      #    if (paused)
      #        this.play();
      #    else
      #        this.pause();
      #}
    ENDSOURCE
    SOURCE #pause
      #/// Stop all backround tasks
      #void pause()
      #{
      #;
      #    if (windowsScanTimer)
      #    {
      #        this.cancelTimeOut(windowsScanTimer);
      #        windowsScanTimer = 0;
      #    }
      #    paused = true;
      #
      #}
    ENDSOURCE
    SOURCE #play
      #/// start all background tasks
      #void play()
      #{
      #    if (!windowsScanTimer)
      #        this.buildButtons();
      #
      #    paused = false;
      #    //this.loadImage(PlayPauseBtn, 'pauseBut');
      #}
    ENDSOURCE
    SOURCE #urlEscape
      #str urlEscape(str _s)
      #{
      #    DLL             dll = new DLL("shlwapi.dll");
      #    DLLFunction     URLEscape = new DLLFunction(dll, "UrlEscapeA");
      #    Binary          escaped = new Binary(strlen(_s)+1);
      #    Binary          cnt = new Binary(4);
      #    #define.E_POINTER(0x80004003)
      #    ;
      #    URLEscape.arg(ExtTypes::String, ExtTypes::Pointer, ExtTypes::Pointer, ExtTypes::DWord);
      #    URLEscape.returns(ExtTypes::DWord);
      #    cnt.dWord(0, strlen(_s)+1);
      #    if (URLEscape.call(_s, escaped, cnt, 0) == #E_POINTER)
      #    {
      #        escaped = new Binary(cnt.dWord(0)+1);
      #        URLEscape.call(_s, escaped, cnt, 0);
      #    }
      #    return escaped.string(0);
      #}
    ENDSOURCE
    SOURCE #axSearch
      #void axSearch(str _text)
      #{
      #;
      #    WinApi::shellExecute(
      #    @'http://www.google.com/custom?cx=017570198198700603454%3A2g4miqgpmoe&q='
      #    +
      #    this.urlEscape(_text)
      #    +
      #    @'&cof=CX%3AAxSearch%3BFORID%3A0'
      #    );
      #}
    ENDSOURCE
    SOURCE #task
      #public int task(int _taskId)
      #{
      #    #task
      #    int ret;
      #    if (_taskId != #taskEsc)
      #    ret = super(_taskId);
      #
      #    //if (_taskID==#taskEnter)
      #        //this.processEditBox(searchEd.text());
      #
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #currentTable
      #tableID currentTable()
      #{
      #    #TreeNodeSysNodeType
      #    SysFormRun formRun;
      #    FormDataSource ds;
      #    TableID tableID;
      #    SysContextMenu context;
      #    TreeNode node;
      #;
      #    formRun=element.currentFormRun();
      #    if (!formRun)
      #        formRun=Infolog.setLastActivatedForm().object();
      #
      #    if(formRun && formRun.dataSourceCount()>0)
      #    {
      #        ds=formRun.objectSet();
      #        if (ds)
      #            tableID=ds.table();
      #    }
      #    if (!tableID)
      #    {
      #        context = this.currentSysContextMenu();
      #        if (context)
      #        {
      #            node = context.first();
      #            while (node && !tableID)
      #            {
      #                tableID = this.treeNode2TableID(node);
      #                if (tableID)
      #                    tableID = this.treeNode2TableID(node);
      #                node = context.next();
      #            }
      #        }
      #    }
      #    return tableID;
      #}
    ENDSOURCE
    SOURCE #installPlugs
      #void installPlugs()
      #{
      #    #File
      #    container parseName(str _s)
      #    {
      #        int pos=strscan(_s, '_', 1, strLen(_s));
      #        return [subStr(_s, 1, pos-1), subStr(_s, pos+1, strLen(_s) - pos)];
      #    }
      #
      #    void addButton(str _path, str _fileName)
      #    {
      #        str name = subStr(_fileName, 1, strLen(_fileName) - 4);
      #        FormFunctionButtonControl   button;
      #        str type;
      #        str itemName;
      #        ;
      #        [type, itemName] = parseName(name);
      #        /*button = plugTools.addControl(FormControlType::MenuFunctionButton, name+'_button');
      #        if (type=='action')
      #            button.menuItemType(MenuItemType::Action);
      #
      #        if (type=='display')
      #            button.menuItemType(MenuItemType::Display);
      #
      #        if (type=='output')
      #            button.menuItemType(MenuItemType::Output);
      #
      #        button.menuItemName(itemName);
      #        button.buttonDisplay(FormButtonDisplay::ImageOnly);
      #        button.border(FormButtonBorder::Flat);
      #        button.backStyle(FormBackStyle::Transparent);
      #        button.normalImage(_path); */
      #    }
      #    FileName fullFileName(FileName _path, FileName _fileName)
      #    {
      #        FileName    pathName;
      #        FileName    fileName;
      #        FileName    fileExtension;
      #        ;
      #        [pathName,fileName,fileExtension] = fileNameSplit(_fileName);
      #        return _path + '\\' + fileName + fileExtension;
      #    }
      #
      #    void findFiles(FileName _path, FileName _fileName)
      #    {
      #        FileName    fileName;
      #        int         hdl;
      #        ;
      #        if (WinAPI::folderExists(_path))
      #        {
      #            [hdl, fileName] = WinApi::findFirstFile(fullFileName(_path,_fileName));
      #            while (fileName)
      #            {
      #                if (WinAPI::fileExists(fullFileName(_path,fileName)))
      #                    addButton(fullFileName(_path, fileName), fileName);
      #                fileName = WinApi::findNextFile(hdl);
      #            }
      #            WinApi::findClose(hdl);
      #        }
      #    }
      #    findFiles(xInfo::directory(DirectoryType::Include)+'Tabax\\Plugs', '*.'+#imageExt);
      #
      #}
    ENDSOURCE
    SOURCE #toStr
      #/// returns the string representation of given argument
      #str toStr(AnyType _value)
      #{
      #    Object o;
      #    int i;
      #    str ret;
      #;
      #    if(typeOf(_value)==Types::AnyType && !_value)
      #        return '<NoResult>';
      #    if(typeOf(_value)==Types::Class)
      #    {
      #        o=_value;
      #        return strFmt('%1', o.toString());
      #    }
      #    if(typeOf(_value)==Types::Container)
      #    {
      #        for(i=1;i<=conLen(_value);i++)
      #        {
      #            if(ret)
      #                ret+=", ";
      #            ret += this.toStr(conPeek(_value, i));
      #        }
      #        return "["+ret+"]";
      #    }
      #    if(typeOf(_value)==Types::String || typeOf(_value)==Types::VarString)
      #    {
      #        return strFmt("'%1'", _value);
      #    }
      #    return strFmt('%1', _value);
      #}
      #
    ENDSOURCE
    SOURCE #run
      #public void run()
      #{
      #    SysGlobalCache cache=infolog.globalCache();
      #    FormRun formRun;
      #;
      #    cache.set(this.name(), 'instance', this);
      #    super();
      #    this.buildButtons();
      #    this.play();
      #}
    ENDSOURCE
    SOURCE #isIconic
      #boolean isIconic(int _handle)
      #{
      #    return isIconicFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #runSysContextMenu
      #void runSysContextMenu(identifiername _menuItemName, MenuItemType _menuItemType, SysContextMenu _context = this.currentSysContextMenu())
      #{
      #    MenuFunction menuFunction;
      #    Args         args;
      #;
      #    if (_context)
      #    {
      #        args = new Args();
      #        if(_context.verifyItem(_menuItemName, _menuItemType))
      #        {
      #            menuFunction = new MenuFunction(_menuItemName, _menuItemType);
      #            args.parmObject(_context);
      #            args.caller(this);
      #            menuFunction.run(args);
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #truncHeader
      #str truncHeader(str _h)
      #{
      #    if (maxCaptionSize && (strlen (_h) > maxCaptionSize))
      #    {
      #        _h = strdel (_h, maxCaptionSize, strlen(_h));
      #        _h +=  "...";
      #    }
      #    return _h;
      #}
      #
    ENDSOURCE
    SOURCE #resize
      #public void resize(int _width, int _height)
      #{
      #    super(_width, _height);
      #    element.adjustTabPageSize(tabs);
      #}
    ENDSOURCE
    SOURCE #currentFormRun
      #FormRun currentFormRun()
      #{
      #    return currentFormRun ? currentFormRun.object() : null;
      #}
    ENDSOURCE
    SOURCE #loadImage
      #void loadImage(FormButtonControl _but, str _name)
      #{
      #    str imgDir=XInfo::directory(DirectoryType::Include);
      #    str subPath = _name+'.' + #imageExt;
      #    str imageFilePath = this.getResourcePath(subPath);
      #;
      #    if (!imageFilePath)
      #       // warning("Tabax: Image not found: '" + this.fullInculdePath(subPath) + "' or resource '"+ this.resourceName(subPath)+"'");
      #    _but.normalImage(imageFilePath);
      #}
    ENDSOURCE
    SOURCE #isWindowVisible
      #boolean isWindowVisible(int _handle)
      #{
      #    return isWindowVisibleFun.call(_handle)? true:false;
      #}
    ENDSOURCE
    SOURCE #moveWindow
      #boolean moveWindow(HWND _handle, int _x, int _y, int _w, int _h, boolean _repaint)
      #{
      #  boolean ret;
      #    DLL         _DLL             = new DLL('USER32');
      #    DLLFunction _setwPos         = new DLLFunction(_DLL, 'MoveWindow');
      #    int         _dllret;
      #    ;
      #    ret = FALSE;
      #
      #    _setwPos.returns(ExtTypes::DWord); // BOOL
      #    _setwPos.arg(ExtTypes::DWord);     // handle window
      #    _setwPos.arg(ExtTypes::DWord);     // x
      #    _setwPos.arg(ExtTypes::DWord);     // y
      #    _setwPos.arg(ExtTypes::DWord);     // cx
      #    _setwPos.arg(ExtTypes::DWord);     // cy
      #    _setwPos.arg(ExtTypes::DWord);     // repaint;
      #
      #    _dllRet = _setwPos.call(_handle,  _x, _y, _w, _h, _repaint);
      #
      #    return _dllRet?true:false;
      #}
    ENDSOURCE
    SOURCE #setWPos
      #int setWPos(
      #                           int              _handle,
      #                           int              _hWndInsertAfter,
      #                           int              _left,
      #                           int              _top,
      #                           int              _width,
      #                           int              _height,
      #                           int              _flags    = 0     )
      #
      #{
      #  boolean ret;
      #    DLL         _DLL             = new DLL('USER32');
      #    DLLFunction _setwPos         = new DLLFunction(_DLL, 'SetWindowPos');
      #    int         _dllret;
      #    ;
      #    ret = FALSE;
      #
      #    _setwPos.returns(ExtTypes::DWord); // BOOL
      #    _setwPos.arg(ExtTypes::DWord);     // handle window
      #    _setwPos.arg(ExtTypes::DWord);     // handle to Z Order window
      #    _setwPos.arg(ExtTypes::DWord);     // x
      #    _setwPos.arg(ExtTypes::DWord);     // y
      #    _setwPos.arg(ExtTypes::DWord);     // cx
      #    _setwPos.arg(ExtTypes::DWord);     // cy
      #    _setwPos.arg(ExtTypes::DWord);     // flags;
      #
      #    _dllRet = _setwPos.call(_handle, _hWndInsertAfter, _left, _top, _width, _height, _flags );
      #    if (_dllRet) {
      #        ret = TRUE;
      #    }
      #
      #  return ret;
      #}
    ENDSOURCE
    SOURCE #openedProjects
      #Map openedProjects()
      #{
      #    if(!openedProjects)
      #        openedProjects=new Map(Types::String, Types::Integer);
      #    return openedProjects;
      #}
    ENDSOURCE
    SOURCE #setCap
      #void setCap(str _txt)
      #{
      #    this.design().caption('tabax '+v+'\\'+_txt);
      #}
    ENDSOURCE
    SOURCE #fitWindow
      #container fitWindow(hwnd _w, boolean _skipPrepare = false, boolean _skipWidth = false, boolean _skipHeight=false)
      #{
      #    int x1;
      #    int y1;
      #    int x2;
      #    int y2;
      #
      #    int wx1;
      #    int wy1;
      #    int wx2;
      #    int wy2;
      #    int maxw;
      #    int maxh;
      #    int w;
      #    int h;
      #    Binary msg = new Binary(30);
      #    int                 i;
      #    boolean ret;
      #    boolean fixedWidth;
      #    boolean fixedHeight;
      #;
      #    if (this.isIconic(_w))
      #        this.openIcon(_w);
      #
      #    if (!_skipPrepare)
      #    {
      #        this.prepareToSide(_w);
      #
      #        for (i=1;i<=4;i++)
      #           if (peekMessage.call(msg, 0, 0, 0, 1))
      #           {
      #               TranslateMessage.call(msg);
      #               dispatchMessage.call(msg);
      #           }
      #    }
      #
      #    [x1,y1,x2,y2]=element.getClientRect(MdiClient);
      #
      #    [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #    [maxw, maxh] = this.getMaxSize(_w);
      #    //w=min(x2-x1, maxw);
      #    //h=min(y2-y1, maxh);
      #    w=x2-x1;
      #    h=y2-y1;
      #    if (_skipWidth)
      #        w = wx2 - wx1;
      #    if (_skipHeight)
      #        h = wy2 - wy1;
      #    if ([wx1,wy1,wx2,wy2]!=[0, 0, w, h])
      #    {
      #        ret = WinApi::setWindowPos(_w, 0, 0, w, h, false, false, #SWP_NOACTIVATE);
      #        [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #
      #        for (i=1;i<=4;i++)
      #           if (peekMessage.call(msg, 0, 0, 0, 1))
      #           {
      #               TranslateMessage.call(msg);
      #               dispatchMessage.call(msg);
      #           }
      #        [x1,y1,x2,y2]=element.getClientRect(MdiClient);
      #        w=x2-x1;
      #        h=y2-y1;
      #        if (_skipWidth)
      #            w = wx2 - wx1 + 1;
      #        if (_skipHeight)
      #            h = wy2 - wy1 + 1;
      #
      #        ret = WinApi::setWindowPos(_w, 0, 0, w, h, false, false, #SWP_NOACTIVATE);
      #        [wx1,wy1,wx2,wy2] = element.getMdiClientRelativeRect(_w);
      #        fixedWidth = wx2 != (x2-x1);
      #        fixedHeight = wy2 != (y2-y1);
      #    }
      #    return [fixedWidth, fixedHeight];
      #}
    ENDSOURCE
    SOURCE #saveAll
      #void saveAll()
      #{
      #    ;
      #    xSysLastValue::saveLast(this);
      #}
    ENDSOURCE
    SOURCE #addMRUProject
      #void addMRUProject(str _name)
      #{
      #    int idx=conFind(mruProjects, _name);
      #    if(idx)
      #        mruProjects=conDel(mruProjects, idx, 1);
      #    mruProjects=[_name]+mruProjects;
      #}
    ENDSOURCE
    SOURCE #bottomSide
      #void bottomSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,(y2-y1)/2+1,x2-x1, (y2-y1)/2-2);
      #}
    ENDSOURCE
    SOURCE #topSide
      #void topSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,0,x2-x1, (y2-y1)/2);
      #}
    ENDSOURCE
    SOURCE #loadImages
      #void loadImages()
      #{
      #    #localmacro.but
      #        this.loadImage(%1,"%1");
      #    #endmacro
      #;
      #   // #but(leftbut)
      #    //#but(rightbut)
      #    //#but(tilehorbut)
      #    //#but(topbut)
      #    //#but(bottombut)
      #    //#but(tileverbut)
      #    //#but(xrefBut)
      #    //#but(compareBut)
      #    //#but(preferencesBut)
      #    //#but(addinsBut)
      #    //#but(editFieldBut)
      #    //#but(openApplObjBut)
      #}
    ENDSOURCE
    SOURCE #getParent
      #hwnd getParent(hwnd _window=this.hWnd())
      #{
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetParent');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord);
      #
      #    return fun.call(_window);
      #}
    ENDSOURCE
    SOURCE #lists_top
      #private List lists_top()
      #{
      #    return lists.value(lists_sp);
      #}
    ENDSOURCE
    SOURCE #newIterator
      #void newIterator(TreeNode _node)
      #{
      #    iterators=new Array(Types::Class);
      #    lists=new Array(Types::Class);
      #    tniterator=_node.AOTiterator();
      #}
    ENDSOURCE
    SOURCE #canClose
      #public boolean canClose()
      #{
      #//    if(!collapsed)
      #//    {
      #//        this.collapse();
      #//        return false;
      #//    }
      #    return true;
      #}
    ENDSOURCE
    SOURCE #prepareToSide
      #container prepareToSide(HWND _w)
      #{
      #    //hWnd MdiClient = WinAPI::FindWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #;
      #    WinAPI::sendMessageEx(_w, #WM_SYSCOMMAND, #SC_RESTORE, 0);
      #    return this.getClientRect(MdiClient);
      #}
    ENDSOURCE
    SOURCE #getClientRect
      #container getClientRect(hwnd _window)
      #{
      #    Binary      data            = new Binary(32);
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetClientRect');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #    fun.call(_window, data);
      #
      #    return [data.dWord(0), data.dWord(4), data.dWord(8), data.dWord(12)];
      #}
    ENDSOURCE
    SOURCE #leftSide
      #void leftSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,0,0,(x2-x1)/2, y2-y1);
      #}
    ENDSOURCE
    SOURCE #rightSide
      #void rightSide(hwnd _w)
      #{
      #    int x1,y1,x2,y2;
      #    ;
      #    [x1,y1,x2,y2]=this.prepareToSide(_w);
      #    WinApi::setWindowPos(_w,(x2-x1)/2+1,0,(x2-x1)-((x2-x1)/2+1)-2, y2-y1);
      #}
    ENDSOURCE
    SOURCE #getWindowRect
      #container getWindowRect(hwnd _window)
      #{
      #    Binary      data            = new Binary(32);
      #    DLL         _winApiDLL      = new DLL('user32');
      #    DLLFunction fun  = new DLLFunction(_winApiDLL, 'GetWindowRect');
      #
      #    fun.returns(ExtTypes::DWord);
      #
      #    fun.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #    fun.call(_window, data);
      #
      #    return [data.dWord(0), data.dWord(4), data.dWord(8), data.dWord(12)];
      #}
    ENDSOURCE
    SOURCE #close
      #public void close()
      #{
      #    str name=this.name();
      #    SysGlobalCache cache=infolog.globalCache();
      #;
      #    #fireEvent(beforeClose, (this))
      #    cache.remove(name, 'instance');
      #    this.pause();
      #    super();
      #    element.removeTabPageImageList(tabs);
      #    this.saveAll();
      #}
    ENDSOURCE
    SOURCE #applyChanges
      #void applyChanges()
      #{
      #    container forRemove;
      #    container forUpd;
      #    container forAdd;
      #    FormDesign fd = element.design();
      #    int i;
      #    int id;
      #//    FormTreeItem item;
      #    HWnd handle;
      #    int image;
      #    str title;
      #    FormTabPageControl itemHandle;
      #    FormTabPageControl activePage;
      #    int selected;
      #    boolean updated;
      #    boolean historyChanged;
      #    str windowText;
      #    int tabsCount;
      #    ;
      #    [forRemove, forUpd, forAdd, selected]=this.changes();
      #    if(conLen(forRemove)>0 || conLen(forAdd)>0 || conLen(forUpd)>0)
      #    {
      #        //tabs.lockWindowUpdate(true);
      #        updated=true;
      #
      #        for(i=1;i<=conLen(forUpd);i++)
      #        {
      #            handle=conPeek(forUpd, i);
      #            itemHandle=windows.lookup(handle);
      #            windowText=WinApi::getWindowText(handle);
      #            [image, title]=this.getImageAndTitle(windowText);
      #            itemHandle.caption(element.truncHeader(title));
      #            itemHandle.helpText(title);
      #            titles.insert(handle, windowText);
      #            #fireEvent(afterWindowUpdated, (this, handle, title))
      #        }
      #
      #        //itemHandle=lastAdded;
      #        for(i=1;i<=conLen(forAdd);i++)
      #        {
      #            handle=conPeek(forAdd, i);
      #            windowText=WinApi::getWindowText(handle);
      #            [image, title]=this.getImageAndTitle(windowText);
      #            if(image==imgApp.image(#ImageProject))
      #            {
      #                this.addMRUProject(title);
      #                if(!this.openedProjects().exists(title))
      #                    this.openedProjects().insert(title, handle);
      #                historyChanged=true;
      #            }
      #            //item = new FormTreeItem(title,image,0, handle);
      #            //itemHandle=tree.addItem(0, itemHandle, item);
      #            itemHandle=tabs.addControl(FormControlType::TabPage, 't'+int2str(handle));
      #            #if.ax4
      #                itemHandle.scrollbars(false);
      #            #endif
      #            itemHandle.caption(element.truncHeader(title));
      #            itemHandle.helpText(title);
      #            itemHandle.verticalSpacing(0, AutoMode::Fixed);
      #            itemHandle.topMargin(0, AutoMode::Fixed);
      #            itemHandle.bottomMargin(0, AutoMode::Fixed);
      #            //itemHandle.
      #            //heightDecrement = itemHandle.topMargin() + itemHandle.bottomMargin() / 2;
      #            element.setTabPageImageIndex(itemHandle, image+1);
      #
      #            //itemHandle=tree.addItem(0, 0, item);
      #            //lastAdded=itemHandle;
      #            windows.insert(handle, itemHandle);
      #            titles.insert(handle, windowText);
      #            this.processWindowAdd(handle);
      #            #fireEvent(afterWindowOpened, (this, handle, title))
      #        }
      #        //tabs.lockWindowUpdate(false);
      #    }
      #    if(conLen(forRemove))
      #    {
      #        if(tabs.tabs())
      #        {
      #            inDeletion=true;
      #            itemHandle=tabs.controlNum(1);
      #            itemHandle.activatePage();
      #            inDeletion=false;
      #        }
      #    }
      #
      #    for(i=1;i<=conLen(forRemove);i++)
      #    {
      #        handle=conPeek(forRemove, i);
      #        itemHandle=windows.lookup(handle);
      #        tabsCount = tabs.controlCount();
      #        if (maximized.in(handle))
      #        {
      #//            if (formIdentity.exists(handle))
      #//                maximizedIdentities += formIdentity.lookup(handle);
      #            maximized.remove(handle);
      #        }
      #        this.processFormIdentity_closing(handle);
      #        if (oldWindows.exists(handle))
      #            oldWindows.remove(handle);
      #
      #        if (!itemHandle.isActivePage() || tabsCount==1)
      #        {
      #            windows.remove(handle);
      #            id = itemHandle.id();
      #            if (desktopWindow)
      #                this.apiLockWindowUpdate(desktopWindow);
      #            try
      #            {
      #                element.design().removeControl(id);
      #            }
      #            catch
      #            {
      #            }
      #            if (desktopWindow)
      #                this.apiLockWindowUpdate(0);
      #           titles.remove(handle);
      #        }
      #        if (fixedWindows.exists(handle))
      #            fixedWindows.remove(handle);
      #        #fireEvent(afterWindowClosed, (this, handle))
      #    }
      #    if(updated)
      #        element.adjustTabPageSize(tabs);
      #
      #    if(selected)
      #    {
      #        itemHandle=windows.lookup(selected);
      #        if(!this.tabIsSelected(itemHandle))
      #        {
      #            this.setTabSelected(itemHandle);
      #            itemHandle.activatePage();
      #            updated=true;
      #        }
      #    }
      #    //tabs.lockWindowUpdate(false);
      #    element.autoHeight();
      #}
    ENDSOURCE
    SOURCE #Changes
      #container changes()
      #{
      #    MapIterator i=new MapIterator(windows);
      #    container actual=this.getWindows();
      #    container existing;
      #    int j;
      #    container forRemove;
      #    container forUpd;
      #    container forAdd;
      #    hwnd selected;
      #    ;
      #    [selected]=actual;
      #    while(i.more())
      #    {
      #        if(conFind(actual, i.key()))
      #        {
      #            if(titles.lookup(i.key())!=WinApi::getWindowText(i.key()))
      #                forUpd+=i.key();
      #            existing+=i.key();
      #        }
      #        else
      #        {
      #            forRemove+=i.key();
      #        }
      #        i.next();
      #    }
      #
      #    for(j=1;j<=conLen(actual);j++)
      #    {
      #        if(!conFind(existing, conPeek(actual, j)))
      #            forAdd+=[conPeek(actual, j)];
      #    }
      #    return [forRemove, forUpd, forAdd, selected];
      #}
    ENDSOURCE
    SOURCE #getImageAndTitle
      #container getImageAndTitle(str _header)
      #{
      #    str path;
      #    int i, img;
      #    boolean startsWith(str _s1, str _s2){
      #        return strScan(_s1, _s2, 1, strLen(_s1))==1;
      #    }
      #    ;
      #    for(i=1;i<=conlen(this.pathes());i++)
      #    {
      #        [path, img]=conPeek(this.pathes(),i);
      #        if(startsWith(_header, path))
      #            return [imgApp.image(img),
      #                strDel(_header, 1, strLen(path))];
      #
      #        if (!path)
      #            switch (_header)
      #            {
      #                case "Ðåïîçèòàðèé ïðèêëàäíûõ îáúåêòîâ":
      #                    return [imgApp.image(#ImageAOT), _header];
      #                case @"\Projects":
      #                    return [imgApp.image(#ImageProjects), _header];
      #            }
      #    }
      #
      #    return [0, _header];
      #}
    ENDSOURCE
    SOURCE #pathes
      #container pathes()
      #{
      #    if(!p)
      #        p=
      #        [
      #            ["\\Data Dictionary\\Tables\\", #imageTable],
      #            ["\\Data Dictionary\\Maps\\", #imageTableMap],
      #            ["\\Data Dictionary\\Views\\", #imageView],
      #            ["\\Data Dictionary\\Extended Data Types\\", #imageEDT],
      #            ["\\Data Dictionary\\Base Enums\\", #imageBaseEnum],
      #            #if.imageFeatureKey
      #            ["\\Data Dictionary\\Feature Keys\\", #imageFeatureKey],
      #            #endif
      #            ["\\Data Dictionary\\License Codes\\", #imageLicenseCode],
      #            ["\\Data Dictionary\\Configuration Keys\\", #imageConfigurationKeys],
      #            ["\\Data Dictionary\\Security Keys\\", #imageSecurityKeys],
      #            ["\\Data Dictionary\\Table Collections\\", #imageTableCollections],
      #            ["\\Macros\\", #imageMacros],
      #            ["\\Classes\\", #imageClass],
      #            ["\\Forms\\", #imageForm],
      #            ["\\Reports\\", #imageReport],
      #            ["\\Queries\\", #imageQuery],
      #            ["\\Jobs\\", #imageJob],
      #            ["\\Menus\\", #imageMenu],
      #            ["@SYS71148", #imageMenuMain],
      #            ["\\Menu Items\\Display\\", #ImageMenuDisplayItems],
      #            ["\\Menu Items\\Output\\", #imageMenuActionItems],
      #            ["\\Menu Items\\Action\\", #imageMenuOutputItems],
      #            ["\\System Documentation\\Classes\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Functions\\", #ImageDocumentationItemBlue],
      #            ["\\System Documentation\\Property\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Tables\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Types\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Enums\\", #ImageDocumentationItem],
      #            ["\\System Documentation\\Feature Keys\\", #ImageDocumentationItem],
      #            #if.ImageReference
      #            ["\\References\\", #ImageReference],
      #            #endif
      #            #if.imageHelpFile
      #            ["\\HTML Help Files\\", #imageHelpFile],
      #            #endif
      #            #localmacro.prefix
      #                [%1, #ImageProject],
      #            #endmacro
      #            #projectPrefixes
      #            ["", #ImagePlay]
      #        ];
      #    return p;
      #}
    ENDSOURCE
    SOURCE #getWindows
      #container getWindows()
      #{
      #    container ret;
      #    //hWnd MdiClient = WinAPI::FindWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #    hWnd child;
      #    str windowText;
      #    map     children = new map(Types::Integer, Types::String);
      #    int c;
      #    FormRun activeFormRun;
      #;
      #    topmost=0;
      #    second=0;
      #
      #    for (child = WinAPI::FindWindowEx(MdiClient, 0, '', '');
      #         child && !children.exists(child);
      #         child = WinAPI::FindWindowEx(MdiClient, child, '', ''))
      #    {
      #        if (Child != 0)
      #        {
      #            if (Children.exists(Child))
      #                break;
      #
      #            WindowText = WinAPI::getWindowText(child);
      #
      #            //if (WindowText != "" && isWindowVisible(child))
      #            if(this.isWindowVisible(child))
      #            {
      #                if (fitMaximized)
      #                    this.processMaximizations(child);
      #                if(!topmost)
      #                {
      #                    topmost=Child;
      #                    if(infolog.setLastActivatedForm())
      #                        activeFormRun=infolog.setLastActivatedForm().object();
      #                    if(activeFormRun && activeFormRun.hWnd()==topmost)
      #                    {
      #                        currentFormRun=new ObjectIdent(activeFormRun);
      #                        currentFormRun_hwnd = topmost;
      #                    }
      #                    else
      #                    {
      #                        if(this.currentFormRun() && currentFormRun_hwnd!=topmost)
      #                        {
      #                            currentFormRun_hwnd = 0;
      #                            currentFormRun=null;
      #                        }
      #                    }
      #                }
      #                else
      #                    if(!second)
      #                        second=Child;
      #                children.insert(Child, WindowText);
      #                ret+=[Child];
      #            }
      #        }
      #
      #        c ++;
      #        if (c > 1000)
      #            throw error("deadlock interrupted");
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #BuildButtons
      #void buildButtons()
      #{
      #;
      #    this.processFormIdentity();
      #    this.applyChanges();
      #    #fireEvent(tick, (this))
      #    windowsScanTimer = this.setTimeOut(identifierStr(buildButtons), #windowsScanTimer);
      #}
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    str dummy;
      #    int i;
      #    int img;
      #;
      #    v=#v;
      #    super();
      #    this.attachPlugins();
      #    editorSuffixes = [
      #        ' - Ðåäàêòîð',
      #        ' - Editor'
      #    ];
      #    oldWindows = new Map(Types::Integer, Types::Container);
      #    fixedWindows = new Map(Types::Integer, Types::Container);
      #    //menuUsageStatistics=new Map(Types::String, Types::Container);
      #    maximized = new Set(Types::Integer);
      #    this.loadDictionary();
      #    normalPositions = new Map(Types::Integer, Types::Container);
      #    formIdentity = new Map(Types::Integer, Types::String);
      #    identityNormalPositions = new Map(Types::String, Types::Container);
      #    retoreIfRestored  = new Set(Types::Integer);
      #
      #    this.setCap('windows');
      #    //vtxt.text('sidax v'+v);
      #    /*aboutBut.border(
      #    tableBrowserBut.border(
      #    editBut.border(
      #    tileHorBut.border(
      #        tileVerBut.border(
      #        leftBut.border(
      #        rightBut.border(
      #        topBut.border(
      #        bottomBut.border(
      #                FormButtonBorder::Flat
      #            ))))))))); */
      #    this.installPlugs();
      #    hand=WinApi::loadStdCursor(#IDC_CROSS);
      #    this.loadImages();
      #
      #    user32             = new DLL('USER32');
      #
      #    isIconicFun = new DLLFunction(user32, 'IsIconic');
      #    isIconicFun.returns(ExtTypes::DWord);
      #    isIconicFun.arg(ExtTypes::DWord);
      #
      #    isZoomedFun = new DLLFunction(user32, 'IsZoomed');
      #    isZoomedFun.returns(ExtTypes::DWord);
      #    isZoomedFun.arg(ExtTypes::DWord);
      #
      #
      #    isWindowVisibleFun = new DLLFunction(user32, 'IsWindowVisible');
      #    isWindowVisibleFun.returns(ExtTypes::DWord);
      #    isWindowVisibleFun.arg(ExtTypes::DWord);
      #
      #    OpenIconFun = new DLLFunction(user32, 'OpenIcon');
      #    OpenIconFun.returns(ExtTypes::DWord);
      #    OpenIconFun.arg(ExtTypes::DWord);
      #
      #   peekMessage     = new DLLFunction(user32, 'PeekMessageA');
      #   TranslateMessage= new DLLFunction(user32, 'TranslateMessage');
      #   dispatchMessage = new DLLFunction(user32, 'DispatchMessageA');
      #    peekMessage.arg(ExtTypes::POINTER, ExtTypes::DWORD, ExtTypes::DWORD, ExtTypes::DWORD, ExtTypes::DWORD);
      #    peekMessage.returns(ExtTypes::DWord);
      #
      #    TranslateMessage.arg(ExtTypes::Pointer);
      #    TranslateMessage.returns(ExtTypes::DWORD);
      #
      #    dispatchMessage.arg(ExtTypes::Pointer);
      #    dispatchMessage.returns(ExtTypes::DWord);
      #
      #    GetDesktopWindow = new DllFunction(user32, 'GetDesktopWindow');
      #    GetDesktopWindow.returns(ExtTypes::DWord);
      #
      #    LockWindowUpdate = new DllFunction(user32, 'LockWindowUpdate');
      #    LockWindowUpdate.returns(ExtTypes::DWord);
      #    LockWindowUpdate.arg(ExtTypes::DWord);
      #
      #    desktopWindow = this.GetDesktopWindow();
      #
      #    mdiClient = WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', '');
      #
      #    imgApp = new ImageListAppl_AOT();
      #    for(i=1;i<=conlen(this.pathes());i++)
      #    {
      #        [dummy, img]=conPeek(this.pathes(), i);
      #        imgApp.add(img);
      #    }
      #    //Tree.setImagelist(imgApp.imageList());
      #    //Tree.setStateImagelist(imgApp.imageList());
      #    element.setTabPageImageList(Tabs, imgApp.imageList());
      #
      #    windows=new Map(Types::Integer, Types::Class);
      #    titles=new Map(Types::Integer, Types::String);
      #    xSysLastValue::getLast(this);
      #}
      #
    ENDSOURCE
    SOURCE #initParmDefault
      #/*MAN
      #This method is called when no SysLastValue record can be found in xSysLastValue.GetLast()
      #*/
      #public void initParmDefault()
      #{
      #;
      #}
    ENDSOURCE
    SOURCE #unpack
      #public boolean unpack(container packedClass)
      #{
      #    int version     = RunBase::getVersion(packedClass);
      #
      #    switch (version)
      #    {
      #        case 5:
      #            [version, #List5] = packedClass;
      #            return true;
      #        case 6:
      #            [version, #List6] = packedClass;
      #            return true;
      #        case 7:
      #            [version, #List7] = packedClass;
      #            return true;
      #        case #CurrentVersion:
      #            [version, #CurrentList] = packedClass;
      #            return true;
      #        default :
      #            return false;
      #    }
      #
      #    return false;
      #}
    ENDSOURCE
    SOURCE #getDesktopWindow
      #HWnd getDesktopWindow()
      #{
      #    return GetDesktopWindow.call();
      #}
    ENDSOURCE
    SOURCE #apiLockWindowUpdate
      #boolean apiLockWindowUpdate(HWND _hwnd)
      #{
      #    return LockWindowUpdate.call(_hwnd);
      #}
    ENDSOURCE
    SOURCE #pack
      #public container pack()
      #{
      #;
      #    return [#CurrentVersion, #CurrentList];
      #}
    ENDSOURCE
    SOURCE #lastValueDataAreaId
      #public dataAreaId lastValueDataAreaId()
      #{
      #    //TODO:return 'dat';
      #    return curExt();
      #}
    ENDSOURCE
    SOURCE #lastValueDesignName
      #public identifiername lastValueDesignName()
      #{
      #    return '';
      #}
    ENDSOURCE
    SOURCE #lastValueElementName
      #public identifiername lastValueElementName()
      #{
      #    return this.name();
      #}
    ENDSOURCE
    SOURCE #lastValueType
      #public UtilElementType lastValueType()
      #{
      #    return UtilElementType::Form;
      #}
    ENDSOURCE
    SOURCE #lastValueUserId
      #public userId lastValueUserId()
      #{
      #    return curUserId();
      #}
    ENDSOURCE
    SOURCE #pop
      #private TreeNodeIterator pop()
      #{
      #    TreeNodeIterator ret=iterators.value(sp);
      #    ;
      #    //iterators.value(sp, null);
      #    sp--;
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #lists_pop
      #private List lists_pop()
      #{
      #    List ret=lists.value(lists_sp);
      #    ;
      #    //lists.value(lists_sp, null);
      #    lists_sp--;
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #push
      #private void push(TreeNodeIterator _iterator)
      #{
      #    ;
      #    sp++;
      #    iterators.value(sp, _iterator);
      #}
    ENDSOURCE
    SOURCE #Lists_push
      #private void lists_push(List _list)
      #{
      #    ;
      #    lists_sp++;
      #    lists.value(lists_sp, _list);
      #}
    ENDSOURCE
    SOURCE #nextNode
      #private TreeNode nextNode()
      #{
      #    return tniterator.next();
      #}
    ENDSOURCE
    SOURCE #next
      #boolean next()
      #{
      #    current=this.nextNode();
      #    while(!current && this.hasIterators())
      #    {
      #        tniterator=this.pop();
      #        currentList=this.lists_pop();
      #        current=this.nextNode();
      #    }
      #    if(current)
      #    {
      #        this.push(tniterator);
      #        this.lists_push(currentList);
      #        currentList=new List(Types::Class);
      #        tniterator=current.AOTiterator();
      #    }
      #    return current? true:false;
      #}
    ENDSOURCE
    SOURCE #hasIterators
      #private boolean hasIterators()
      #{
      #    return sp ? true:false;
      #}
    ENDSOURCE
    SOURCE #AdjustTabPageSize
      ##winapi
      #void adjustTabPageSize(FormTabControl tabPageControl)
      #{
      #    Binary  rect = new Binary(16);
      #    Binary  ptr = new Binary(4);
      #    int     size;
      #    int     style;
      #    int     width;
      #    int     w;
      #    int maxWidth;
      #    int minWidth;
      #    int     i;
      #    int     cnt;
      #    int GetWindowRect(int hWnd, Binary lpRect)
      #    {
      #        DLL             _Userdll            = new DLL('User32.dll');
      #        DLLFunction     _getWindowRect      = new DLLFunction(_Userdll, 'GetWindowRect');
      #        ;
      #        _getWindowRect.arg(ExtTypes::DWord, ExtTypes::Pointer);
      #        _getWindowRect.returns(ExtTypes::DWord);
      #        return _getWindowRect.call(hWnd, lpRect);
      #    }
      #    int setWindowLong(HWND _HWND, int _nIndex, int _dwNewLong)
      #    {
      #        DLL             _Userdll            = new DLL("User32.dll");
      #        DLLFunction     DLLFunction;
      #        ;
      #        DLLFunction = new DLLFunction(_Userdll,'SetWindowLongA');
      #        DLLFunction.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        DLLFunction.returns(ExtTypes::DWord);
      #
      #        return DLLFunction.call(_HWND, _nIndex, _dwNewLong);
      #    }
      #;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        ptr.binary(0, rect);
      #
      #        GetWindowRect(tabPageControl.hWnd() , rect);
      #        width = rect.dWord(8) - rect.dWord(0) - 4;
      #        cnt = 0;
      #        for (i=1;i<=tabPageControl.controlCount();i++)
      #            if (tabPageControl.controlNum(i).visible())
      #                cnt++;
      #        if (!cnt)
      #            cnt = 1;
      #
      #        WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, 0, ptr.dWord(0));
      #
      #        style = winapi::getWindowLong(tabPageControl.hWnd(), #GWL_STYLE);
      #        style = style & ~ #TCS_FIXEDWIDTH;
      #        style = style | #TCS_TOOLTIPS | #TCS_FORCELABELLEFT;
      #
      #        SetWindowLong(tabPageControl.hWnd(), #GWL_STYLE, style);
      #        cnt = WinApi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMCOUNT, 0, size);
      #
      #        w = 0;
      #        for (i=0;i<cnt;i++)
      #        {
      #            winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETITEMRECT, i, ptr.dWord(0));
      #            w += rect.dWord(8) - rect.dWord(0);
      #            maxWidth = max(maxWidth, rect.dWord(8) - rect.dWord(0));
      #            minWidth = min(minWidth, rect.dWord(8) - rect.dWord(0));
      #//            if (w > width)
      #//                break;
      #        }
      #
      #        cnt = max(1, cnt);
      #        size = width div cnt;
      #        if (maxTabSize)
      #            size=min(size, maxTabSize);
      #        if (minTabSize)
      #            size=max(size, minTabSize);
      #        if (sameTabSize && (maxTabSize * cnt)<=width)
      #            size = maxTabSize ? maxTabSize : min(maxWidth, w);
      #        size = min(size, width);
      #        size = (size & 0xffff) | ((rect.dWord(12) - rect.dWord(4)) << 16);
      #
      #        if (minTabSize)
      #            Winapi::SendMessageEx(tabPageControl.hWnd(), #TCM_SETMINTABWIDTH, 0, minTabSize);
      #        if (w > width || (maxTabSize && maxWidth > maxTabSize) || sameTabSize)
      #        {
      #            WinApi::SendMessageEx(tabPageControl.hWnd(), #TCM_SETITEMSIZE, 0, size);
      #
      #            style = style | #TCS_FIXEDWIDTH;
      #            SetWindowLong(tabPageControl.hWnd(), #GWL_STYLE, style);
      #        }
      #    }
      #}
      #
    ENDSOURCE
    SOURCE #HitTestTabPage
      #int hitTestTabPage(FormTabControl formTabControl)
      #{
      #    int cx, cy;
      #    Binary  TCHITTESTINFO = new Binary(12);
      #    Binary  ptr = new Binary(4);
      #    ;
      #    if (formTabControl && formTabControl.hWnd())
      #    {
      #        [cx, cy] = winapi::getCursorPos();
      #        [cx, cy] = winapi::screenToClient(FormTabControl.hWnd(), cx, cy);
      #        ptr.binary(0, TCHITTESTINFO);
      #        TCHITTESTINFO.dWord(0, cx);
      #        TCHITTESTINFO.dWord(4, cy);
      #        return winapi::sendMessageEx(FormTabControl.hWnd(), #TCM_HITTEST, 0, ptr.dWord(0)) + 1;
      #    }
      #    else return 0;
      #}
    ENDSOURCE
    SOURCE #RemoveTabPageImageList
      #void removeTabPageImageList(FormTabControl tabPageControl)
      #{
      #    int             hImageList;
      #    DLL             _dll                = new DLL("comctl32.dll");
      #    DLLFunction     ImageList_Destroy   = new DLLFunction(_dll, "ImageList_Destroy");
      #
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        hImageList = winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_GETIMAGELIST, 0, 0);
      #        if (hImageList)
      #        {
      #            winapi::sendMessageEx(tabPageControl.hWnd(), #TCM_SETIMAGELIST, 0, 0);
      #
      #            ImageList_Destroy.arg(ExtTypes::DWord);
      #            ImageList_Destroy.returns(ExtTypes::DWord);
      #            ImageList_Destroy.call(hImageList);
      #        }
      #    }
      #}
    ENDSOURCE
    SOURCE #SetTabPageImageIndex
      ##winapi
      #void setTabPageImageIndex(FormTabPageControl tabPageControl, int idx)
      #{
      #    int             hWnd;
      #    Binary          TCITEM;
      #    Binary          pointer;
      #    int             i, pos;
      #    str GetClassName(int _hWnd)
      #    {
      #        DLL         _Userdll        = new DLL("User32.dll");
      #        DLLFunction _getClassName   = new DLLFunction(_Userdll, "GetClassNameA");
      #        Binary      className       = new Binary(100);
      #        ;
      #        _getClassName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        _getClassName.returns(ExtTypes::DWord);
      #        if (_getClassName.call(_hWnd, className, 100))
      #            return className.string(0);
      #        else
      #            return "";
      #    }
      #    int GetParent(int _hWnd)
      #    {
      #        DLL         _Userdll        = new DLL("User32.dll");
      #        DLLFunction _getParent      = new DLLFunction(_Userdll, "GetParent");
      #        ;
      #        _getParent.arg(ExtTypes::DWord);
      #        _getParent.returns(ExtTypes::DWord);
      #        return _getParent.call(_hWnd);
      #    }
      #
      #    ;
      #    if (tabPageControl && tabPageControl.hWnd())
      #    {
      #        pos = 0;
      #        hWnd = tabPageControl.hWnd();
      #        while (hWnd)
      #        {
      #            hWnd = winapi::getWindow(hWnd, #GW_HWNDPREV);
      #            if (hWnd && GetClassName(hWnd) == #PaneWindowCL)
      #                pos++;
      #        }
      #
      #        TCITEM = new Binary(28);
      #        pointer = new Binary(4);
      #        pointer.binary(0, TCITEM);
      #        TCITEM.dWord(0, #TCIF_IMAGE);
      #        TCITEM.dWord(20, idx < 0 ? -1 : idx-1);
      #        winapi::sendMessageEx(GetParent(tabPageControl.hWnd()), #TCM_SETITEM, pos, pointer.dWord(0));
      #    }
      #}
    ENDSOURCE
    SOURCE #SetTabPageImageList
      #void setTabPageImageList(FormTabControl FormTabControl, ImageList imageList, int colorKey = winapi::rgb2int(134, 183, 115))
      #{
      #// colorKey - öâåò, êîòîðûé áóäåò çàìåíåí íà öâåò ôîíà îêíà.
      #// Åñëè â âàøèõ èêîíêàõ áóäåò ïðèñóòñòâîâàòü öåâåò, ïðåäëàãàåìûé ïî óìîë÷àíèþ,
      #// òî ïîäñòàâüòå ïðè âûçîâå ìåòîäà ëþáîé äðóãîé, êîòîðîãî íåò
      #
      #    DLL             _dll                = new DLL("comctl32.dll");
      #    DLL             _Userdll            = new DLL("User32.dll");
      #    DLL             _GDIdll             = new DLL("Gdi32.dll");
      #
      #
      #    DLLFunction     ImageList_Create        = new DLLFunction(_dll, "ImageList_Create");
      #    DLLFunction     ImageList_AddMasked     = new DLLFunction(_dll, "ImageList_AddMasked");
      #    DLLFunction     ImageList_Destroy       = new DLLFunction(_dll, "ImageList_Destroy");
      #
      #
      #    int             i, k;
      #    int             hImageList;
      #    int             hImageListOld;
      #    Image           image;
      #    int             wDC;
      #    int             newDC;
      #    int             hBitmap;
      #    int             hWnd;
      #    Binary          TCITEM;
      #    Binary          pointer;
      #
      #    int GetDC(int _hWnd)
      #    {
      #        DLLFunction     _getDC    = new DLLFunction(_Userdll, "GetDC");
      #        ;
      #        _getDC.arg(ExtTypes::DWord);
      #        _getDC.returns(ExtTypes::DWord);
      #        return _getDC.call(_hWnd);
      #    }
      #    int CreateCompatibleDC(int hdc)
      #    {
      #        DLLFunction     _createCompatibleDC    = new DLLFunction(_GDIdll, "CreateCompatibleDC");
      #        ;
      #        _createCompatibleDC.arg(ExtTypes::DWord);
      #        _createCompatibleDC.returns(ExtTypes::DWord);
      #        return _createCompatibleDC.call(hdc);
      #    }
      #    int CreateCompatibleBitmap(int hdc, int nWidth, int nHeight)
      #    {
      #        DLLFunction     _createCompatibleBitmap = new DLLFunction(_GDIdll, "CreateCompatibleBitmap");
      #        ;
      #        _createCompatibleBitmap.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        _createCompatibleBitmap.returns(ExtTypes::DWord);
      #        return _createCompatibleBitmap.call(hdc, nWidth, nHeight);
      #    }
      #    int SelectObject(int hdc, int hgdiobj)
      #    {
      #        DLLFunction     _selectObject = new DLLFunction(_GDIdll, "SelectObject");
      #        ;
      #        _selectObject.arg(ExtTypes::DWord, ExtTypes::DWord);
      #        _selectObject.returns(ExtTypes::DWord);
      #        return _selectObject.call(hdc, hgdiobj);
      #    }
      #    int DeleteObject(int hgdiobj)
      #    {
      #        DLLFunction     _deleteObject = new DLLFunction(_GDIdll, "DeleteObject");
      #        ;
      #        _deleteObject.arg(ExtTypes::DWord);
      #        _deleteObject.returns(ExtTypes::DWord);
      #        return _deleteObject.call(hgdiobj);
      #    }
      #    int DeleteDC(int hDc)
      #    {
      #        DLLFunction     _deleteDC = new DLLFunction(_GDIdll, "DeleteDC");
      #        ;
      #        _deleteDC.arg(ExtTypes::DWord);
      #        _deleteDC.returns(ExtTypes::DWord);
      #        return _deleteDC.call(hDc);
      #    }
      #    int FillRect(int hDC, container Rect, int hbr)
      #    {
      #        DLLFunction     _fillRect = new DLLFunction(_Userdll, "FillRect");
      #        Binary          _rect   = new Binary(16);
      #        ;
      #        _fillRect.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        _fillRect.returns(ExtTypes::DWord);
      #        _rect.dword(0, conpeek(Rect, 1));
      #        _rect.dword(4, conpeek(Rect, 2));
      #        _rect.dword(8, conpeek(Rect, 3));
      #        _rect.dword(12, conpeek(Rect, 4));
      #        return _fillRect.call(hDc, _rect, hbr);
      #    }
      #    int CreateSolidBrush(int _Color)
      #    {
      #        DLLFunction     _CreateSolidBrush = new DLLFunction(_GDIdll, "CreateSolidBrush");
      #        Binary           LOGBRUSH = new Binary(12);
      #        ;
      #        _CreateSolidBrush.arg(ExtTypes::DWord);
      #        _CreateSolidBrush.returns(ExtTypes::DWord);
      #        return _CreateSolidBrush.call(_Color);
      #    }
      #
      #    #define.ILC_COLOR(0x00000000)
      #    #define.ILC_COLOR24(0x00000018)
      #    #define.ILC_MASK(0x00000001)
      #    #define.TCM_FIRST(0x1300)
      #    #define.TCM_GETIMAGELIST(#TCM_FIRST + 2)
      #    #define.TCM_SETIMAGELIST(#TCM_FIRST + 3)
      #    #define.TCM_GETITEM(#TCM_FIRST + 5)
      #    #define.TCM_SETITEM(#TCM_FIRST + 6)
      #
      #    #define.TCIF_IMAGE(0x0002)
      #    ;
      #    if (formTabControl && formTabControl.hWnd() && imageList)
      #    {
      #        hWnd = formTabControl.hWnd();
      #        ImageList_Create.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        ImageList_Create.returns(ExtTypes::DWord);
      #        hImageList = ImageList_Create.call(imageList.width(), imageList.height(), #ILC_COLOR24 | #ILC_MASK, imageList.count(), 0);
      #
      #        ImageList_AddMasked.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
      #        ImageList_AddMasked.returns(ExtTypes::DWord);
      #
      #        wDC = GetDC(0);
      #        newDC = CreateCompatibleDC(wDC);
      #        if (newDC)
      #        {
      #            hBitmap = CreateCompatibleBitmap(wDC, imageList.width()*imageList.count(), imageList.height());
      #            if (hBitmap && SelectObject(newDC, hBitmap))
      #            {
      #                i = CreateSolidBrush(colorKey);
      #                FillRect(newDC, [0, 0, imageList.width()*imageList.count(), imageList.height()], i);
      #                deleteObject(i);
      #
      #                for (i=0;i<imageList.count();i++)
      #                    imageList.draw(newDC, i, i * imageList.width(), 0, true);
      #
      #                DeleteDC(newDC);
      #
      #                ImageList_AddMasked.call(hImageList, hBitmap, colorKey);
      #                DeleteObject(hBitmap);
      #                hImageListOld = winapi::sendMessageEx(hWnd, #TCM_SETIMAGELIST, 0, hImageList);
      #                if (hImageListOld)
      #                {
      #                    ImageList_Destroy.arg(ExtTypes::DWord);
      #                    ImageList_Destroy.returns(ExtTypes::DWord);
      #                    ImageList_Destroy.call(hImageList);
      #                }
      #
      #                TCITEM = new Binary(28);
      #                pointer = new Binary(4);
      #                pointer.binary(0, TCITEM);
      #                TCITEM.dWord(0, #TCIF_IMAGE);
      #
      #                for (i = 0; i < min(formTabControl.controlCount(), imageList.count()); i++)
      #                {
      #                    TCITEM.dWord(20, i);
      #                    winapi::sendMessageEx(hWnd, #TCM_SETITEM, i, pointer.dWord(0));
      #                }
      #            }
      #            else
      #                DeleteDC(newDC);
      #        }
      #        //winapi::releaseDC(hWnd, wDC);
      #        winapi::releaseDC(0, wDC);
      #    }
      #}
    ENDSOURCE
    SOURCE #getCurMethod
      #/// Thanx to AndyD
      #TreeNode getCurMethod(HWND _editorHWnd)
      #{
      #    int hWnd = _editorHWnd;
      #    int hWndChild;
      #    str name = WinApi::getWindowText(_editorHWnd);
      #    int pos;
      #    boolean editor;
      #    str className;
      #    int childPos;
      #
      #
      #    int listView;
      #    int selectedItem;
      #    str itemName;
      #    str nodeName;
      #    int i;
      #    TreeNode fromMethods(TreeNode _parent, str _name)
      #    {
      #        TreeNode ret = _parent;
      #    ;
      #        if (ret)
      #            ret = ret.AOTfindChild('methods');
      #        if (ret)
      #            ret = ret.AOTfindChild(_name);
      #        return ret;
      #    }
      #    boolean pref(str _prefix, str _name)
      #    {
      #    ;
      #        _prefix = '\\'+_prefix+'\\';
      #        if (subStr(_name, 1, strLen(_prefix)) == _prefix)
      #        {
      #            nodeName = subStr(_name, strLen(_prefix) + 1, strLen(_name) - strLen(_prefix));
      #            return true;
      #        }
      #        return false;
      #    }
      #    #localmacro.pref
      #        pref(@'%1', _name)
      #    #endmacro
      #    TreeNode toTreeNode(str _name, str _methodName)
      #    {
      #        TreeNode parent = TreeNode::findNode(_name);
      #        str controlName;
      #        str controlMethodName;
      #        int delimiterPos;
      #        if (!parent)
      #            return null;
      #        if (#pref(Classes) || #pref(Jobs) || #pref(Macros))
      #            return parent.AOTfindChild(_methodName);
      #        if (#pref(Data Dictionary\Tables) || #pref(Data Dictionary\Maps) || #pref(Data Dictionary\Views))
      #            return fromMethods(parent, _methodName);
      #        if (#pref(Forms) || #pref(Reports))
      #        {
      #            delimiterPos = strFind(_methodName, ':', 1, strLen(_methodName));
      #            if (delimiterPos)
      #            {
      #                controlName = strRTrim(strLTrim(subStr(_methodName, 1, delimiterPos - 1)));
      #                controlMethodName = strRTrim(strLTrim(subStr(_methodName, delimiterPos + 1, strLen(_methodName) - delimiterPos)));
      #                return fromMethods(this.controlByName(parent, controlName), controlMethodName);
      #            }
      #            else
      #                return fromMethods(parent, _methodName);
      #        }
      #        return null;
      #    }
      #    str GetClassName(int _hWnd)
      #    {
      #        DLL             dll = new Dll("user32.dll");
      #        DLLFunction     getCalssName = new DLLFunction(dll, "GetClassNameA");
      #        Binary  classNamePtr = new Binary(256);
      #        ;
      #        getCalssName.arg(ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::DWord);
      #        getCalssName.returns(ExtTypes::DWord);
      #        if (getCalssName.call(_hWnd, classNamePtr, 255))
      #            return classNamePtr.string(0);
      #        else
      #            return "";
      #    }
      #    #define.LVM_FIRST(0x1000)
      #    #define.LVM_GETNEXTITEM(#LVM_FIRST + 12)
      #    #define.LVM_GETITEMTEXT(#LVM_FIRST + 45)
      #
      #    #define.LVNI_SELECTED(0x0002)
      #
      #    str getItemText(int     _hWnd, int _item)
      #    {
      #        DLL         _winApiDLL      = new DLL('USER32');
      #        DLLFunction _sendMessage    = new DLLFunction(_winApiDLL, 'SendMessageA');
      #        Binary      LVItem = new Binary(52);
      #        Binary      itemText = new Binary(256);
      #        #define.LVIF_TEXT(0x0001)
      #        ;
      #        LVItem.dWord(0, #LVIF_TEXT); // mask
      #        LVItem.dWord(4, _item); // iItem
      #        LVItem.dWord(8, 0); // iSubItem
      #        LVItem.Binary(20, itemText); // pszText
      #        LVItem.dWord(24, 255); // cchTextMax
      #        _sendMessage.returns(ExtTypes::DWord);
      #        _sendMessage.arg(ExtTypes::DWord,
      #                         ExtTypes::DWord,
      #                         ExtTypes::DWord,
      #                         ExtTypes::Pointer);
      #
      #        return _sendMessage.call(_hWnd, #LVM_GETITEMTEXT, _item, LVItem) ? itemText.string(0) : '';
      #    }
      #
      #
      #    ;
      #    for(i=1; i<=conLen(editorSuffixes) &&  !pos; i++)
      #        if (this.strEndsWith(name, conPeek(editorSuffixes, i)))
      #            pos = strLen(name) - strLen(conPeek(editorSuffixes, i)) + 1;
      #
      #    name = subStr(name, 1, pos-1);
      #    editor = true;
      #    hWndChild = winapi::getWindow(hWnd, #GW_CHILD);
      #    childPos = 1;
      #    ListView = 0;
      #    while (hWndChild && _editorHWnd)
      #    {
      #        className = GetClassName(hWndChild);
      #        switch (childPos)
      #        {
      #            case 1:
      #                #if.ax3
      #                    editor = className == "MDImarginCL";
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxEdTabCtrl";
      #                #endif
      #                childPos++;
      #                break;
      #            case 2:
      #                #if.ax3
      #                    editor = className == "SysListView32";
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxListViewCtrl";
      #                #endif
      #                ListView = hWndChild;
      #                childPos++;
      #                break;
      #            case 3:
      #                #if.ax3
      #                    editor = className == #PaneWindowCL;
      #                #endif
      #                #if.ax4
      #                    editor = className == "AxChidFrame";
      #                #endif
      #                childPos++;
      #                break;
      #            case 4:
      #                #if.ax4
      #                    editor = className == "AxPaneWnd";
      #                #endif
      #                #if.ax3
      #                    editor = className == "SysTabControl32";
      #                #endif
      #                childPos++;
      #                break;
      #            default:
      #                editor = false;
      #                break;
      #        }
      #        hWndChild = winapi::getWindow(hWndChild, #GW_HWNDNEXT);
      #    }
      #    if (editor && listView)
      #    {
      #        selectedItem = winapi::sendMessageEx(listView, #LVM_GETNEXTITEM, -1, #LVNI_SELECTED);
      #        if (selectedItem >= 0)
      #        {
      #            itemName = getItemText(ListView, selectedItem);
      #            if (itemName)
      #            {
      #                return toTreeNode(name, itemName);
      #            }
      #        }
      #    }
      #    return null;
      #}
    ENDSOURCE
    SOURCE #AxPath_goMenuItemForm
      #void AxPath_goMenuItemForm(MenuItemType _itemType, MenuItemName _itemName, str _extra)
      #{
      #    Args args=new Args();
      #    FormRun formRun ;
      #    Common record;
      #    TableID tableID;
      #;
      #    args.menuItemType(_itemType);
      #    args.menuItemName(_itemName);
      #    formRun = new MenuFunction(_itemName, _itemType).create(args);
      #    if (formRun)
      #    {
      #        formRun.run();
      #        if (formRun.dataSourceCount())
      #        {
      #            tableID = formRun.dataSource(1).cursor().TableId;
      #            record = this.AxPath_findCommon(tableID, this.AxPath_parseParams(_extra));
      #            if (record)
      #                formRun.dataSource(1).findRecord(record);
      #        }
      #        formRun.detach();
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_parseParams
      #container AxPath_parseParams(str _params)
      #{
      #    container ret;
      #    container pairs;
      #    int i;
      #;
      #    if (subStr(_params, 1, 1)=='?')
      #    {
      #        pairs = this.str2con(subStr(_params, 2, strLen(_params)-1) , '&');
      #        for(i=1; i<=conLen(pairs); i++)
      #            ret += [this.str2con(conPeek(pairs, i), '=')];
      #    }
      #    return ret;
      #}
    ENDSOURCE
    SOURCE #AxPath_accepts
      #boolean AxPath_accepts(str _s)
      #{
      #    return this.urlGetPart(_s, 1)==#AxPath_prefix;
      #}
    ENDSOURCE
    SOURCE #AxPath_fromTreeNode
      #str AxPath_fromTreeNode(TreeNode _node)
      #{
      #    return #AxPath_prefix+'://'+#AxPath_AOTName+this.urlEscape(strReplace(_node.treeNodePath(), '\\', '/'));
      #}
    ENDSOURCE
    SOURCE #internetCrackUrl
      #container internetCrackUrl(str _url, boolean _decode=false, boolean _escape=false)
      #{
      #//    typedef struct {
      #//      DWORD dwStructSize; 0
      #//      LPTSTR lpszScheme;   4
      #//      DWORD dwSchemeLength; 8
      #//      INTERNET_SCHEME nScheme; 12
      #//      LPTSTR lpszHostName; 16
      #//      DWORD dwHostNameLength; 20
      #//      INTERNET_PORT nPort; 24
      #//      LPTSTR lpszUserName; 28
      #//      DWORD dwUserNameLength; 32
      #//      LPTSTR lpszPassword; 36
      #//      DWORD dwPasswordLength; 40
      #//      LPTSTR lpszUrlPath; 44
      #//      DWORD dwUrlPathLength; 48
      #//      LPTSTR lpszExtraInfo; 52
      #//      DWORD dwExtraInfoLength; 56
      #//    } URL_COMPONENTS, 60
      #//
      #//     *LPURL_COMPONENTS;
      #    int maxLen = strLen(_url)+1;
      #    DLL             dll = new DLL('wininet.dll');
      #    DLLFunction     function = new DLLFunction(dll, 'InternetCrackUrlA');
      #    Binary          result = new Binary(60);
      #    Binary          cnt = new Binary(4);
      #    int ret;
      #    #define.E_POINTER(0x80004003)
      #//      LPTSTR lpszScheme;   4
      #    Binary scheme = new Binary(maxLen);
      #//      LPTSTR lpszHostName; 24
      #    Binary hostName = new Binary(maxLen);
      #//      LPTSTR lpszUserName; 36
      #    Binary userName = new Binary(maxLen);
      #//      LPTSTR lpszPassword; 44
      #    Binary password = new Binary(maxLen);
      #//      LPTSTR lpszUrlPath; 52
      #    Binary urlPath = new Binary(maxLen);
      #//      LPTSTR lpszExtraInfo; 60
      #    Binary extraInfo = new Binary(maxLen);
      #;
      #//    BOOL InternetCrackUrl(
      #//      LPCTSTR lpszUrl,
      #//      DWORD dwUrlLength,
      #//      DWORD dwFlags,
      #//      LPURL_COMPONENTS lpUrlComponents
      #//    );
      #
      #
      #//      DWORD dwStructSize; 0
      #    result.dWord(0, 60);
      #//      LPTSTR lpszScheme;   4
      #    result.binary(4, scheme);
      #//      DWORD dwSchemeLength; 8
      #    result.dWord(8, maxLen);
      #//      INTERNET_SCHEME nScheme; 12
      #//      LPTSTR lpszHostName; 16
      #    result.binary(16, hostName);
      #//      DWORD dwHostNameLength; 20
      #    result.dWord(20, maxLen);
      #//      INTERNET_PORT nPort; 24
      #//      LPTSTR lpszUserName; 28
      #    result.binary(28, userName);
      #//      DWORD dwUserNameLength; 32
      #    result.dWord(32, maxLen);
      #//      LPTSTR lpszPassword; 36
      #    result.binary(36, password);
      #//      DWORD dwPasswordLength; 40
      #    result.dWord(40, maxLen);
      #//      LPTSTR lpszUrlPath; 44
      #    result.binary(44, urlPath);
      #//      DWORD dwUrlPathLength; 48
      #    result.dWord(48, maxLen);
      #//      LPTSTR lpszExtraInfo; 52
      #    result.binary(52, extraInfo);
      #//      DWORD dwExtraInfoLength; 56
      #    result.dWord(56, maxLen);
      #    function.arg(ExtTypes::String, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::Pointer);
      #    function.returns(ExtTypes::DWord);
      #    ret = function.call(_url, strlen(_url), (_decode ? 0x10000000 : 0) +  (_escape ? 0x080000000: 0), result);
      #    if (!ret)
      #        throw error(WinApi::formatMessage(WinApi::getLastError()));
      #    return [scheme.string(0), hostName.string(0), result.dWord(24), userName.string(0), password.string(0), urlPath.string(0), extrainfo.string(0)];
      #}
    ENDSOURCE
    SOURCE #str2con
      #container str2con(str _string, str _separator = ",")
      #{
      #    container   con;
      #    int         pos, oldPos = 1;
      #
      #    do
      #    {
      #        pos    =  strScan(_string, _separator, pos ? pos + strLen(_separator) : 1, strLen(_string));
      #        con    += subStr(_string, oldPos, pos ? pos - oldPos : strLen(_string) + 1 - oldPos);
      #        oldPos =  pos + strLen(_separator);
      #    }
      #    while (pos);
      #
      #    return con;
      #}
    ENDSOURCE
    SOURCE #urlGetPart
      #//URL_PART_HOSTNAME
      #//The host name.
      #//URL_PART_PASSWORD
      #//The password.
      #//URL_PART_PORT
      #//The port number.
      #//URL_PART_QUERY
      #//The query portion of the URL.
      #//URL_PART_SCHEME
      #//The URL scheme.
      #//URL_PART_USERNAME
      #//The username.
      #//URL_PART_NONE    = 0,
      #// URL_PART_SCHEME  = 1,
      #// URL_PART_HOSTNAME,
      #// URL_PART_USERNAME,
      #// URL_PART_PASSWORD,
      #// URL_PART_PORT,
      #// URL_PART_QUERY
      #//HRESULT UrlGetPart(
      #//    LPCTSTR pszIn,
      #//    LPTSTR pszOut,
      #//    LPDWORD pcchOut,
      #//    DWORD dwPart,
      #//    DWORD dwFlags
      #//);
      #str urlGetPart(str _in, int _part)
      #{
      #    DLL             dll = new DLL("shlwapi.dll");
      #    DLLFunction     function = new DLLFunction(dll, "UrlGetPartA");
      #    Binary          out = new Binary(strlen(_in)+1);
      #    Binary          cnt = new Binary(4);
      #    #define.E_POINTER(0x80004003)
      #    ;
      #    function.arg(
      #        //    LPCTSTR pszIn,
      #        ExtTypes::String,
      #        //    LPTSTR pszOut,
      #        ExtTypes::Pointer,
      #        //    LPDWORD pcchOut,
      #        ExtTypes::Pointer,
      #        //    DWORD dwPart,
      #        ExtTypes::DWord,
      #        //    DWORD dwFlags
      #        ExtTypes::DWord);
      #    function.returns(ExtTypes::DWord);
      #    cnt.dWord(0, strlen(_in)+1);
      #    function.call(_in, out, cnt, _part, 0);
      #    return out.string(0);
      #}
    ENDSOURCE
    SOURCE #AxPath_go
      #void AxPath_go(str _url)
      #{
      #    str scheme;
      #    str host;
      #    int port;
      #    str user;
      #    str password;
      #    str urlPath;
      #    str extra;
      #    TreeNode node;
      #    int line;
      #    int pos;
      #    container steps;
      #    MenuItemType itemType;
      #    MenuItemName itemName;
      #    //RecID recID;
      #    DataAreaId  dataAreaID  ;  // Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
      #;
      #
      #    [scheme, host, port, user, password, urlPath, extra] = this.internetCrackUrl(_url, true);
      #    switch (host)
      #    {
      #        case #AxPath_AOTName:
      #            this.assertDevelopment();
      #            node = TreeNode::findNode(strReplace(urlPath, '/', '\\'));
      #            if (!node)
      #                throw error('Node not found');
      #            [line, pos] = this.AxPath_getLineAndPos(extra);
      #            if (node.handle() == classNum(MemberFunction) || node.handle() == classNum(Job) )
      #                node.AOTedit(line, pos);
      #            else
      #                node.AOTnewWindow();
      #
      #        break;
      #        case #AxPath_MenuItemName:
      #            steps = this.str2con(urlPath, '/');
      #            itemType = this.menuItemTypeBySymbol(conPeek(steps, 2));
      #            itemName = conPeek(steps, 3);
      #            //recID = this.AxPath_getRecID(extra);
      #            //+ Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
      #            // orig
      #            // this.goMenuItemForm(itemType, itemName, recID );
      #
      #            dataAreaID = this.AxPath_getDataAreaId(extra);
      #            if(dataAreaID && curExt() != dataAreaID)
      #            {
      #                changeCompany (dataAreaID)
      #                {
      #                    this.AxPath_goMenuItemForm(itemType, itemName, extra);
      #                }
      #            }
      #            else
      #                this.AxPath_goMenuItemForm(itemType, itemName, extra);
      #            //- Dcs 04.04.2007 ÑÁÐFI-200703_02 KC
      #        break;
      #        default:
      #            throw error('Unknown host '+host);
      #    }
      #}
    ENDSOURCE
    SOURCE #AxPath_getRecID
      #RecID AxPath_getRecID(str _extra)
      #{
      #    container params=this.AxPath_parseParams(_extra);
      #    int i;
      #    str name;
      #    str value;
      #    RecID recID;
      #;
      #    for (i=1; i<=conLen(params); i++)
      #    {
      #        [name, value] = conPeek(params, i);
      #        if (name=='recID')
      #           recID=#str2recID(value);
      #    }
      #    return recID;
      #}
    ENDSOURCE
    SOURCE #runIt
      #void runIt(str _src, boolean _doWrite=true)
      #{
      #    XPPCompiler comp=new XPPCompiler();
      #    ;
      #    if(comp.compile(_src))
      #        if (_doWrite)
      #            this.write(runBuf(_src, element));
      #        else
      #            runBuf(_src, element);
      #    else
      #        info(comp.errorText());
      #}
    ENDSOURCE
    SOURCE #eval
      #void eval(str _s)
      #{
      #    ;
      #    this.assertDevelopment();
      #    this.runIt('AnyType mainFun(Object tabax){return '+_s+";}");
      #}
    ENDSOURCE
    SOURCE #runScript
      #void runScript(str _s)
      #{
      #    ;
      #    this.assertDevelopment();
      #    this.runIt('AnyType mainFun(Object tabax){AnyType ret;  ' + _s + " return ret;}", false);
      #}
    ENDSOURCE
    SOURCE #write
      #/// Prints its arguments on calculator result pane
      #void write(AnyType _p1=0, AnyType _p2=0, AnyType _p3=0, AnyType _p4=0, AnyType _p5=0)
      #{
      #    str s; //=resultEd.text() ? "\n" : "";
      #;
      #    if(!prmIsDefault(_p1))
      #        s+=this.toStr(_p1);
      #    if(!prmIsDefault(_p2))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p2);
      #    }
      #    if(!prmIsDefault(_p3))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p3);
      #    }
      #    if(!prmIsDefault(_p4))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p4);
      #    }
      #    if(!prmIsDefault(_p5))
      #    {
      #        if(s)
      #            s+=", ";
      #        s+=this.toStr(_p5);
      #    }
      #    info(s);
      #}
    ENDSOURCE
    SOURCE #processIconic
      #void processIconic(HWnd _child)
      #{
      #    int x1; int y1;
      #    int x2; int y2;
      #    int dx; int dy;
      #;
      #    [x1, y1, x2, y2] = element.getMdiClientRelativeRect(_child);
      #    dx = max(0, -x1);
      #    dy = max(0, -y1);
      #    if (dx || dy)
      #    {
      #        x1 += dx; x2 +=dx;
      #        y1 += dy; y2 +=dy;
      #        WinApi::setWindowPos(_child, x1, y1, x2-x1+1, y2-y1+1, false, false, #SWP_NOACTIVATE);
      #    }
      #}
    ENDSOURCE
    SOURCE #attachPlugins
      #void attachPlugins()
      #{
      #    UtilElements ue;
      #    Object plugin;
      #;
      #    while select name from ue group by name
      #        where ue.recordType == UtilElementType::Class
      #              &&
      #              ue.name like 'TabaxPlugin_*'
      #    {
      #        plugin = new DictClass(className2ID(ue.name)).makeObject();
      #        plugin.tabax(element);
      #    }
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Top                 #Top edge
      Width               #Column width
      Height              #50
      Caption             #Tabax 0.1
      Frame               #None
      WindowResize        #Dynamic
      SaveSize            #Yes
      AllowDocking        #Yes
      TopMargin           #0
      BottomMargin        #0
      LeftMargin          #0
      RightMargin         #0
      Columnspace         #0
    ENDPROPERTIES
    CONTAINER
      CONTROL TAB
        PROPERTIES
          Name                #Tabs
          AutoDeclaration     #Yes
          Width               #Column width
          Height              #27
          VerticalSpacing     #0
          BackStyle           #Transparent
          TabLayout           #Tunnel
          Columns             #1
          Columnspace         #0
          HideIfEmpty         #No
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #beginDrag
            #public int beginDrag(int _x, int _y)
            #{
            #    int ret;
            #
            #    ret = super(_x, _y);
            #
            #    ret = element.hitTestTabPage(this);
            #
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #dragOver
            #public FormDrag dragOver(FormControl _dragSource, FormDrag _dragMode, int _x, int _y)
            #{
            #    FormDrag ret;
            #
            #    ret = super(_dragSource, _dragMode, _x, _y);
            #
            #    return FormDrag::Move;
            #}
          ENDSOURCE
          SOURCE #mouseDblClick
            #public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int                 ret;
            #    FormTabPageControl  page;
            #    int                 tabNo;
            #    HWND                hwnd;
            #    ;
            #
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #
            #    tabNo = element.HitTestTabPage(this);
            #
            #    if(tabNo)
            #    {
            #        page = this.controlNum(tabNo);
            #        hwnd = this.pageToHwnd(page);
            #
            #        WinAPI::sendMessageEx(hwnd, #WM_SYSCOMMAND, #SC_CLOSE, 0);
            #    }
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #pageToHwnd
            #HWND pageToHwnd(FormTabPageControl _page)
            #{
            #    HWnd hwnd;
            #    str hwndStr;
            #;
            #    if(_page)
            #    {
            #        hwndStr=_page.name();
            #        hwnd=str2int(subStr(hwndStr, 2, strLen(hwndStr)-1));
            #    }
            #    return hwnd;
            #}
          ENDSOURCE
          SOURCE #tabChanged
            #public void tabChanged(int _FromTab, int _ToTab)
            #{
            #
            #    FormTabPageControl page;
            #    HWND hwnd;
            #    super(_FromTab, _ToTab);
            #    if(!inDeletion)
            #    {
            #        page=this.controlNum(_ToTab);
            #        if(page)
            #        {
            #            hwnd = this.pageToHwnd(page);
            #            if (element.isIconic(hwnd))
            #                WinAPI::sendMessageEx(hwnd, #WM_SYSCOMMAND, #SC_RESTORE, 0);
            #            infolog.activateWindow(hwnd);
            #        }
            #    }
            #}
          ENDSOURCE
          SOURCE #toolTip
            #public str toolTip()
            #{
            #    int tabNo=element.hitTestTabPage(this);
            #    FormTabPageControl page=tabNo ? this.controlNum(tabNo) : null;
            #;
            #    return page ? page.helpText():'';
            #}
          ENDSOURCE
          SOURCE #closeAllExcept
            #void closeAllExcept(container _hwnds)
            #{
            #    MapIterator i=new MapIterator(windows);
            #    ;
            #    while(i.more())
            #    {
            #        if(!conFind(_hwnds, i.key()))
            #            WinAPI::sendMessageEx(i.key(), #WM_SYSCOMMAND, #SC_CLOSE, 0);
            #        i.next();
            #    }
            #}
          ENDSOURCE
          SOURCE #context
            #public void context()
            #{
            #    FormTabPageControl page;
            #    int tabNo;
            #    PopupMenu menu = new PopupMenu(this.hWnd());
            #    container winList;
            #    int close, toleft, toright, maximize, minimize, copy, totop, tobottom,
            #        fitWindow, sendBack;
            #    int closeAllExceptSelected;
            #    int selection;
            #    int i;
            #    str forCopy;
            #    TextBuffer buf=new TextBuffer();
            #    HWND hwnd;
            #;
            #    tabNo=element.HitTestTabPage(this);
            #    if(tabNo)
            #    {
            #        page=this.controlNum(tabNo);
            #        close = menu.insertItem(#_("Close (doubleclick tab to close)"));
            #        closeAllExceptSelected = menu.insertItem(#_("Close all except selected"));
            #        menu.insertBreak();
            #        fitWindow=menu.insertItem(#_("Fit window"));
            #        toleft=menu.insertItem(#_("To left"));
            #        toright=menu.insertItem(#_("To right"));
            #        totop=menu.insertItem(#_("To top"));
            #        tobottom=menu.insertItem(#_("To bottom"));
            #        maximize=menu.insertItem(#_("Maximize"));
            #        minimize=menu.insertItem(#_("Minimize"));
            #        sendBack=menu.insertItem(#_("Send to back"));
            #        menu.insertBreak();
            #        copy=menu.insertItem(#_("copy title"));
            #        selection = menu.draw();
            #        hwnd=this.pageToHwnd(page);
            #        if(selection!=closeAllExceptSelected)
            #        {
            #                switch (selection)
            #                {
            #                    case close:
            #                        WinAPI::sendMessageEx(hwnd, #WM_SYSCOMMAND, #SC_CLOSE, 0);
            #                    break;
            #                    case toLeft:
            #                        element.leftSide(hwnd);
            #                    break;
            #                    case toRight:
            #                        element.rightSide(hwnd);
            #                    break;
            #                    case toTop:
            #                        element.topSide(hwnd);
            #                    break;
            #                    case toBottom:
            #                        element.bottomSide(hwnd);
            #                    break;
            #                    case maximize:
            #                        WinAPI::maximizeWindow(hwnd);
            #                    break;
            #                    case minimize:
            #                        WinAPI::minimizeWindow(hwnd);
            #                    break;
            #                    case fitWindow:
            #                        element.fitWindow(hwnd);
            #                    break;
            #                    case sendBack:
            #                        element.setWPos(hwnd,
            #                            1, //#HWND_BOTTOM,
            #                            0,0,0,0,#SWP_NOMOVE + #SWP_NOSIZE);
            #                    break;
            #                    case copy:
            #                        if(forCopy)
            #                            forCopy+="\r\n";
            #                        forCopy+=page.helpText();
            #                    break;
            #                }
            #            if(selection==copy)
            #            {
            #                buf.setText(forCopy);
            #                buf.toClipboard();
            #            }
            #        }
            #        else
            #        {
            #            if (element.confirm(strFmt(element.getText('Close all windows except "%1"'), WinApi::getWindowText(hwnd))))
            #                this.closeAllExcept([hwnd]);
            #        }
            #    }
            #    else
            #        super();
            #}
          ENDSOURCE
          SOURCE #mouseDown
            #public int mouseDown(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int ret;
            #    int i;
            #    int hwnd;
            #
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #    //this.mouseUp(_x, _y, _button, _Ctrl, _Shift);
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #mouseUp
            #public int mouseUp(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
            #{
            #    int ret;
            #    int i;
            #    int hwnd;
            #
            #    ret = super(_x, _y, _button, _Ctrl, _Shift);
            #//    if(_Shift||_Ctrl)
            #//        return ret;
            #//    if(_button==1)
            #//    {
            #//        i=Tree.getFirstSelected();
            #//        while(i)
            #//        {
            #//            hwnd=tree.getItem(i).data();
            #//            infolog.activateWindow(hWnd);
            #//            i=Tree.getNextSelected(i);
            #//        }
            #//    }
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
        CONTAINER
        ENDCONTAINER
      ENDCONTROL
      CONTROL MENUBUTTON
        PROPERTIES
          Name                #MenuButton
          AutoDeclaration     #Yes
          Left                #Right edge
          Width               #15
          NormalResource      #3400
          Border              #Flat
          ShowShortCut        #No
          MultiSelect         #Yes
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #toolTip
            #public str toolTip()
            #{
            #    return "Toolbar Menus";
            #}
          ENDSOURCE
          SOURCE #showContextMenu
            #public int showContextMenu(int _menuHandle)
            #{
            #    int ret;
            #
            #    ret = super(_menuHandle);
            #
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
        CONTAINER
          CONTROL BUTTON
            PROPERTIES
              Name                #Close
              Text                #Close toolbar
              ButtonDisplay       #Text & Image left
              NormalResource      #7671
              DisabledResource    #7671
              Border              #Flat
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #clicked
                #void clicked()
                #{
                #    ;
                #    if (element.confirm(#_('Really wanna close Tabax?')))
                #        element.close();
                #        MenuButton.showContextMenu(this.handle());
                #}
              ENDSOURCE
              SOURCE #toolTip
                #public str toolTip()
                #{
                #  return #_('Close tabax');
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
          CONTROL BUTTON
            PROPERTIES
              Name                #newProject
              Text                #Create New Project
              ButtonDisplay       #Text & Image left
              NormalResource      #1090
              DisabledResource    #1090
              Border              #Flat
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #toolTip
                #public str toolTip()
                #{
                #    return #_('Create New Project');
                #}
              ENDSOURCE
              SOURCE #clicked
                #void clicked()
                #{
                #    Args    args;
                #    ;
                #
                #    args = new Args();
                #    new MenuFunction(menuitemactionstr("MF_CreateNewProject"),MenuItemType::Action).run(args);
                #
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
          CONTROL BUTTON
            PROPERTIES
              Name                #CopyFields
              Text                #Copy Fields To Clipboard
            ENDPROPERTIES
            METHODS
              Version: 3
              SOURCE #clicked
                #void clicked()
                #{
                #    Args args;
                #    ;
                #    super();
                #    args = new Args();
                #    new MenuFunction(menuitemactionstr("MF_CopyFieldsToClipboard"),MenuItemType::Action).run(args);
                #
                #}
              ENDSOURCE
            ENDMETHODS
          ENDCONTROL
        ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_showField
  PROPERTIES
    Name                #MF_showField
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      #public class FormRun extends ObjectRun
      #{
      #    str formName;
      #    str formFieldName;
      #    str formDataSourceName;
      #    str tableName;
      #    str fieldName;
      #    str methodName;
      #    str EDTName;
      #    MF_fieldInfo    fieldInfo;
      #
      #
      #}
    ENDSOURCE
    SOURCE #showEDTName
      #display notes showEDTName()
      #{
      #    str rRet;
      #    SysDictField    df;
      #    dictTable       dt;
      #    TableId         tableId;
      #
      #    ;
      #
      #    tableId = tablename2id(tablename);
      #    dt=new Dicttable(tableid);
      #    if(fieldname == "")
      #    {
      #       rRet = "From Method";
      #    }
      #    else
      #    {
      #       df = new SysDictField(dt.id(),dt.fieldname2id(fieldname));
      #       switch (df.baseType())
      #       {
      #            case Types::Date:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+'Date'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::Real:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+ 'Real'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::Integer:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+ 'Integer'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::String:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+'String'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::Integer:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+'String'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::DateTime:
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+'String'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            case Types::Enum:
      #                rRet  = '['+EnumId2name(df.enumId())+
      #                    '] Data Type: '+'Enum'+'  size:'+int2str(df.fieldSize());
      #                break;
      #            default :
      #                rRet  = '['+extendedTypeId2name(df.typeid())+
      #                    '] Data Type: '+'Other'+'  size:'+int2str(df.fieldSize());
      #                break;
      #
      #         }
      #     }
      #
      #    return rRet;
      #}
    ENDSOURCE
    SOURCE #showFormDataSourceName
      #display str 80 showFormDataSourceName()
      #{
      #    return formDataSourceName;
      #}
    ENDSOURCE
    SOURCE #setPos
      #void setPos(int x, int y)
      #{
      #    container pos;
      #    ;
      #    pos = WinApi::clientToScreen(infolog.hWnd(), x, y);
      #    element.design().left(conPeek(pos, 1));
      #    element.design().top(conPeek(pos, 2));
      #    element.design().visible(true);
      #}
      #
      #
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #
      #    ;
      #    super();
      #
      #    if (element.args().caller())
      #    {
      #        fieldInfo           = element.args().caller();
      #        formName            = fieldInfo.getFormName();
      #        formFieldName       = fieldInfo.getFormFieldName();
      #        formDataSourceName  = fieldInfo.getFormDataSourceName();
      #        tableName           = fieldInfo.getTableName();
      #        fieldName           = fieldInfo.getFieldName();
      #        methodName          = fieldInfo.getMethodName();
      #
      #    }
      #    else
      #        throw error("@SYS59200");
      #
      #    element.setPos(conpeek(winAPI::getCursorPos(),1) , conpeek(winAPI::getCursorPos(),2)-30);
      #}
    ENDSOURCE
    SOURCE #closeSelect
      #public void closeSelect(str _selectString)
      #{
      #    super(_selectString);
      #    element.closeOk();
      #}
    ENDSOURCE
    SOURCE #task
      #public int task(int _taskId)
      #{
      #   #keypressed
      #   int i;
      #   ;
      #
      #   if (_taskId == 1313)
      #        element.closeOk();
      #
      #    return true;
      #}
    ENDSOURCE
    SOURCE #showFormName
      #display str 80 showFormName()
      #{
      #    return formName;
      #}
    ENDSOURCE
    SOURCE #showMethodName
      #display str 80 showMethodName()
      #{
      #    return methodName;
      #}
    ENDSOURCE
    SOURCE #showFieldName
      #display str 80 showFieldName()
      #{
      #    return fieldName;
      #}
    ENDSOURCE
    SOURCE #showTableName
      #display str 80 showTableName()
      #{
      #    return tableName;
      #}
    ENDSOURCE
    SOURCE #showFormFieldName
      #display str 80 showFormFieldName()
      #{
      #    return formFieldName;
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Left                #0
      Top                 #0
      Width               #300
      Height              #230
      Frame               #Border
      WindowType          #Popup
      AlwaysOnTop         #Yes
      BackgroundColor     #Tooltip background
      ArrangeWhen         #Startup
      Columns             #2
      ArrangeGuide       
        ARRAY INDEX Columns
          #0
          #0
        ENDARRAY
    ENDPROPERTIES
    CONTAINER
      CONTROL BUTTON
        PROPERTIES
          Name                #Close
          Left                #Left edge
          ButtonDisplay       #Image only
          NormalResource      #3112
          BackStyle           #Transparent
          BackgroundColor     #Tooltip background
        ENDPROPERTIES
        METHODS
          Version: 3
          SOURCE #clicked
            #void clicked()
            #{
            #    super();
            #    element.closeOk();
            #}
          ENDSOURCE
        ENDMETHODS
      ENDCONTROL
      CONTROL WINDOW
        PROPERTIES
          Name                #Window
          Visible             #No
          Left                #Left edge
          Width               #53
          Height              #69
          ImageResource       #3112
          BackStyle           #Transparent
        ENDPROPERTIES
      ENDCONTROL
      CONTROL GROUP
        PROPERTIES
          Name                #FieldGrp
          Left                #3
          Top                 #20
          FrameType           #None
          FramePosition       #Inside
          BackStyle           #Transparent
          BackgroundColor     #Tooltip background
        ENDPROPERTIES
          CONTAINER
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showFormName
                AllowEdit           #No
                Left                #90
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #Form name
                LabelWidth          #50
                DataMethod          #showFormName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showFormFieldName
                AllowEdit           #No
                Left                #90
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #Form fieldname
                LabelWidth          #50
                DataMethod          #showFormFieldName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showFormDataSourceName
                AllowEdit           #No
                Left                #90
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #Form datasource
                LabelWidth          #50
                DataMethod          #showFormDataSourceName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showTableName
                AllowEdit           #No
                Left                #90
                Top                 #70
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #TableName
                LabelWidth          #50
                DataMethod          #showTableName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showFieldName
                AllowEdit           #No
                Left                #90
                Top                 #90
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #FieldName
                LabelWidth          #50
                DataMethod          #showFieldName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showMethodName
                AllowEdit           #No
                Left                #90
                Top                 #110
                Height              #15
                Border              #None
                Alignment           #Left
                BackgroundColor     #Tooltip background
                ForegroundColor     #Tooltip text
                Bold                #Bold
                Label               #MethodName
                LabelWidth          #50
                DataMethod          #showMethodName
              ENDPROPERTIES
            ENDCONTROL
            CONTROL STRINGEDIT
              PROPERTIES
                Name                #showEDTName
                AllowEdit           #No
                DataMethod          #showEDTName
              ENDPROPERTIES
            ENDCONTROL
          ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #MF_CreateNewProjectDlg
  PROPERTIES
    Name                #MF_CreateNewProjectDlg
  ENDPROPERTIES
  METHODS
    Version: 3
    SOURCE #classDeclaration
      ##AOT
      ##ResAppl
      #public class FormRun extends ObjectRun
      #{
      #    MF_CreateNewProject        axCreateNewProject;
      #    ImageListAppl_Aot           imageListSmallAOT;
      #    ImageListAppl_Checkbox      imageListAppl_Checkbox;
      #    container                   aotPathes;
      #    int                         maxNameLen;
      #
      #    ProjectSharedPrivate        projectType;
      #    TreeNodeName                projectPrefix;
      #    TreeNodeName                projectName;
      #    container                   selectedProjectNodes;
      #    NoYes                       usePrefixValue;
      #    NoYes                       warnAboutNameDuplicates;
      #    NoYes                       updateExistingProject;
      #    Map                         objectTypeName;
      #
      #    TreeNodeName                projectPrefixOrig;
      #    TreeNodeName                projectNameOrig;
      #    ProjectSharedPrivate        projectTypeOrig;
      #    NoYes                       usePrefixOrig;
      #
      #    #localmacro.FormControlValues
      #        projectType,
      #        projectPrefix,
      #        projectName,
      #        selectedProjectNodes,
      #        usePrefixValue,
      #        warnAboutNameDuplicates,
      #        updateExistingProject
      #    #endmacro
      #}
    ENDSOURCE
    SOURCE #addObject2Tree
      #void addObject2Tree(TreeNode _treeNode)
      #{
      #    TreeNodePath    treeNodePath;
      #    int             i;
      #    container       con;
      #    int             nItem, nChild, nIndex, nChildLevel2;
      #    FormTreeItem    formTreeItem;
      #
      #    ;
      #    treeNodePath = subStr(_treeNode.treeNodePath(), 1, strLen(_treeNode.treeNodePath()) - strLen(_treeNode.treeNodeName()) - 1);
      #
      #    for (i = 1; i <= conlen(this.pathes()); i++)
      #    {
      #        con = conPeek(this.pathes(), i);
      #        if (conPeek(con, 1) == treeNodePath)
      #        {
      #            nIndex = i;
      #            break;
      #        }
      #    }
      #    if (nIndex < 1) //means, that the group node name with the selected object is not found in pathes
      #        return;
      #
      #    nItem = TreeSettings.getChild(TreeSettings.getRoot());
      #    while (nItem)
      #    {
      #        if (typeOf(TreeSettings.getItem(nItem).data()) == Types::String && TreeSettings.getItem(nItem).data() == treeNodePath)
      #        {
      #            SysFormTreeControl::addTreeItem(TreeSettings, _treeNode.treeNodeName(), nItem, _treeNode.applObjectType(),//_treeNode.treeNodePath(),
      #                                            imageListSmallAOT.image(ImageListAppl_Aot::utilElementType2Image(_treeNode.applObjectType())), false, this.getNodeStateImage(nIndex));
      #
      #            formTreeItem = TreeSettings.getItem(nItem);
      #            formTreeItem.children(true);
      #            TreeSettings.setItem(formTreeItem);
      #            return;
      #        }
      #        nChild = TreeSettings.getChild(nItem);
      #        while (nChild)
      #        {
      #            if (typeOf(TreeSettings.getItem(nChild).data()) == Types::String && TreeSettings.getItem(nChild).data() == treeNodePath)
      #            {
      #                SysFormTreeControl::addTreeItem(TreeSettings, _treeNode.treeNodeName(), nChild, _treeNode.applObjectType(),//_treeNode.treeNodePath(),
      #                                                imageListSmallAOT.image(ImageListAppl_Aot::utilElementType2Image(_treeNode.applObjectType())), false, this.getNodeStateImage(nIndex));
      #                formTreeItem = TreeSettings.getItem(nChild);
      #                formTreeItem.children(true);
      #                TreeSettings.setItem(formTreeItem);
      #                return;
      #            }
      #            nChildLevel2 = TreeSettings.getChild(nChild);
      #            while (nChildLevel2)
      #            {
      #                if (typeOf(TreeSettings.getItem(nChildLevel2).data()) == Types::String && TreeSettings.getItem(nChildLevel2).data() == treeNodePath)
      #                {
      #                    SysFormTreeControl::addTreeItem(TreeSettings, _treeNode.treeNodeName(), nChildLevel2, _treeNode.applObjectType(),//_treeNode.treeNodePath(),
      #                                                    imageListSmallAOT.image(ImageListAppl_Aot::utilElementType2Image(_treeNode.applObjectType())), false, this.getNodeStateImage(nIndex));
      #                    formTreeItem = TreeSettings.getItem(nChildLevel2);
      #                    formTreeItem.children(true);
      #                    TreeSettings.setItem(formTreeItem);
      #                    return;
      #                }
      #                nChildLevel2 = TreeSettings.getNextSibling(nChildLevel2);
      #            }
      #            nChild = TreeSettings.getNextSibling(nChild);
      #        }
      #        nItem = TreeSettings.getNextSibling(nItem);
      #    }
      #}
    ENDSOURCE
    SOURCE #addProjectObjects2Tree
      ##TreeNodeSysNodeType
      #void addProjectObjects2Tree()
      #{
      #    TreeNodeName        findProjectName;
      #    Object              prjListNode;
      #    ProjectNode         prjNode;
      #    TreeNode            treeNode;
      #    TreeNodeIterator    treeNodeIterator;
      #
      #    void    GetProjectGroup(ProjectGroupNode parentNode)
      #    {
      #        TreeNode                treeNodeLocal;
      #        TreeNodeIterator        treeNodeIteratorLocal;
      #        ;
      #        treeNodeIteratorLocal = parentNode.AOTIterator();
      #        treeNodeLocal = treeNodeIteratorLocal.next();
      #        while (treeNodeLocal)
      #        {
      #            if (treeNodeLocal.sysNodeType() == #NT_PROJECT_GROUP)
      #                GetProjectGroup(treeNodeLocal);
      #            else
      #            {
      #                element.addObject2Tree(treeNodeLocal);
      #            }
      #            treeNodeLocal = treeNodeIteratorLocal.next();
      #        }
      #    }
      #    ;
      #    prjListNode = projectTypeOrig == ProjectSharedPrivate::ProjPrivate ?
      #        SysTreeNode::getPrivateProject() : SysTreeNode::getSharedProject();
      #
      #    if (usePrefixOrig)
      #        findProjectName = axCreateNewProject.convertProjectPrefix(projectPrefixOrig);
      #    findProjectName += projectNameOrig;
      #
      #    prjNode = prjListNode.AOTfindChild(findProjectName);
      #
      #    if (!prjNode)
      #    {
      #        error(strFmt(@"A %1 project %2 was not found", cbProjectType.selection() == ProjectSharedPrivate::ProjPrivate ?
      #            @"Private" : @"Shared", projectNameOrig));
      #        return;
      #    }
      #
      #    prjNode = prjNode.loadForInspection();
      #    startLengthyOperation();
      #    treeNodeIterator = prjNode.AOTiterator();
      #
      #    treeNode = treeNodeIterator.next();
      #    while (treeNode)
      #    {
      #        if (treeNode.sysNodeType() == #NT_PROJECT_GROUP)
      #        {
      #            GetProjectGroup(treeNode);
      #        }
      #        else
      #        {
      #            element.addObject2Tree(treeNode);
      #        }
      #        treeNode = treeNodeIterator.next();
      #    }
      #    endLengthyOperation();
      #    ButtonCopyProjectObjects.enabled(NoYes::No);
      #}
    ENDSOURCE
    SOURCE #setCaptionText
      #void setCaptionText()
      #{
      #    ;
      #    if (warnAboutNameDuplicates)
      #    {
      #        if (cbProjectType.selection() == ProjectSharedPrivate::ProjPrivate)
      #            element.design().caption(@"Create a new Private project");
      #        else
      #            element.design().caption(@"Create a new Shared project");
      #    }
      #    else
      #    {
      #        element.design().caption(@"Update an existing project");
      #    }
      #}
    ENDSOURCE
    SOURCE #sendDataToClass
      #void sendDataToClass()
      #{
      #    ;
      #    selectedProjectNodes = element.readSelectedNodes(conNull(), TreeSettings.getRoot());
      #
      #    projectType          = cbProjectType.selection();
      #    projectName          = szProjectName.valueStr();
      #    projectPrefix        = szProjectNamePrefix.valueStr();
      #    usePrefixValue       = usePrefix.value();
      #
      #    axCreateNewProject.parmFormControlValues([#FormControlValues]);
      #
      #    if (updateExistingProject && warnAboutNameDuplicates && objectTypeName.elements() > 0)
      #    {
      #        axCreateNewProject.setObjectTypeName(objectTypeName.pack());
      #    }
      #}
    ENDSOURCE
    SOURCE #getRootStateImage
      #int getRootStateImage()
      #{
      #    ;
      #    if (!conFind(selectedProjectNodes, UnknownNoYes::No))
      #        return imageListAppl_checkbox.image(#ImageCheckAll);
      #
      #    if (!conFind(selectedProjectNodes, UnknownNoYes::Yes))
      #        return imageListAppl_checkbox.image(#ImageCheckNone);
      #
      #    return imageListAppl_checkbox.image(#ImageCheckSome);
      #}
    ENDSOURCE
    SOURCE #validateProjectName
      #void validateProjectName(str _projectPrefix, str _projectName)
      #{
      #    str             validateName;
      #    FormTreeItem    rootNode;
      #    ;
      #    if (usePrefix.value())
      #        validateName = axCreateNewProject.convertProjectPrefix(_projectPrefix);
      #    validateName += _projectName;
      #
      #    if ((maxNameLen < strLen(validateName)) ||
      #        (!TreeNode::isValidObjectName(validateName)))
      #    {
      #        ProjectNameValid.imageResource(1031);
      #    }
      #    else
      #    {
      #        if (warnAboutNameDuplicates &&
      #            ((cbProjectType.selection() == ProjectSharedPrivate::ProjShared && SysTreeNode::getSharedProject().AOTfindChild(validateName)) ||
      #            (cbProjectType.selection() == ProjectSharedPrivate::ProjPrivate && SysTreeNode::getPrivateProject().AOTfindChild(validateName))))
      #        {
      #            ProjectNameValid.imageResource(1031);
      #        }
      #        else
      #        {
      #            ProjectNameValid.imageResource(1030);
      #        }
      #    }
      #    rootNode = TreeSettings.getItem(TreeSettings.getRoot());
      #    rootNode.text(validateName);
      #    TreeSettings.setItem(rootNode);
      #}
    ENDSOURCE
    SOURCE #initFromCallerClass
      #void initFromCallerClass()
      #{
      #    ;
      #    [#FormControlValues] = axCreateNewProject.parmFormControlValues();
      #
      #    szProjectNamePrefix.text(projectPrefix);
      #    cbProjectType.selection(projectType);
      #    szProjectName.text(projectName);
      #    usePrefix.value(usePrefixValue);
      #    szProjectNamePrefix.enabled(usePrefixValue);
      #
      #    element.setCaptionText();
      #
      #    if (updateExistingProject && !warnAboutNameDuplicates)
      #    {
      #        projectPrefixOrig = projectPrefix;
      #        projectNameOrig = projectName;
      #        projectTypeOrig = projectType;
      #        usePrefixOrig   = usePrefixValue;
      #    }
      #
      #    this.initImageLists();
      #    this.fillTree();
      #}
    ENDSOURCE
    SOURCE #getNodeStateValue
      #int getNodeStateValue(int _nIndex)
      #{
      #    FormTreeItem formTreeItem = TreeSettings.getItem(_nIndex);
      #    ;
      #
      #    switch (formTreeItem.stateImage())
      #    {
      #        case imageListAppl_checkbox.image(#ImageCheckAll) :
      #            return UnknownNoYes::Yes;
      #
      #        case imageListAppl_checkbox.image(#ImageCheckNone) :
      #            return UnknownNoYes::No;
      #    }
      #    return UnknownNoYes::Unknown;
      #}
    ENDSOURCE
    SOURCE #readSelectedNodes
      #container readSelectedNodes(container _selectedNodes, int _item)
      #{
      #    FormTreeItem    formTreeItem;
      #    container       conSelected = _selectedNodes;
      #    container       conObjects;
      #    int             nItem;
      #    int             nIndex;
      #    ;
      #    nItem = TreeSettings.getChild(_item);
      #    while (nItem)
      #    {
      #        formTreeItem = TreeSettings.getItem(nItem);
      #        if (typeOf(formTreeItem.data()) == Types::String)
      #            conSelected += [element.getNodeStateValue(nItem)];
      #        else if (formTreeItem.stateImage() == imageListAppl_checkbox.image(#ImageCheckAll))
      #        {
      #            nIndex = conLen(conSelected);
      #            if (objectTypeName.exists(nIndex))
      #                conObjects = objectTypeName.lookup(nIndex);
      #            conObjects += formTreeItem.text();
      #            conObjects += formTreeItem.data();
      #
      #            objectTypeName.insert(nIndex, conObjects);
      #        }
      #        if (TreeSettings.getChild(nItem))
      #            conSelected = element.readSelectedNodes(conSelected, nItem);
      #
      #        nItem = TreeSettings.getNextSibling(nItem);
      #    }
      #    return conSelected;
      #}
    ENDSOURCE
    SOURCE #initImageLists
      #void initImageLists()
      #{
      #    int i;
      #    int img;
      #    str dummy;
      #    ;
      #
      #    imageListSmallAOT       = new ImageListAppl_Aot();
      #    imageListAppl_Checkbox  = new ImageListAppl_Checkbox();
      #
      #    if (updateExistingProject && !warnAboutNameDuplicates)
      #    {
      #        imageListSmallAOT.build();
      #        objectTypeName = new Map(Types::Integer, Types::Container);
      #    }
      #    else
      #    {
      #        imageListSmallAOT.add(#ImageProject);
      #        for(i = 1; i <= conlen(this.pathes()); i++)
      #        {
      #            [dummy, img] = conPeek(this.pathes(), i);
      #            imageListSmallAOT.add(img);
      #        }
      #    }
      #    dummy = dummy; //BP Deviation Fix
      #    TreeSettings.setImagelist(imageListSmallAOT.imageList());
      #    TreeSettings.setStateImagelist(imageListAppl_Checkbox.imageList());
      #}
    ENDSOURCE
    SOURCE #getNodeStateImage
      #int getNodeStateImage(int _nIndex)
      #{
      #    ;
      #    switch (conPeek(selectedProjectNodes, _nIndex))
      #    {
      #        case UnknownNoYes::Unknown  :
      #            return imageListAppl_checkbox.image(#ImageCheckSome);
      #
      #        case UnknownNoYes::Yes      :
      #            return imageListAppl_checkbox.image(#ImageCheckAll);
      #    }
      #    return imageListAppl_checkbox.image(#ImageCheckNone);
      #}
    ENDSOURCE
    SOURCE #addTreeNode
      #TreeItemIdx addTreeNode(str _nodePath, int _nIndex, int _parentIdx, boolean _hasChildren = false)
      #{
      #    int     img;
      #    int     dummy;
      #    ;
      #    [dummy, img] = conPeek(this.pathes(), _nIndex);
      #    dummy = dummy; //BP Deviation Fix
      #    return SysFormTreeControl::addTreeItem(TreeSettings,                        //FormTreeControl
      #                                           SysTreeNode::pathName(_nodePath),    //Item Name
      #                                           _parentIdx,                          //Parent Index
      #                                           _nodePath,                           //Item Data
      #                                           imageListSmallAOT.image(img),        //Item Image
      #                                           _hasChildren,                        //has Child nodes?
      #                                           element.getNodeStateImage(_nIndex)); //Item checkbox image
      #}
    ENDSOURCE
    SOURCE #CloseOk
      #void closeOk()
      #{
      #    DialogRunbase dialog = element.args().caller();
      #    ;
      #    element.sendDataToClass();
      #
      #    dialog.updateServer();
      #
      #    if (axCreateNewProject.checkCloseDialog())
      #        super();
      #}
      #
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    ;
      #    if (!element.args().caller())
      #        throw error(strFmt(@"Method '%1.%2()' was called incorrectly", this.name(), funcName()));
      #
      #    axCreateNewProject =  element.args().caller().runbase();
      #
      #    super();
      #
      #    maxNameLen = new SysDictType(extendedTypeNum(TreeNodeName)).stringLen();
      #    this.initFromCallerClass();
      #    this.validateProjectName(szProjectNamePrefix.valueStr(), szProjectName.valueStr());
      #}
    ENDSOURCE
    SOURCE #runBase
      #RunBase runBase()
      #{
      #    return axCreateNewProject;
      #}
      #
    ENDSOURCE
    SOURCE #pathes
      #container pathes()
      #{
      #    ;
      #    if (!aotPathes)
      #    {
      #        aotPathes =
      #        [
      #            [#DataDictionaryPath,       #imageDataDictionary],
      #            [#TablesPath,               #imageTables],
      #            [#TableMapsPath,            #imageTableMaps],
      #            [#ViewsPath,                #ImageViews],
      #            [#ExtendedDataTypesPath,    #imageEDTs],
      #            [#BaseEnumsPath,            #imageBaseEnums],
      #            [#DataDictionaryPath,       #imageDataDictionary],
      #            #ifnot.ReferencesPath
      #            [#FeatureKeysPath,          #ImageFeaturekeys],
      #            #endIf
      #            [#LicenseCodesPath,         #ImageLicenseCodes],
      #            [#ConfigurationKeysPath,    #ImageConfigurationKeys],
      #            [#SecurityKeysPath,         #ImageSecurityKeys],
      #            [#TableCollectionsPath,     #ImageTableCollections],
      #            #if.ReferencesPath
      #            [#PerspectivesPath,         #ImagePerspectiveList],
      #            #endIf
      #            [#MacrosPath,               #imageMacros],
      #            [#ClassesPath,              #imageClasses],
      #            [#FormsPath,                #imageForms],
      #            [#ReportsPath,              #imageReports],
      #            [#QueriesPath,              #imageQueries],
      #            [#JobsPath,                 #imageJobs],
      #            [#MenusPath,                #imageMenus],
      #            [#MenuItemsPath,            #imageMenuItems],
      #            [#MenuItemsDisplayPath,     #ImageMenuDisplayItems],
      #            [#MenuItemsOutputPath,      #imageMenuOutputItems],
      #            [#MenuItemsActionPath,      #imageMenuActionItems]
      #        ];
      #    }
      #    return aotPathes;
      #}
    ENDSOURCE
    SOURCE #fillTree
      #void fillTree()
      #{
      #    TreeItemIdx     rootIdx;
      #    TreeItemIdx     dataDictionaryIdx;
      #    TreeItemIdx     menuItemsIdx;
      #    TreeItemIdx     moreIdx;
      #    Line            curLine = 8;
      #    ;
      #    TreeSettings.deleteAll();
      #
      #    rootIdx = SysFormTreeControl::addTreeItem(TreeSettings, @"Project", FormTreeAdd::Root, @"Project",
      #        imageListSmallAOT.image(#ImageProject), true, element.getRootStateImage());
      #
      #    dataDictionaryIdx   = element.addTreeNode(#DataDictionaryPath,      1, rootIdx, true);
      #    element.addTreeNode(#TablesPath,              2, dataDictionaryIdx);
      #    element.addTreeNode(#TableMapsPath,           3, dataDictionaryIdx);
      #    element.addTreeNode(#ViewsPath,               4, dataDictionaryIdx);
      #    element.addTreeNode(#ExtendedDataTypesPath,   5, dataDictionaryIdx);
      #    element.addTreeNode(#BaseEnumsPath,           6, dataDictionaryIdx);
      #
      #    moreIdx = SysFormTreeControl::addTreeItem(TreeSettings, @"More...", dataDictionaryIdx, @"More...",
      #        imageListSmallAOT.image(#ImageDataDictionary), true, element.getNodeStateImage(7));
      #
      #    #ifnot.ReferencesPath   //AX3
      #    element.addTreeNode(#FeatureKeysPath,         curLine, moreIdx);    curLine++;
      #    #endIf
      #    element.addTreeNode(#LicenseCodesPath,        curLine, moreIdx);    curLine++;
      #    element.addTreeNode(#ConfigurationKeysPath,   curLine, moreIdx);    curLine++;
      #    element.addTreeNode(#SecurityKeysPath,        curLine, moreIdx);    curLine++;
      #    element.addTreeNode(#TableCollectionsPath,    curLine, moreIdx);    curLine++;
      #    #if.ReferencesPath      //AX4
      #    element.addTreeNode(#PerspectivesPath,        curLine, moreIdx);    curLine++;
      #    #endIf
      #
      #    element.addTreeNode(#MacrosPath,              13, rootIdx);
      #    element.addTreeNode(#ClassesPath,             14, rootIdx);
      #    element.addTreeNode(#FormsPath,               15, rootIdx);
      #    element.addTreeNode(#ReportsPath,             16, rootIdx);
      #    element.addTreeNode(#QueriesPath,             17, rootIdx);
      #    element.addTreeNode(#JobsPath,                18, rootIdx);
      #    element.addTreeNode(#MenusPath,               19, rootIdx);
      #
      #    menuItemsIdx        = element.addTreeNode(#MenuItemsPath, 20, rootIdx, true);
      #    element.addTreeNode(#MenuItemsDisplayPath,    21, menuItemsIdx);
      #    element.addTreeNode(#MenuItemsOutputPath,     22, menuItemsIdx);
      #    element.addTreeNode(#MenuItemsActionPath,     23, menuItemsIdx);
      #
      #    SysFormTreeControl::expandTree(TreeSettings, rootIdx);
      #    SysFormTreeControl::expandTree(TreeSettings, dataDictionaryIdx);
      #    SysFormTreeControl::expandTree(TreeSettings, menuItemsIdx);
      #    SysFormTreeControl::collapseTree(TreeSettings, moreIdx);
      #
      #    TreeSettings.select(rootIdx);
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES
  ENDOBJECTBANK
  JOINS
  ENDJOINS
  DESIGN
    PROPERTIES
      Caption             #Create a new Shared/Private Project
      Frame               #Dialog
      WindowType          #Popup
      SaveSize            #Yes
      HideToolbar         #Yes
      Columns             #2
      ArrangeGuide       
        ARRAY INDEX Columns
          #0
          #0
        ENDARRAY
      AllowUserSetup      #Restricted
    ENDPROPERTIES
    CONTAINER
      CONTROL TAB
        PROPERTIES
          Name                #Tab
          Width               #Column width
          Height              #Column height
          Tabs                #1
          ShowTabs            #No
        ENDPROPERTIES
        CONTAINER
          CONTROL TABPAGE
            PROPERTIES
              Name                #TabPage
              Caption             #@SYS2952
            ENDPROPERTIES
            CONTAINER
              CONTROL GROUP
                PROPERTIES
                  Name                #dialogStartGrp
                  Visible             #No
                  FrameType           #None
                ENDPROPERTIES
                  CONTAINER
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #ProjectNameGrp
                  FrameType           #None
                  Columns             #2
                  ArrangeGuide       
                    ARRAY INDEX Columns
                      #0
                      #0
                    ENDARRAY
                  AlignChildren       #No
                  AlignChild          #No
                ENDPROPERTIES
                  CONTAINER
                    CONTROL STRINGEDIT
                      PROPERTIES
                        Name                #szProjectName
                        AutoDeclaration     #Yes
                        Width               #150
                        Label               #Project name
                        LabelAlignment      #Right
                        ExtendedDataType   
                          ARRAY
                            #TreeNodeName
                            #
                          ENDARRAY
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #textChange
                          #public void textChange()
                          #{
                          #    super();
                          #
                          #    if (updateExistingProject && !warnAboutNameDuplicates)
                          #    {
                          #        warnAboutNameDuplicates = NoYes::Yes;
                          #        ButtonCopyProjectObjects.enabled(NoYes::Yes);
                          #    }
                          #    element.setCaptionText();
                          #
                          #    element.validateProjectName(szProjectNamePrefix.valueStr(), szProjectName.valueStr());
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                    CONTROL WINDOW
                      PROPERTIES
                        Name                #ProjectNameValid
                        AutoDeclaration     #Yes
                        Height              #Column height
                        Skip                #Yes
                        ImageResource       #1031
                        Imagemode           #Size to fit
                        BackStyle           #Transparent
                        BackgroundColor     #Button face (3D)
                        ForegroundColor     #Button text
                        ShowLabel           #No
                      ENDPROPERTIES
                      METHODS
                        Version: 3
                        SOURCE #toolTip
                          #public str toolTip()
                          #{
                          #    str validateName;
                          #    ;
                          #    if (usePrefix.value())
                          #    {
                          #        validateName = axCreateNewProject.convertProjectPrefix(szProjectNamePrefix.valueStr());
                          #        if (validateName && !TreeNode::isValidObjectName(validateName))
                          #            return @"The Project prefix contains illegal characters";
                          #    }
                          #    validateName += szProjectName.valueStr();
                          #
                          #    if (maxNameLen < strLen(validateName))
                          #        return @"The name of the project is too long";
                          #
                          #    if (warnAboutNameDuplicates &&
                          #        ((cbProjectType.selection() == ProjectSharedPrivate::ProjShared && SysTreeNode::getSharedProject().AOTfindChild(validateName)) ||
                          #        (cbProjectType.selection() == ProjectSharedPrivate::ProjPrivate && SysTreeNode::getPrivateProject().AOTfindChild(validateName))))
                          #        return @"Project with such name already exists";
                          #
                          #    if (!TreeNode::isValidObjectName(validateName))
                          #        return @"The name of the project contains illegal characters";
                          #
                          #    return @"The Project Name is valid";
                          #}
                        ENDSOURCE
                      ENDMETHODS
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
              CONTROL GROUP
                PROPERTIES
                  Name                #SettingsMainGrp
                  AutoDeclaration     #Yes
                  Width               #Column width
                  Height              #Column height
                  Skip                #Yes
                  FrameType           #Edged 3D Line
                  Caption             #Project Settings
                ENDPROPERTIES
                  CONTAINER
                    CONTROL GROUP
                      PROPERTIES
                        Name                #ProjectTypePrefixGrp
                        FrameType           #None
                        Columns             #2
                        ArrangeGuide       
                          ARRAY INDEX Columns
                            #0
                            #0
                          ENDARRAY
                        AlignChild          #No
                      ENDPROPERTIES
                        CONTAINER
                          CONTROL GROUP
                            PROPERTIES
                              Name                #ProjectNamePrefix
                              FrameType           #None
                              Columns             #2
                              Columnspace         #0
                              ArrangeGuide       
                                ARRAY INDEX Columns
                                  #0
                                  #0
                                ENDARRAY
                              AlignChildren       #No
                            ENDPROPERTIES
                              CONTAINER
                                CONTROL CHECKBOX
                                  PROPERTIES
                                    Name                #UsePrefix
                                    AutoDeclaration     #Yes
                                    Skip                #Yes
                                    Value               #1
                                    ShowLabel           #No
                                    LabelAlignment      #Right
                                  ENDPROPERTIES
                                  METHODS
                                    Version: 3
                                    SOURCE #modified
                                      #public boolean modified()
                                      #{
                                      #    boolean ret;
                                      #
                                      #    ret = super();
                                      #
                                      #    szProjectNamePrefix.enabled(this.value());
                                      #
                                      #    if (updateExistingProject && !warnAboutNameDuplicates)
                                      #    {
                                      #        warnAboutNameDuplicates = NoYes::Yes;
                                      #        ButtonCopyProjectObjects.enabled(NoYes::Yes);
                                      #    }
                                      #    element.setCaptionText();
                                      #
                                      #    element.validateProjectName(szProjectNamePrefix.valueStr(), szProjectName.valueStr());
                                      #
                                      #    return ret;
                                      #}
                                    ENDSOURCE
                                  ENDMETHODS
                                ENDCONTROL
                                CONTROL STRINGEDIT
                                  PROPERTIES
                                    Name                #szProjectNamePrefix
                                    AutoDeclaration     #Yes
                                    HelpText            #Input a prefix that will be automatically added to the name of the project
                                    LimitText           #20
                                    DisplayLength       #10
                                    Label               #Prefix
                                    LabelAlignment      #Right
                                  ENDPROPERTIES
                                  METHODS
                                    Version: 3
                                    SOURCE #textChange
                                      #public void textChange()
                                      #{
                                      #    super();
                                      #
                                      #    if (updateExistingProject && !warnAboutNameDuplicates)
                                      #    {
                                      #        warnAboutNameDuplicates = NoYes::Yes;
                                      #        ButtonCopyProjectObjects.enabled(NoYes::Yes);
                                      #    }
                                      #    element.setCaptionText();
                                      #
                                      #    element.validateProjectName(szProjectNamePrefix.valueStr(), szProjectName.valueStr());
                                      #}
                                    ENDSOURCE
                                  ENDMETHODS
                                ENDCONTROL
                              ENDCONTAINER
                          ENDCONTROL
                          CONTROL COMBOBOX
                            PROPERTIES
                              Name                #cbProjectType
                              AutoDeclaration     #Yes
                              HelpText            #Create a shared or a private project?
                              Text               
                                ARRAY INDEX Items
                                  #Shared
                                  #Private
                                ENDARRAY
                              Item                #1
                              Items               #2
                              Label               #Project type
                              LabelAlignment      #Right
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #selectionChange
                                #public int selectionChange()
                                #{
                                #    int ret;
                                #
                                #    ret = super();
                                #
                                #    if (updateExistingProject && !warnAboutNameDuplicates)
                                #    {
                                #        warnAboutNameDuplicates = NoYes::Yes;
                                #        ButtonCopyProjectObjects.enabled(NoYes::Yes);
                                #    }
                                #    element.setCaptionText();
                                #
                                #    element.validateProjectName(szProjectNamePrefix.valueStr(), szProjectName.valueStr());
                                #
                                #    return ret;
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                        ENDCONTAINER
                    ENDCONTROL
                    CONTROL GROUP
                      PROPERTIES
                        Name                #SettingsGrp
                        Width               #Column width
                        Height              #Column height
                        FrameType           #None
                        AlignChild          #No
                      ENDPROPERTIES
                        CONTAINER
                          CONTROL TREE
                            PROPERTIES
                              Name                #TreeSettings
                              Width               #Column width
                              Height              #Column height
                              LinesAtRoot         #No
                              Bold                #Normal
                            ENDPROPERTIES
                            METHODS
                              Version: 3
                              SOURCE #mouseDblClick
                                #public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
                                #{
                                #    #define.FOCUS_CHECKBOX(64)
                                #    int             ret;
                                #    int             idx;
                                #    int             focus;
                                #    FormTreeItem    formTreeItem;
                                #    ;
                                #    if (_Shift || _Ctrl || _button != 1)
                                #        return 1;
                                #
                                #    ret = super(_x, _y, _button, _ctrl, _shift);
                                #
                                #    [idx, focus] = this.hitTest(_x, _y);
                                #
                                #    if (focus & #FOCUS_CHECKBOX && this.getItem(idx))
                                #    {
                                #        formTreeItem = this.getItem(idx);
                                #
                                #        SysFormTreeControl::changeStateImage_CheckBox(this, formTreeItem.idx());
                                #    }
                                #
                                #    return ret;
                                #}
                              ENDSOURCE
                              SOURCE #mouseDown
                                #public int mouseDown(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
                                #{
                                #    #define.FOCUS_CHECKBOX(64)
                                #        #FormListControl
                                #    int             ret;
                                #    int             focus;
                                #    TreeItemIdx     idx;
                                #    FormTreeItem    formTreeItem;
                                #    ;
                                #    ret = super(_x, _y, _button, _Ctrl, _Shift);
                                #
                                #    [idx, focus] = this.hitTest(_x, _y);
                                #
                                #    if (focus & #FOCUS_CHECKBOX && this.getItem(idx))
                                #    {
                                #        formTreeItem = this.getItem(idx);
                                #
                                #        SysFormTreeControl::changeStateImage_CheckBox(this, formTreeItem.idx());
                                #    }
                                #
                                #    return ret;
                                #}
                              ENDSOURCE
                            ENDMETHODS
                          ENDCONTROL
                        ENDCONTAINER
                    ENDCONTROL
                  ENDCONTAINER
              ENDCONTROL
              CONTROL BUTTONGROUP
                PROPERTIES
                  Name                #RightButtonGrp
                ENDPROPERTIES
                CONTAINER
                ENDCONTAINER
              ENDCONTROL
            ENDCONTAINER
          ENDCONTROL
        ENDCONTAINER
      ENDCONTROL
      CONTROL GROUP
        PROPERTIES
          Name                #BottomGrp
          Top                 #Bottom edge
          Width               #Column width
          FrameType           #Edged 3D Line
          Columns             #2
          ArrangeGuide       
            ARRAY INDEX Columns
              #0
              #0
            ENDARRAY
        ENDPROPERTIES
          CONTAINER
            CONTROL BUTTONGROUP
              PROPERTIES
                Name                #BottomButtonGrp
                Left                #Auto (right)
                SizeWidth           #No
                ArrangeMethod       #Horizontal, flush right
              ENDPROPERTIES
              CONTAINER
                CONTROL BUTTON
                  PROPERTIES
                    Name                #ButtonCopyProjectObjects
                    AutoDeclaration     #Yes
                    Enabled             #No
                    HelpText            #Copy objects from the selected Project
                    Text                #Copy Objects
                    ShowShortCut        #No
                  ENDPROPERTIES
                  METHODS
                    Version: 3
                    SOURCE #clicked
                      #void clicked()
                      #{
                      #    super();
                      #
                      #    element.addProjectObjects2Tree();
                      #}
                    ENDSOURCE
                  ENDMETHODS
                ENDCONTROL
                CONTROL COMMANDBUTTON
                  PROPERTIES
                    Name                #CommandButtonOK
                    ShowShortCut        #No
                    DefaultButton       #Yes
                    Command             #263
                  ENDPROPERTIES
                ENDCONTROL
                CONTROL COMMANDBUTTON
                  PROPERTIES
                    Name                #CommandButtonCancel
                    ShowShortCut        #No
                    Command             #264
                  ENDPROPERTIES
                ENDCONTROL
              ENDCONTAINER
            ENDCONTROL
          ENDCONTAINER
      ENDCONTROL
    ENDCONTAINER
  ENDDESIGN
ENDFORM

***Element: CLS

; Microsoft Dynamics AX Class: MF_EditorScripts_ForAxassist 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_EditorScripts_ForAxassist
    Id 50017
    PROPERTIES
      Name                #MF_EditorScripts_ForAxassist
      Extends             #
      RunOn               #Client
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
        #class MF_EditorScripts_ForAxassist
        #{
        #}
      ENDSOURCE
      SOURCE #getApplicableScripts
        #//
        #// System entry point
        #//
        #public container getApplicableScripts(Editor _editor)
        #{
        #    TreeNode aotNode = EditorScripts::getApplObjectNode(_editor);
        #    DictClass dictClass = new DictClass(classnum(EditorScripts));
        #    DictMethod dictMethod;
        #    int i;
        #    container scripts;
        #
        #    //
        #    // Insert menu items
        #    //
        #    for (i = 1; i <= dictClass.objectMethodCnt(); i++)
        #    {
        #        dictMethod = dictClass.objectMethodObject(i);
        #        if (this.isApplicableMethod(dictMethod, aotNode))
        #        {
        #            scripts += dictMethod.name();
        #        }
        #    }
        #    // Axassist 2009 install begin
        #    if(DEV_AxAssistSingleton::getThisClass().parmAltMEmulate())
        #      {
        #        DEV_AxAssistSingleton::getThisClass().parmEditor(_editor);
        #        DEV_AxAssistSingleton::getThisClass().parmAltMEmulate(false);
        #        return connull();
        #      }
        #    // Axassist 2009 install end
        #
        #    // Axassist 4.0 Install begin
        #      if(DEV_AxAssistSingleton::getThisClass().parmAltMEmulate())
        #      {
        #        DEV_AxAssistSingleton::getThisClass().parmEditor(e);
        #        DEV_AxAssistSingleton::getThisClass().parmAltMEmulate(false);
        #        return connull();
        #      }
        #    // Axassist 4.0 install end
        #
        #    return scripts;
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_QueryBrowser 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_QueryBrowser
    Id 50015
    PROPERTIES
      Name                #MF_QueryBrowser
      Extends             #
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #// Created by GRR for QueryBrowser on 28.09.2007
        #class MF_QueryBrowser
        #{
        #    #DEFINE.FormWidth(750)//500
        #    #DEFINE.FormHeight(450)//300
        #}
      ENDSOURCE
      SOURCE #run
        #public void run(Query query)
        #{
        #    TableId                         tableId;
        #    DictTable                       dictTable;
        #    Object                          formRun;
        #
        #    FieldId                         fieldId;
        #    FieldId                         _fieldId;
        #    DictField                       dictField;
        #
        #    Form                            tableBrowser;
        #    FormBuildDesign                 formBuildDesign;
        #    FormBuildDataSource             formBuildDataSource;
        #    FormBuildGridControl            formBuildGridControl;
        #    FormBuildControl                formBuildField;
        #
        #    FormControl                     formControl;
        #    FormBuildStringControl          formBuildStringControl;
        #    Object                          formBuildControl;
        #
        #    FormGridControl                 formGridControl;
        #    int                             idx;
        #
        #    Args                            args;
        #    Args                            browserArgs;
        #
        #    int                             cnt;
        #    int                             dsIdx;
        #    int                             i, j;
        #
        #    container                       cGrayFields;
        #    #DictField
        #    ;
        #
        #    browserArgs     = new Args();
        #    browserArgs.name(formStr(MF_QueryBrowser));
        #    formRun         = classFactory.formRunClass(browserArgs);
        #    tableBrowser    = formRun.form();
        #
        #    formBuildDesign = tableBrowser.design();
        #    formBuildDesign.caption(
        #        "@SYS13579" + (query.name()?(': '+query.name()):''));
        #    formBuildDesign.widthMode(-1);
        #    formBuildDesign.widthValue(#FormWidth);
        #    formBuildDesign.heightMode(-1);
        #    formBuildDesign.heightValue(#FormHeight);
        #
        #    cnt = query.dataSourceCount();
        #
        #    for (dsIdx = 1; dsIdx <= cnt; dsIdx++)
        #    {
        #        tableId         = query.dataSourceNo(dsIdx).table();
        #        dictTable       = new DictTable(tableId);
        #
        #        if(dsIdx == 1)
        #        {
        #            formBuildDataSource = tableBrowser.dataSource(dsIdx);
        #            formBuildDataSource.name(dictTable.name());
        #            formBuildDataSource.table(tableId);
        #
        #            formBuildGridControl = formBuildDesign.addControl(FormControlType::GRID,'Grid');
        #            formBuildGridControl.dataSource(dictTable.name());
        #            formBuildGridControl.widthMode(1);
        #            formBuildGridControl.heightMode(1);
        #            formBuildGridControl.visible(true);
        #            idx = formBuildGridControl.id();
        #        }
        #        else
        #        {
        #            formBuildDataSource = tableBrowser.addDataSource(dictTable.name());
        #            formBuildDataSource.table(tableId);
        #        }
        #
        #        for (i=1; i<=dictTable.fieldCnt(); i++)
        #        {
        #            fieldId = dictTable.fieldCnt2Id(i);
        #            dictField = new DictField(dictTable.id(), fieldId);
        #
        #            if (bitTest(dictField.flags(), #DBF_STORE))
        #            {
        #                for(j = 1;j <= dictField.arraySize(); j++)
        #                {
        #                    _fieldId = fieldId2Ext(fieldId, j);
        #
        #                    if (dictField.baseType() != Types::CONTAINER)
        #                    {
        #                        formBuildField = formBuildGridControl.addDataField(formBuildDataSource.id(), _fieldId);
        #                        formControl = formBuildDesign.control(formBuildField.id());
        #                        formControl.helpText(
        #                            formBuildDataSource.name() + '.' + fieldId2Name(formBuildDataSource.table(), _fieldId) +
        #                            ' ['+ fieldId2pName(formBuildDataSource.table(), _fieldId) + ']');
        #                    }
        #
        #                    if (dictField.baseType() == Types::STRING ||
        #                        dictField.baseType() == Types::RSTRING ||
        #                        dictField.baseType() == Types::VARSTRING)
        #                    {
        #                        formBuildStringControl = formBuildField;
        #
        #                        formBuildStringControl.displayHeightMode(0);
        #                        formBuildStringControl.displayHeightValue(1);
        #                        formBuildStringControl.label(dictField.name());
        #                    }
        #                    else
        #                    {
        #                        if (dictField.baseType() != Types::CONTAINER)
        #                        {
        #                            formBuildControl = formBuildField;
        #                            if (formBuildControl)
        #                            {
        #                                formBuildControl.label(dictField.name());
        #                            }
        #                        }
        #                        else
        #                        {
        #                            formBuildControl = formBuildGridControl.addControl(FormControlType::STRING,'TableBrowserContainer');
        #                            formBuildControl.datasource(formBuildDataSource.id());
        #                            formBuildControl.dataField(fieldId2Ext(fieldId,j));
        #                            formBuildControl.label(dictField.name());
        #                            //formBuildControl.helpText(dictField.label());
        #
        #                            formBuildControl.helpText(
        #                                formBuildDataSource.name() + '.' + fieldId2Name(formBuildDataSource.table(), _fieldId) +
        #                                ' ['+ fieldId2pName(formBuildDataSource.table(), _fieldId) + ']');
        #
        #                            formBuildControl.displayLengthMode(0);
        #                            formBuildControl.displayLengthValue(5);
        #                            formBuildControl.lookupButton(2);
        #                        }
        #                    }
        #
        #                    if(!(dsIdx mod 2))
        #                        cGrayFields += formControl.id();
        #                }
        #            }
        #        }
        #    }
        #
        #    args = new Args();
        #    args.object(tableBrowser);
        #    formRun = classFactory.formRunClass(args);
        #
        #    formRun.init();
        #    formRun.parmQuery(query);
        #    formRun.parmGrayFields(cGrayFields);
        #    formRun.run();
        #
        #    formGridControl = formRun.control(idx);
        #    formGridControl.setFocus();
        #
        #    formRun.detach();
        #}
      ENDSOURCE
      SOURCE #main
        #client static void main(Args _args)
        #{
        #    boolean isRunFromTabax()
        #    {
        #        return _args.caller()
        #               &&
        #               classIdGet(_args.caller())==classNum(SysSetupFormRun)
        #               &&
        #               _args.caller().name()=='Tabax';
        #    }
        #
        #    void processContext(SysContextMenu _context)
        #    {
        #        TreeNode node = _context.first();
        #        Query query = MF_QueryBrowser::treeNode2Query(node);
        #        if(query)
        #            new MF_QueryBrowser().run(query);
        #    }
        #
        #    void processTabax()
        #    {
        #        FormRun currentFormRun = _args.caller().currentFormRun();
        #        FormDataSource ds;
        #        if (currentFormRun)
        #            ds = currentFormRun.dataSource();
        #        if (ds)
        #            new MF_QueryBrowser().run(ds.query());
        #        else
        #            processContext(_args.caller().currentSysContextMenu());
        #    }
        #;
        #    if (isRunFromTabax())
        #        processTabax();
        #    else if (SysContextMenu::startedFrom(_args))
        #        processContext(_args.parmObject());
        #}
        #
        #
      ENDSOURCE
      SOURCE #main_DEL
        #client static void main_DEL(Args args)
        #{
        #    SysContextMenu          sysContextMenu;
        #    TreeNode                treeNode;
        #    MF_QueryBrowser        queryBrowser;
        #    Query                   query;
        #    ;
        #
        #    if (SysContextMenu::startedFrom(args))
        #    {
        #        sysContextMenu  = args.parmObject();
        #        treeNode        = sysContextMenu.first();
        #        query           = MF_QueryBrowser::treeNode2Query(treeNode);
        #
        #        if(Query != null)
        #            new MF_QueryBrowser().run( query );
        #    }
        #}
      ENDSOURCE
      SOURCE #treeNode2Query
        #static Query treeNode2Query(TreeNode treeNode)
        #{
        #    #TreeNodeSysNodeType
        #    Query       query;
        #    str         nodeName;
        #    ;
        #
        #    if (treeNode.sysNodeType() == #NT_QE)                 //Query node
        #    {
        #        query = new Query(treeNode.treeNodeName());
        #    }
        #    else
        #    {
        #        query = null;
        #    }
        #
        #    return query;
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_CopyFieldsToClipboard 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_CopyFieldsToClipboard
    Id 50009
    PROPERTIES
      Name                #MF_CopyFieldsToClipboard
      Extends             #RunBase
      RunOn               #Client
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        ##TreeNodeSysNodeType
        ##AOT
        #class MF_CopyFieldsToClipboard extends RunBase
        #{
        #    TextBuffer          textBuffer;
        #    Map                 fieldNamesMap;
        #    TreeNode            selectedTableNode;
        #
        #    SourceLine          tableVariableName;
        #    TableName           tableName;
        #    NoYes               insertDeclaration;
        #    NoYes               insertClearMethod;
        #    Integer             NoneInsertUpdateMethod;
        #    Set                 fieldListSet;
        #
        #
        #    Common              RecordBuffer;
        #    boolean             useRecordBuffer;
        #
        #
        #    #define.CurrentVersion(5)
        #
        #    #localMacro.FormControlList
        #        tableVariableName,
        #        tableName,
        #        insertDeclaration,
        #        insertClearMethod,
        #        NoneInsertUpdateMethod
        #    #endMacro
        #}
      ENDSOURCE
      SOURCE #dialog
        #protected Object dialog(DialogRunbase dialog, boolean forceOnClient)
        #{
        #    DialogRunbase dlg = Dialog::newFormNameRunbase(formstr(MF_CopyFieldsToClipboard), this);
        #    ;
        #
        #    this.processTable(selectedTableNode);
        #    dlg = super(dlg, forceOnClient);
        #
        #    return dlg;
        #}
      ENDSOURCE
      SOURCE #dialogReInit
        #protected void dialogReInit()
        #{
        #    DialogRunbase   dlg;
        #    Object          formRun;
        #    ;
        #    super();
        #
        #    if (dialogModify)
        #    {
        #        dlg = dialogModify.parmDialog();
        #        if (dlg && dlg.formRun())
        #        {
        #            formRun = dlg.formRun();
        #
        #            formRun.initDataFromClass();
        #            formRun.validateVarName();
        #            formRun.resetFieldsListViewChecked();
        #            formRun.reBuildSourcePreview();
        #        }
        #    }
        #}
      ENDSOURCE
      SOURCE #initFromArgs
        #boolean initFromArgs(Args _args)
        #{
        #    SysContextMenu      sysContextMenu;
        #    TreeNode            tableNode;
        #    TableId             tableId;
        #    Object              editor;
        #
        #    LastAOTSelection    lastAOTSelection;
        #    ;
        #    if (_args)
        #    {
        #// > georg, 11.03.2008, Get the table from parameters,  -->
        #        if(_args.record()){
        #            tableId = _args.record().TableId;
        #            if (tableId)
        #            {
        #                selectedTableNode = SysDictTable::newTableId(tableId).treeNode();
        #                RecordBuffer=_args.record();
        #                return true;
        #            }
        #
        #            return false;
        #        }
        #// < georg, 11.03.2008, Get the table from parameters,  <--
        #
        #        if (SysContextMenu::startedFrom(_args))
        #        {
        #            //Called from SysContextMenu
        #            sysContextMenu = _args.parmObject();
        #            tableNode = sysContextMenu.first();
        #            if (tableNode.sysNodeType() == #NT_DBTABLE)
        #            {
        #                selectedTableNode = tableNode;
        #                return true;
        #            }
        #        }
        #        else
        #        {
        #            //called from the Editor
        #            editor = _args.parmObject();
        #            if (editor && editor.handle() == classNum(Editor))
        #            {
        #                tableNode = this.initFromEditor(editor);
        #                if (tableNode && tableNode.sysNodeType() == #NT_DBTABLE)
        #                {
        #                    selectedTableNode = tableNode;
        #                    return true;
        #                }
        #            }
        #            else
        #            {
        #                //Called from ToolBar (Tabax) or SystemMenu (LastAOTSelection)
        #                lastAOTSelection = new LastAOTSelection();
        #                tableNode = lastAOTSelection.first();
        #                if (tableNode && tableNode.sysNodeType() == #NT_DBTABLE)
        #                {
        #                    selectedTableNode = tableNode;
        #                    return true;
        #                }
        #            }
        #        }
        #    }
        #
        #    //No table selected --> Pick a table
        #    tableId = pickTable();
        #    if (tableId)
        #    {
        #        selectedTableNode = SysDictTable::newTableId(tableId).treeNode();
        #        return true;
        #    }
        #
        #    return false;
        #}
      ENDSOURCE
      SOURCE #initFromEditor
        #TreeNode initFromEditor(Editor e)
        #{
        #    str selectedLine;
        #
        #    str getSelectedLine()
        #    {
        #        Char        curSymbol;
        #        Column      iCopyFrom;
        #        Column      iCopyTo;
        #        ;
        #        if (selectedLine)
        #            return selectedLine;
        #
        #        if (e.markMode() != MarkMode::NoMark && e.selectionStartCol() != e.selectionEndCol())
        #        {
        #            selectedLine = strLRTrim(subStr(e.currentLine(), e.selectionStartCol(), e.selectionEndCol() - e.selectionStartCol()));
        #        }
        #        else
        #        {
        #            selectedLine = e.currentLine();
        #            for (iCopyFrom = e.columnNo()+1; iCopyFrom >= 0; iCopyFrom--)
        #            {
        #                curSymbol = subStr(selectedLine, iCopyFrom, 1);
        #                if (!strAlpha(curSymbol))
        #                    break;
        #            }
        #            for (iCopyTo = e.columnNo()+1; iCopyTo <= strLen(selectedLine); iCopyTo++)
        #            {
        #                curSymbol = subStr(selectedLine, iCopyTo, 1);
        #                if (!strAlpha(curSymbol))
        #                    break;
        #            }
        #            selectedLine = (iCopyFrom < iCopyTo) ? subStr(selectedLine, iCopyFrom + 1, iCopyTo - iCopyFrom - 1) : '';
        #        }
        #        return selectedLine;
        #    }
        #
        #    selectedLine = getSelectedLine();
        #    if (selectedLine && tableName2Id(selectedLine))
        #        return TreeNode::findNode(#TablesPath + #AOTRootPath + selectedLine);
        #
        #    return null;
        #}
      ENDSOURCE
      SOURCE #initParmDefault
        #public void initParmDefault()
        #{
        #    super();
        #
        #    if (selectedTableNode)
        #    {
        #        tableVariableName       = selectedTableNode.treeNodeName();
        #        tableName               = selectedTableNode.treeNodeName();
        #
        #        insertDeclaration       = NoYes::No;
        #        insertClearMethod       = NoYes::Yes;
        #        NoneInsertUpdateMethod  = 1;
        #        fieldListSet            = new Set(Types::Integer);
        #    }
        #}
      ENDSOURCE
      SOURCE #pack
        #public container pack()
        #{
        #    return [#CurrentVersion, #FormControlList] + [fieldListSet.pack()];
        #}
      ENDSOURCE
      SOURCE #parmFieldListSet
        #container parmFieldListSet(container _fieldListSetPacked = fieldListSet.pack())
        #{
        #    ;
        #    fieldListSet = Set::create(_fieldListSetPacked);
        #
        #    return fieldListSet.pack();
        #}
      ENDSOURCE
      SOURCE #parmFormControlValues
        #container parmFormControlValues(container _values  = [#FormControlList])
        #{
        #    ;
        #    [#FormControlList] = _values;
        #
        #    return [#FormControlList];
        #}
      ENDSOURCE
      SOURCE #parmUseRecordBuffer
        #boolean parmUseRecordBuffer(boolean _useRecordBuffer  = useRecordBuffer)
        #{
        #    ;
        #    useRecordBuffer = _useRecordBuffer;
        #
        #    return useRecordBuffer;
        #}
      ENDSOURCE
      SOURCE #processTable
        #boolean processTable(TreeNode  _tableNode)
        #{
        #    ;
        #    if (_tableNode)
        #    {
        #        selectedTableNode       = _tableNode;
        #
        #        if (tableName != _tableNode.treeNodeName())
        #        {
        #            tableVariableName   = _tableNode.treeNodeName();
        #            fieldListSet        = new Set(Types::Integer);
        #        }
        #        if (!fieldListSet)
        #            fieldListSet        = new Set(Types::Integer);
        #
        #        tableName               = _tableNode.treeNodeName();
        #        return true;
        #    }
        #    return false;
        #}
      ENDSOURCE
      SOURCE #RecordBuffer
        #common RecordBuffer(){
        # return RecordBuffer;
        # }
      ENDSOURCE
      SOURCE #run
        ##define.defaultIndentLevel(4)
        #void run()
        #{
        #    SysDictTable    dictTable;
        #    Counter         fieldIdCounter;
        #    SysDictField    dictField;
        #    SetIterator     setIterator = new SetIterator(fieldListSet);
        #
        #    SourceLine      varName = tableVariableName ? tableVariableName : dictTable.name();
        #    SourceLine      sourceLine;
        #    Integer         maxFieldNameLength;
        #    int             i;
        #    str             vP;
        #
        #    SourceLine      indent() { return strRep(" ", #defaultIndentLevel); }
        #    Integer         maxFieldNameIndent() { return (maxFieldNameLength div #defaultIndentLevel + 1) * #defaultIndentLevel; }
        #    SourceLine      neededIndentLevel(FieldName _fieldName) { return strRep(" ", maxFieldNameIndent() - strLen(_fieldName)); }
        #    ;
        #    if (!selectedTableNode)
        #        throw error("An unexpected error occured. A table treenode was not selected");
        #
        #    dictTable = SysDictTable::newTreeNode(selectedTableNode);
        #    if (!dictTable)
        #        throw error(strFmt("An unexpected error occured. Table '%1' not recognized", selectedTableNode.treeNodeName()));
        #
        #    setIterator.begin();
        #    while (setIterator.more())
        #    {
        #        dictField = dictTable.fieldObject(setIterator.value());
        #        if (maxFieldNameLength < strLen(dictField.name()))
        #            maxFieldNameLength = strLen(dictField.name());
        #
        #        setIterator.next();
        #    }
        #
        #    textBuffer = new TextBuffer(); //toClipboard works only on client side
        #
        #    if (insertDeclaration)
        #    {
        #        sourceLine = strFmt("%2%1%2%3;\r\n%2;\r\n", dictTable.name(), indent(), varName);
        #        textBuffer.appendText(sourceLine);
        #    }
        #
        #    if (insertClearMethod)
        #    {
        #        sourceLine = strFmt("%1%2.clear();\r\n", indent(), varName);
        #        textBuffer.appendText(sourceLine);
        #    }
        #
        #    //Copying fields
        #    setIterator.begin();
        #    while (setIterator.more())
        #    {
        #        dictField = dictTable.fieldObject(setIterator.value());
        #
        #// > georg, 11.03.2008, Get the table from parameters,  -->
        #        if(RecordBuffer&&useRecordBuffer){
        #            if(dictField.arraySize()>1){
        #            VP='';
        #            for(i=1;i<=dictField.arraySize();i++)
        #             VP+=strfmt('%1%2',RecordBuffer.(fieldId2Ext(dictField.id(), i)),i<dictField.arraySize()?',':'');
        #            VP='{'+VP+'}';
        #            } else
        #            VP=RecordBuffer.(dictField.id());
        #            sourceLine = strFmt("%1%2.%3%4=%4%6%5%6 // %7\r\n", indent(), varName, dictField.name(), neededIndentLevel(dictField.name()),
        #                                   VP,
        #                                   ((dictField.baseType()==Types::String) ||
        #                                    (dictField.baseType()==Types::RString) ||
        #                                    (dictField.baseType()==Types::VarString))?'"':'',dictField.label());
        #                                    }
        #        else
        #// < georg, 11.03.2008, Get the table from parameters,  <--
        #            sourceLine = strFmt("%1%2.%3%4= //%5 \r\n", indent(), varName, dictField.name(), neededIndentLevel(dictField.name()),dictField.label());
        #
        #        textBuffer.appendText(sourceLine);
        #        setIterator.next();
        #    }
        #
        #    switch (NoneInsertUpdateMethod)
        #    {
        #        case 1:
        #            sourceLine = strFmt("%1%2.insert();\r\n", indent(), varName);
        #            textBuffer.appendText(sourceLine);
        #            break;
        #        case 2:
        #            sourceLine = strFmt("%1%2.update();\r\n", indent(), varName);
        #            textBuffer.appendText(sourceLine);
        #            break;
        #    }
        #
        #    textBuffer.toClipboard();
        #}
      ENDSOURCE
      SOURCE #showDefaultButton
        #public boolean showDefaultButton()
        #{
        #    return true;
        #}
      ENDSOURCE
      SOURCE #unpack
        #public boolean unpack(container packedClass)
        #{
        #    version     version = runbase::getVersion(packedClass);
        #    container   fieldListSetPacked;
        #
        #    switch (version)
        #    {
        #        case #CurrentVersion:
        #            [version, #FormControlList, fieldListSetPacked] = packedClass;
        #            fieldListSet = Set::create(fieldListSetPacked);
        #            break;
        #        default:
        #            return false;
        #    }
        #
        #    return true;
        #}
      ENDSOURCE
      SOURCE #main
        #static void main(Args _args)
        #{
        #    MF_CopyFieldsToClipboard engine;
        #    ;
        #    engine = new MF_CopyFieldsToClipboard();
        #
        #    startLengthyOperation();
        #    if (engine.initFromArgs(_args) && engine.prompt())
        #        engine.run();
        #
        #    endLengthyOperation();
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_EditorFormat 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_EditorFormat
    Id 50011
    PROPERTIES
      Name                #MF_EditorFormat
      Extends             #
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #class MF_EditorFormat
        #{
        #}
      ENDSOURCE
      SOURCE #InstallGuide
        #void InstallGuide()
        #{
        #/*  //Add Follow Method to EditScript Class
        #    void FormatToColumnLayout(Editor e)
        #    {
        #        ;
        #        MF_EditorFormat::FormatToColumnLayout(e);
        #    }
        #
        #*/
        #}
      ENDSOURCE
      SOURCE #ensureSingleSpaces
        #private static void EnsureSingleSpaces(Editor e, int startLine = e.selectionStartLine(), int endLine = e.selectionEndLine())
        #{
        #    #xppTexts
        #    int i, col;
        #    int delChars = 0;
        #    str line;
        #    str tmp;
        #    int leadingCharIdx = -1;
        #    ;
        #
        #    // ensure only single character spacing
        #    for (i = startLine; i <= endLine; i++)
        #    {
        #        e.gotoLine(i);
        #        e.gotoCol(1);
        #        line = e.currentLine();
        #        leadingCharIdx = -1;
        #        delChars = 0;
        #
        #        // Skip leading white space
        #        for (col = 0; col <= strlen(line); col++)
        #        {
        #            if (leadingCharIdx == -1 && substr(line, col, 1) != ' ')
        #            {
        #                leadingCharIdx = col;
        #                continue;
        #            }
        #
        #            // not found first word yet
        #            if (leadingCharIdx == -1) continue;
        #
        #            // end of line, so finish
        #            if (substr(line, col, 1) == #semicolon) break;
        #
        #            // if we have found a double space
        #            tmp = substr(line, col, 2);
        #            if (tmp == '  ')
        #            {
        #                e.gotoCol(col-delChars);
        #                e.deleteChars(1);
        #                delChars++;
        #                //col--;
        #            }
        #        }
        #    }
        #}
        #
      ENDSOURCE
      SOURCE #FormatToColumnLayout
        #static void FormatToColumnLayout(Editor e)
        #{
        #    List           lineInfoList;
        #    ListIterator   iterator;
        #    MF_EditorLineInfo currLineInfo;
        #    int            startLine = e.selectionStartLine();
        #    int            endLine = e.selectionEndLine();
        #    int            i;
        #    int            lineNumber = startLine;
        #    int            maxVarDeclFirstCharIdx;
        #    str            blankstr;
        #    ;
        #
        #    MF_EditorFormat::EnsureSingleSpaces(e, startLine, endLine);
        #    lineInfoList = MF_EditorFormat::RecordLineInfo(e, startLine, endLine);
        #    iterator = new ListIterator(lineInfoList);
        #    maxVarDeclFirstCharIdx = MF_EditorLineInfo::MaxVarDeclFirstCharIdx(lineInfoList);
        #
        #    e.unmark();
        #
        #    while (iterator.more())
        #    {
        #        blankstr = '';
        #        currLineInfo = iterator.value();
        #        if (currLineInfo != null)
        #        {
        #            e.gotoLine(lineNumber);
        #            if (currLineInfo.parmVarDeclFirstCharIdx() < maxVarDeclFirstCharIdx)
        #            {
        #                e.gotoCol(currLineInfo.parmVarDeclFirstCharIdx());
        #                for(i=0; i < maxVarDeclFirstCharIdx - currLineInfo.parmVarDeclFirstCharIdx(); i++ )
        #                {
        #                    blankstr += ' ';
        #                }
        #                e.insertString(blankstr);
        #            }
        #        }
        #        iterator.next();
        #        lineNumber++;
        #    }
        #}
      ENDSOURCE
      SOURCE #recordLineInfo
        #private static List RecordLineInfo(Editor e, int startLine = e.selectionStartLine(), int endLine = e.selectionEndLine())
        #{
        #    #xppTexts
        #    List lineInfoList = new List(Types::Class);
        #    MF_EditorLineInfo currLineInfo;
        #    int i, col;
        #    str line;
        #    int numWords = 0;
        #    str prevChar = ' ';
        #    str currChar;
        #    ;
        #
        #    for (i = startLine; i <= endLine; i++)
        #    {
        #        currLineInfo = null;
        #        e.gotoLine(i);
        #        e.gotoCol(1);
        #        line = e.currentLine();
        #        numWords = 0;
        #        prevChar = ' ';
        #
        #        // Skip leading white space
        #        for (col = 0; col <= strlen(line); col++)
        #        {
        #            if (col > 1)
        #            {
        #                prevChar = substr(line, col-1, 1);
        #            }
        #            currChar = substr(line, col, 1);
        #            // previous char was blank and this char is non-blank:
        #            if (prevChar == ' ' && currChar != ' ')
        #            {
        #                numWords++;
        #                if (numWords == 2)
        #                {
        #                    currLineInfo = MF_EditorLineInfo::construct(col);
        #                }
        #            }
        #
        #            // end of line, so finish
        #            if (substr(line, col, 1) == #semicolon)
        #            {
        #                break;
        #            }
        #        }
        #
        #        lineInfoList.addEnd(currLineInfo);
        #    }
        #    return lineInfoList;
        #}
        #
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_EditorLineInfo 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_EditorLineInfo
    Id 50012
    PROPERTIES
      Name                #MF_EditorLineInfo
      Extends             #
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #class MF_EditorLineInfo
        #{
        #    int varDeclFirstCharIdx;
        #}
      ENDSOURCE
      SOURCE #new
        #void new()
        #{
        #    varDeclFirstCharIdx = -1;
        #}
      ENDSOURCE
      SOURCE #parmVarDeclFirstCharIdx
        #int parmVarDeclFirstCharIdx(int _varDeclFirstCharIdx = varDeclFirstCharIdx)
        #{
        #    ;
        #    varDeclFirstCharIdx = _varDeclFirstCharIdx;
        #    return varDeclFirstCharIdx;
        #}
      ENDSOURCE
      SOURCE #construct
        #public static MF_EditorLineInfo construct(int _varDeclFirstCharIdx)
        #{
        #    MF_EditorLineInfo editorLineInfo = new MF_EditorLineInfo();
        #    ;
        #    editorLineInfo.parmVarDeclFirstCharIdx(_varDeclFirstCharIdx);
        #    return editorLineInfo;
        #}
      ENDSOURCE
      SOURCE #MaxVarDeclFirstCharIdx
        #static int MaxVarDeclFirstCharIdx(List lineInfoList)
        #{
        #    ListIterator iter = new ListIterator(lineInfoList);
        #    MF_EditorLineInfo currLineInfo;
        #    int maxIdx = 0;
        #    ;
        #
        #    while (iter.more())
        #    {
        #        currLineInfo = iter.value();
        #        if (currLineInfo != null && currLineInfo.parmVarDeclFirstCharIdx() > maxIdx)
        #        {
        #            maxIdx = currLineInfo.parmVarDeclFirstCharIdx();
        #        }
        #        iter.next();
        #    }
        #
        #    return maxIdx;
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_FieldInfo 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_FieldInfo
    Id 50013
    PROPERTIES
      Name                #MF_FieldInfo
      Extends             #
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #class MF_FieldInfo
        #{
        #    str fieldName;
        #    str formFieldName;
        #    str formDataSourceName;
        #    str tableName;
        #    str formName;
        #    str methodName;
        #}
      ENDSOURCE
      SOURCE #getFieldName
        #str getFieldName()
        #{
        #    return fieldName;
        #}
      ENDSOURCE
      SOURCE #getFormDataSourceName
        #str getFormDataSourceName()
        #{
        #    return formDataSourceName;
        #}
      ENDSOURCE
      SOURCE #getFormFieldName
        #str getFormFieldName()
        #{
        #    return formFieldName;
        #}
      ENDSOURCE
      SOURCE #getFormName
        #str getFormName()
        #{
        #    return formName;
        #}
      ENDSOURCE
      SOURCE #getMethodName
        #str getMethodName()
        #{
        #    return methodName;
        #}
      ENDSOURCE
      SOURCE #getTableName
        #str getTableName()
        #{
        #    return tableName;
        #}
      ENDSOURCE
      SOURCE #new
        #void new(str _formName, str _formFieldName, str _formDataSourceName, str _tableName, str _fieldName, str _methodName)
        #{
        #    ;
        #    formName            = _formName;
        #    formFieldName       = _formFieldName;
        #    formDataSourceName  = _formDataSourceName;
        #    tableName           = _tableName;
        #    fieldName           = _fieldName;
        #    methodName          = _methodName;
        #}
      ENDSOURCE
      SOURCE #run
        #void run()
        #{
        #    MenuFunction            form;
        #    args                    args = new args();
        #    ;
        #
        #    args.caller(this);
        #    form = new MenuFunction(menuItemDisplayStr(MF_showField),MenuItemType::Display);
        #    form.run(args);
        #
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_CreateNewProject 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_CreateNewProject
    Id 50010
    PROPERTIES
      Name                #MF_CreateNewProject
      Extends             #RunBase
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #/*
        #    <DEV_CreateNewProject_IKash date=2010-05-04 txt='Create a new Project or Update an existing one'>
        #    <Version>2.0.1</Version>
        #    Please feel free to contact me regarding the use of this project or to report a bug
        #    <Contacts>Name='Ivan Kashperuk' Email='ivan.kashperuk@gmail.com'</Contacts>
        #*/
        ##AOT
        #class MF_CreateNewProject extends RunBase
        #{
        #    ProjectSharedPrivate    projectType;
        #    TreeNodeName            projectPrefix;
        #    TreeNodeName            projectName;
        #    container               selectedProjectNodes;
        #    NoYes                   usePrefix;
        #    TreeNodeName            projectPrefixValue;
        #    NoYes                   warnAboutNameDuplicates;
        #    NoYes                   updateExistingProject;
        #    Map                     objectTypeName;
        #    container               currentListOld;
        #
        #    #define.ParamsCount(23)     // The number of project nodes
        #    #define.CurrentVersion(21)
        #
        #    #localmacro.CurrentList
        #        projectType,
        #        projectPrefix,
        #        projectName,
        #        selectedProjectNodes,
        #        usePrefix,
        #        warnAboutNameDuplicates,
        #        updateExistingProject
        #    #endmacro
        #}
      ENDSOURCE
      SOURCE #convertProjectPrefix
        ##define.datePrefix("%d")
        ##define.userPrefix("%u")
        #public TreeNodeName convertProjectPrefix(TreeNodeName _projectPrefix)
        #{
        #    TreeNodeName    projectPrefixNew;
        #    ;
        #    projectPrefixNew = strReplace(_projectPrefix, #datePrefix, date2str(SystemDateGet(), 123, 2, 0, 2, 0, 4));
        #    projectPrefixNew = strReplace(projectPrefixNew, #userPrefix, curUserId());
        #
        #    return projectPrefixNew;
        #}
      ENDSOURCE
      SOURCE #dialog
        #public Object dialog()
        #{
        #    DialogRunbase       dialog = Dialog::newFormNameRunbase(formstr(MF_CreateNewProjectDlg), this);
        #    TreeNode            treeNode;
        #    LastAOTSelection    lastAOTSelection;
        #    ;
        #    dialog = super(dialog);
        #
        #    warnAboutNameDuplicates = NoYes::Yes;
        #    updateExistingProject = NoYes::No;
        #    if (winAPI::isControlButtonDown())
        #    {
        #        lastAOTSelection = new LastAOTSelection();
        #        treeNode = lastAOTSelection.first();
        #        if (treeNode && SysTreeNode::isProject(treeNode))
        #        {
        #            if (this.initFromAOTProject(treeNode))
        #            {
        #                warnAboutNameDuplicates = NoYes::No;
        #                updateExistingProject = NoYes::Yes;
        #            }
        #            else
        #                selectedProjectNodes = conNull();
        #        }
        #    }
        #
        #    if (!selectedProjectNodes || conLen(selectedProjectNodes) != #ParamsCount)
        #        this.initParmDefault();
        #
        #    return dialog;
        #}
      ENDSOURCE
      SOURCE #initFromAOTProject
        #NoYes initFromAOTProject(TreeNode _project)
        #{
        #    ProjectNode     project = _project;
        #    TreeNodeName    projectPrefixNew;
        #    ProjectNode     dataDictNode;
        #    ProjectNode     menuItemNode;
        #    int             totalMenuItems;
        #    int             totalMore;
        #    ;
        #    if (!project)
        #        return checkFailed(@"The selected project could not be initialized. Default settings used");
        #
        #    projectType = project.applObjectType() == UtilElementType::SharedProject ? ProjectSharedPrivate::ProjShared : ProjectSharedPrivate::ProjPrivate;
        #    projectPrefixNew = this.convertProjectPrefix(projectPrefix);
        #    if (projectPrefixNew && subStr(project.treeNodeName(), 1, strLen(projectPrefixNew)) == projectPrefixNew)
        #    {
        #        usePrefix = NoYes::Yes;
        #        projectName = strDel(project.treeNodeName(), 1, strLen(projectPrefixNew));
        #    }
        #    else
        #    {
        #        usePrefix = NoYes::No;
        #        projectName = project.treeNodeName();
        #    }
        #
        #    selectedProjectNodes = conNull();
        #    project = project.loadForInspection();
        #    dataDictNode = project.AOTfindChild(TreeNode::findNode(#DataDictionaryPath).treeNodeName());
        #    if (dataDictNode)
        #    {
        #        selectedProjectNodes += UnknownNoYes::Unknown; //Data Dictionary
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#TablesPath).treeNodeName())               ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#TableMapsPath).treeNodeName())            ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#ViewsPath).treeNodeName())                ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#ExtendedDataTypesPath).treeNodeName())    ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#BaseEnumsPath).treeNodeName())            ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #
        #        selectedProjectNodes += UnknownNoYes::Unknown; //More...
        #        #ifnot.ReferencesPath //AX3
        #            selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#FeatureKeysPath).treeNodeName())      ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #            totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        #endif
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#LicenseCodesPath).treeNodeName())         ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#ConfigurationKeysPath).treeNodeName())    ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#SecurityKeysPath).treeNodeName())         ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#TableCollectionsPath).treeNodeName())     ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        #if.ReferencesPath //AX4
        #            selectedProjectNodes += dataDictNode.AOTfindChild(TreeNode::findNode(#PerspectivesPath).treeNodeName())     ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #            totalMore += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        #endif
        #
        #        if (totalMore == 5) //All five were NoYes::No (value = 1)
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 7, UnknownNoYes::No);
        #        if (totalMore == 10) //All five were NoYes::Yes (value = 2)
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 7, UnknownNoYes::Yes);
        #
        #        if (!conFind(selectedProjectNodes, UnknownNoYes::No))
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 1, UnknownNoYes::Yes);
        #        if (!conFind(selectedProjectNodes, UnknownNoYes::Yes))
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 1, UnknownNoYes::No);
        #    }
        #    else
        #    {
        #        selectedProjectNodes = [UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No,
        #                                UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No];
        #    }
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#MacrosPath).treeNodeName())                        ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#ClassesPath).treeNodeName())                       ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#FormsPath).treeNodeName())                         ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#ReportsPath).treeNodeName())                       ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#QueriesPath).treeNodeName())                       ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#JobsPath).treeNodeName())                          ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    selectedProjectNodes += project.AOTfindChild(TreeNode::findNode(#MenusPath).treeNodeName())                         ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #    menuItemNode = project.AOTfindChild(TreeNode::findNode(#MenuItemsPath).treeNodeName());
        #    if (menuItemNode)
        #    {
        #        selectedProjectNodes += UnknownNoYes::Unknown;
        #        selectedProjectNodes += menuItemNode.AOTfindChild(TreeNode::findNode(#MenuItemsDisplayPath).treeNodeName())     ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMenuItems += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        selectedProjectNodes += menuItemNode.AOTfindChild(TreeNode::findNode(#MenuItemsOutputPath).treeNodeName())      ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMenuItems += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        selectedProjectNodes += menuItemNode.AOTfindChild(TreeNode::findNode(#MenuItemsActionPath).treeNodeName())      ? UnknownNoYes::Yes :  UnknownNoYes::No;
        #        totalMenuItems += conPeek(selectedProjectNodes, conLen(selectedProjectNodes));
        #        if (totalMenuItems == 3)
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 20, UnknownNoYes::No);
        #        if (totalMenuItems == 6)
        #            selectedProjectNodes = conPoke(selectedProjectNodes, 20, UnknownNoYes::Yes);
        #    }
        #    else
        #    {
        #        selectedProjectNodes = conIns(selectedProjectNodes, 20, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No, UnknownNoYes::No);
        #    }
        #
        #    return NoYes::Yes;
        #}
      ENDSOURCE
      SOURCE #initParmDefault
        #public void initParmDefault()
        #{
        #    ;
        #    super();
        #
        #    projectType             = ProjectSharedPrivate::ProjShared;
        #    projectPrefix           = '';
        #    projectName             = SysTreeNode::getSharedProject().newObjectName();
        #    selectedProjectNodes    = [
        #                                UnknownNoYes::Unknown,  //01 - Data Dictionary
        #                                UnknownNoYes::Yes,      //02 - Tables
        #                                UnknownNoYes::No,       //03 - Table Maps
        #                                UnknownNoYes::No,       //04 - Views
        #                                UnknownNoYes::Yes,      //05 - Extended Data Types
        #                                UnknownNoYes::Yes,      //06 - Base Enums
        #                                UnknownNoYes::No,       //07 - More...
        #                                #ifnot.ReferencesPath   //AX3
        #                                UnknownNoYes::No,       //08 - Feature Keys
        #                                #endIf
        #                                UnknownNoYes::No,       //09/08 - License Codes
        #                                UnknownNoYes::No,       //10/09 - Configuration Keys
        #                                UnknownNoYes::No,       //11/10 - Security Keys
        #                                UnknownNoYes::No,       //12/11 - Table Collections
        #                                #if.ReferencesPath
        #                                UnknownNoYes::No,       //12 - Perspectives
        #                                #endIf
        #                                UnknownNoYes::No,       //13 - Macros
        #                                UnknownNoYes::Yes,      //14 - Classes
        #                                UnknownNoYes::Yes,      //15 - Forms
        #                                UnknownNoYes::No,       //16 - Reports
        #                                UnknownNoYes::No,       //17 - Queries
        #                                UnknownNoYes::No,       //18 - Jobs
        #                                UnknownNoYes::Yes,      //19 - Menus
        #                                UnknownNoYes::Yes,      //20 - Menu Items
        #                                UnknownNoYes::Yes,      //21 - Display
        #                                UnknownNoYes::Yes,      //22 - Output
        #                                UnknownNoYes::Yes       //23 - Action,
        #                              ];
        #
        #    usePrefix                 = NoYes::No;
        #    warnAboutNameDuplicates   = NoYes::Yes;
        #    updateExistingProject     = NoYes::No;
        #}
      ENDSOURCE
      SOURCE #pack
        #public container pack()
        #{
        #    if (updateExistingProject)
        #        return currentListOld;
        #    return [#CurrentVersion, #CurrentList];
        #}
      ENDSOURCE
      SOURCE #parmFormControlValues
        #container parmFormControlValues(container _values  = [#CurrentList])
        #{
        #    ;
        #    [#CurrentList] = _values;
        #
        #    projectPrefixValue = this.convertProjectPrefix(projectPrefix);
        #
        #    return [#CurrentList];
        #}
      ENDSOURCE
      SOURCE #run
        #public void run()
        #{
        #    ProjectNode         projNode;
        #    TreeNode            projNodeRoot;
        #    ProjectGroupNode    dataDictNode;
        #    ProjectGroupNode    MenuItemsNode;
        #    container           conObjects;
        #    int                 nIndex;
        #
        #    //Method creates a new Shared/Private project
        #    TreeNode createNewSharedPrivateProject()
        #    {
        #        ProjectNode      upgradeNode;
        #        TreeNode         treeNodeProject;
        #        str              projName;
        #        ;
        #
        #        if (projectType == ProjectSharedPrivate::ProjPrivate)
        #            treeNodeProject = SysTreeNode::getPrivateProject();
        #        else
        #            treeNodeProject = SysTreeNode::getSharedProject();
        #
        #        if (projectName)
        #            projName  = usePrefix ? projectPrefixValue + projectName : projectName;
        #        else
        #        {
        #            projName = treeNodeProject.newObjectName();
        #            warning(strFmt(@"The project was created with a default name: %1", projName));
        #        }
        #
        #        if (!treeNodeProject.AOTfindChild(projName))
        #            treeNodeProject.AOTadd(projName);
        #
        #        upgradeNode = treeNodeProject.AOTfindChild(projName);
        #
        #        return upgradeNode.getRunNode();
        #    }
        #    //Methods creates sub groups in the Project Node
        #    ProjectGroupNode createGroup(int _nIndex, str _nodeName, ProjectGroupNode parent)
        #    {
        #        TreeNodeName     projNodeName = SysTreeNode::pathName(_nodeName);
        #        ProjectGroupNode child;
        #        GroupNodeType    groupNodeType;
        #        boolean          isGroupNode = false;
        #        ;
        #        #if.ReportLibrariesPath
        #        projNodeName = strRem(projNodeName, ' ');
        #        #endif
        #        if (parent)
        #            child = parent.aotFindChild(projNodeName);
        #        if (parent && !child)
        #        {
        #            //Create only selected project nodes
        #            if (conPeek(selectedProjectNodes, _nIndex) == UnknownNoYes::No)
        #                return child;
        #
        #            if (classIdGet(parent) != classNum(ProjectNode))
        #            {
        #                groupNodeType = parent.projectGroupType();
        #                parent.projectGroupType(GroupNodeType::All);
        #                isGroupNode = true;
        #            }
        #
        #            parent.aotAdd(projNodeName);
        #            child = parent.aotFindChild(projNodeName);
        #
        #            if (isGroupNode)
        #                parent.projectGroupType(groupNodeType);
        #        }
        #        if (child)
        #        {
        #            child.projectGroupType(SysTreeNode::path2ProjectGroupNodeType(_nodeName));
        #
        #            if (objectTypeName && objectTypeName.exists(_nIndex))
        #            {
        #                conObjects = objectTypeName.lookup(_nIndex);
        #                for (nIndex = 1; nIndex <= conLen(conObjects); nIndex += 2)
        #                {
        #                    if (!child.findGroupMember(conPeek(conObjects, nIndex), conPeek(conObjects, nIndex + 1), NoYes::No))
        #                        child.addUtilNode(conPeek(conObjects, nIndex + 1), conPeek(conObjects, nIndex));
        #                }
        #            }
        #        }
        #        return child;
        #    }
        #    ;
        #
        #    projNode      = createNewSharedPrivateProject();
        #    projNode.lockUpdate();
        #    projNodeRoot = projNode;
        #
        #    menuItemsNode = createGroup(20, #MenuItemsPath,         projNodeRoot);
        #                    createGroup(23, #MenuItemsActionPath,   menuItemsNode);
        #                    createGroup(22, #MenuItemsOutputPath,   menuItemsNode);
        #                    createGroup(21, #MenuItemsDisplayPath,  menuItemsNode);
        #                    createGroup(19, #MenusPath,             projNodeRoot);
        #                    createGroup(18, #JobsPath,              projNodeRoot);
        #                    createGroup(17, #QueriesPath,           projNodeRoot);
        #                    createGroup(16, #ReportsPath,           projNodeRoot);
        #                    createGroup(15, #FormsPath,             projNodeRoot);
        #                    createGroup(14, #ClassesPath,           projNodeRoot);
        #                    createGroup(13, #MacrosPath,            projNodeRoot);
        #    dataDictNode  = createGroup(01, #DataDictionaryPath,    projNodeRoot);
        #
        #                    #if.ReferencesPath      //AX4
        #                    createGroup(12, #PerspectivesPath,      dataDictNode);
        #                    createGroup(11, #TableCollectionsPath,  dataDictNode);
        #                    createGroup(10, #SecurityKeysPath,      dataDictNode);
        #                    createGroup(09, #ConfigurationKeysPath, dataDictNode);
        #                    createGroup(08, #LicenseCodesPath,      dataDictNode);
        #                    #endIf
        #                    #ifnot.ReferencesPath   //AX3
        #                    createGroup(12, #TableCollectionsPath,  dataDictNode);
        #                    createGroup(11, #SecurityKeysPath,      dataDictNode);
        #                    createGroup(10, #ConfigurationKeysPath, dataDictNode);
        #                    createGroup(09, #LicenseCodesPath,      dataDictNode);
        #                    createGroup(08, #FeatureKeysPath,       dataDictNode);
        #                    #endIf
        #
        #                    createGroup(06, #BaseEnumsPath,         dataDictNode);
        #                    createGroup(05, #ExtendedDataTypesPath, dataDictNode);
        #                    createGroup(04, #ViewsPath,             dataDictNode);
        #                    createGroup(03, #TableMapsPath,         dataDictNode);
        #                    createGroup(02, #TablesPath,            dataDictNode);
        #
        #    projNode.AOTsave();
        #    projNode.unlockUpdate();
        #}
      ENDSOURCE
      SOURCE #setObjectTypeName
        #void setObjectTypeName(container _packedMap)
        #{
        #    ;
        #    objectTypeName = Map::create(_packedMap);
        #}
      ENDSOURCE
      SOURCE #unpack
        #public boolean unpack(container packedClass)
        #{
        #    Version version = runbase::getVersion(packedClass);
        #
        #    switch (version)
        #    {
        #        case #CurrentVersion:
        #            [version, #CurrentList] = packedClass;
        #            currentListOld = packedClass;
        #            break;
        #        default:
        #            return false;
        #    }
        #
        #    return true;
        #}
      ENDSOURCE
      SOURCE #validate
        #public boolean validate(Object calledFrom)
        #{
        #    boolean         ret;
        #    int             lenMax = new SysDictType(extendedTypeNum(TreeNodeName)).stringLen();
        #    TreeNodeName    projName;
        #    ;
        #
        #    ret = super(calledFrom);
        #
        #    if (ret && projectName)
        #    {
        #        projName = usePrefix ? projectPrefixValue + projectName : projectName;
        #
        #        if (strLen(projName) > lenMax)
        #            return checkFailed(strFmt(@"The name of the project is too long. Maximum length, including prefix is %1", lenMax));
        #
        #        if (!TreeNode::isValidObjectName(projName))
        #            return checkFailed(strFmt(@"The name of the project (%1) contains illegal characters", projName));
        #
        #        if (warnAboutNameDuplicates &&
        #            ((projectType == ProjectSharedPrivate::ProjShared && SysTreeNode::getSharedProject().AOTfindChild(projName)) ||
        #            (projectType == ProjectSharedPrivate::ProjPrivate && SysTreeNode::getPrivateProject().AOTfindChild(projName))))
        #        {
        #            if (box::yesNo(strFmt(@"The name of the project you entered (%1) already exists.%2Do you want to update the existing project?", projName, '\n'),
        #                    DialogButton::No, @"Verify the name of the project") == DialogButton::No)
        #            {
        #                return checkFailed(@"Operation cancelled by user");
        #            }
        #        }
        #    }
        #
        #    return ret;
        #}
      ENDSOURCE
      SOURCE #construct
        #public static MF_CreateNewProject construct()
        #{
        #    return new MF_CreateNewProject();
        #}
        #
      ENDSOURCE
      SOURCE #main
        #static void main(Args _args)
        #{
        #    MF_CreateNewProject   axCreateNewProject;
        #    ;
        #    axCreateNewProject = MF_CreateNewProject::construct();
        #
        #    if (axCreateNewProject.prompt())
        #        axCreateNewProject.run();
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_SysSetupFormRun 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_SysSetupFormRun
    Id 50016
    PROPERTIES
      Name                #MF_SysSetupFormRun
      Extends             #FormRun
      RunOn               #Client
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #public class MF_SysSetupFormRun extends FormRun
        #{
        ##if.never
        #    #define.CurrentVersion(1)
        #    #localmacro.CurrentList
        #    #endmacro
        ##endif
        #}
      ENDSOURCE
      SOURCE #task
        #public int task(int _p1)
        #{
        #    #task
        #    FormDataSource formDataSource;
        #    //zcb insert begin
        #    //Use origin class
        #    object         object;
        #    //zcb insert end
        #
        #    //AXAPTA-LINKS
        #    FormControl             formControl;
        #    FormBuildStringControl  fbsc;
        #    MF_FieldInfo            fieldInfo;
        #    str                     fieldName;
        #    //end AXAPTA-LINKS
        #
        #    int ret;
        #
        #    ;
        #
        #    if (_p1 == #taskFilter)
        #    {
        #        formDataSource = this.objectSet();
        #        if (formDataSource &&
        #            formDataSource.queryRun() &&
        #            formDataSource.queryRun().args() &&
        #            !formDataSource.queryRun().args().caller())
        #        {
        #            formDataSource.queryRun().args().caller(this);
        #        }
        #    }
        #
        #    //AXAPTA-LINKS
        #    if (_p1 == #taskShiftEnter) //F10 or ALT
        #    {
        #        formDataSource = this.objectSet();
        #        formControl = this.selectedControl();
        #        if (formDataSource)
        #        {
        #            fbsc = formDataSource.formRun().form().design().control(formControl.id());
        #            fieldName = fieldId2Name(formDataSource.table(), fieldExt2Id((fbsc.dataField())));
        #            fieldInfo = new MF_FieldInfo(formDataSource.formRun().name(), formControl.name(), formDataSource.name(), tableId2Name(formDataSource.table()), fieldName, fbsc.dataMethod());
        #            fieldInfo.run();
        #            return true;
        #        }
        #        else
        #            info("Form has no datasource");
        #    }
        #    //end AXAPTA-LINKS
        #
        #    ret = super(_p1);
        #
        #//Modified by zhangchaobin on 20080628 Begin
        #//Refresh data source after deletting one record or more
        #//You should add a method named 'excuteQuery' on the method node of running form
        #//The deletting taskId is 2832
        #    object = this;
        #    if(_p1 == 2832 && formHasMethod(this,"excuteQuery"))
        #    {
        #
        #       object.excuteQuery();
        #    }
        #
        #//Zhangchaobin modify End
        #
        #    return ret;
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: CLS

; Microsoft Dynamics AX Class: MF_Info 未加载
; --------------------------------------------------------------------------------
  CLSVERSION 1
  CLASS #MF_Info
    Id 50014
    PROPERTIES
      Name                #MF_Info
      Extends             #
      RunOn               #Called from
    ENDPROPERTIES
    METHODS
      Version: 3
      SOURCE #classDeclaration
        #final class MF_Info
        #{
        #}
      ENDSOURCE
      SOURCE #startupPost
        #/*
        #No SYS code must exist in this method
        #*/
        #void startupPost()
        #{
        #    FormRun         formRun;
        #    ;
        #    if(curuserid() == "Admin")
        #
        #    {
        #        if(!WinAPI::isControlButtonDown() &&
        #            DEV_AxAssistFunc::checkActiveXRegistered())
        #        {
        #            formRun = new MenuFunction(menuItemDisplayStr(DEV_AxAssistForm),MenuItemType::Display).create();
        #            if(formRun)
        #            {
        #                formRun.run();
        #                formRun.detach();
        #            }
        #        }
        #        if(!WinAPI::isShiftButtonDown())
        #        {
        #        // check for user ID
        #            //if(curUserId()=="MF") // <- change to your loginname
        #            {
        #                // actually run tabax
        #                TreeNode::findNode(@'\\Forms\\'+formStr(MF_TabBar)).AOTrun();
        #            }
        #        }
        #    }
        #
        #}
      ENDSOURCE
    ENDMETHODS
  ENDCLASS

***Element: JOB

; Microsoft Dynamics AX Job: MF_QueryBrowserJob 未加载
; --------------------------------------------------------------------------------
  JOBVERSION 1
  SOURCE #MF_QueryBrowserJob
    #static void MF_QueryBrowserJob(Args _args)
    #{
    #    ;
    #    new MF_QueryBrowser().run( new Query(queryStr(InventSum)) );
    #}
  ENDSOURCE

***Element: PRN

; Microsoft Dynamics AX Project : MF_ToolProject unloaded
; --------------------------------------------------------------------------------
  PROJECTVERSION 2
  PROJECT #MF_ToolProject
   PRIVATE
  PROPERTIES
    Name                #MF_ToolProject
  ENDPROPERTIES
    PROJECTCLASS ProjectNode
    GROUP #Menu Items
      PROPERTIES
        Name                #Menu Items
        ProjectGroupType    #MenuItems
        GroupMask           #
        PreventEditProperties #No
      ENDPROPERTIES
      GROUP #Display
        PROPERTIES
          Name                #Display
          ProjectGroupType    #Display
          GroupMask           #
          PreventEditProperties #No
        ENDPROPERTIES
        BEGINNODE
          FILETYPE 0
          UTILTYPE 1
          UTILOBJECTID 0
          NODETYPE 296
          NAME #MF_QueryBrowser
        ENDNODE
        BEGINNODE
          FILETYPE 0
          UTILTYPE 1
          UTILOBJECTID 0
          NODETYPE 296
          NAME #MF_showField
        ENDNODE
        ENDGROUP
      GROUP #Action
        PROPERTIES
          Name                #Action
          ProjectGroupType    #Action
          GroupMask           #
          PreventEditProperties #No
        ENDPROPERTIES
        BEGINNODE
          FILETYPE 0
          UTILTYPE 3
          UTILOBJECTID 0
          NODETYPE 296
          NAME #MF_CopyFieldsToClipboard
        ENDNODE
        BEGINNODE
          FILETYPE 0
          UTILTYPE 3
          UTILOBJECTID 0
          NODETYPE 296
          NAME #MF_CreateNewProject
        ENDNODE
        ENDGROUP
      ENDGROUP
    GROUP #Forms
      PROPERTIES
        Name                #Forms
        ProjectGroupType    #Forms
        GroupMask           #
        PreventEditProperties #No
      ENDPROPERTIES
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_TabBar2009
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_QueryBrowser
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_CopyFieldsToClipboard
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_TabBar
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_showField
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #MF_CreateNewProjectDlg
      ENDNODE
      ENDGROUP
    GROUP #Classes
      PROPERTIES
        Name                #Classes
        ProjectGroupType    #Classes
        GroupMask           #
        PreventEditProperties #No
      ENDPROPERTIES
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50017
        NODETYPE 329
        NAME #MF_EditorScripts_ForAxassist
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50015
        NODETYPE 329
        NAME #MF_QueryBrowser
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50009
        NODETYPE 329
        NAME #MF_CopyFieldsToClipboard
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50011
        NODETYPE 329
        NAME #MF_EditorFormat
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50012
        NODETYPE 329
        NAME #MF_EditorLineInfo
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50013
        NODETYPE 329
        NAME #MF_FieldInfo
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50010
        NODETYPE 329
        NAME #MF_CreateNewProject
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50016
        NODETYPE 329
        NAME #MF_SysSetupFormRun
      ENDNODE
      BEGINNODE
        FILETYPE 0
        UTILTYPE 45
        UTILOBJECTID 50014
        NODETYPE 329
        NAME #MF_Info
      ENDNODE
      ENDGROUP
    BEGINNODE
      FILETYPE 0
      UTILTYPE 5
      UTILOBJECTID 0
      NODETYPE 215
      NAME #MF_QueryBrowserJob
    ENDNODE
  ENDPROJECT

***Element: END

原文地址:https://www.cnblogs.com/perock/p/2379874.html