Exportfile for AOT version 1.0 or later Formatversion: 1 ***Element: CLS ; Microsoft Business Solutions-Axapta Class: TabaxPlugin_RecentWindows, выгружен Понедельник 14.05.2007 ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #TabaxPlugin_RecentWindows PROPERTIES Name #TabaxPlugin_RecentWindows Extends #TabaxPluginBase RunOn #Client ENDPROPERTIES METHODS Version: 3 SOURCE #addAxPathFromAOT #void addAxPathFromAOT() #{ # TreeNode node; # str axPath; # Line infologLine; # HWND topmost; # str methodPath; # str editorSuffix = ' - '+'@SYS26985'; # ; # try # { # infologLine = infolog.line(); # topmost = tabax.topmost(); # # if (hasDevelopmentAccess && this.isCodeEditor(WinApi::getWindowText(topmost))) # { # node = this.getCurMethod(topmost); # } # # if (node && node.treeNodePath() != TreeNode::rootNode().treeNodePath()) # { # axPath = tabax.AxPath_fromTreeNode(node); # # if (axPath) # { # mruAOTWindowsMap = mruAOTWindowsMap ? mruAOTWindowsMap : new Map(Types::Integer, Types::String); # mruAOTWindowsMap.insert(topmost, axPath); # if (mruWindowTitlesMap && mruWindowTitlesMap.exists(topmost)) # { # methodPath = mruWindowTitlesMap.lookup(topmost); # if (this.isCodeEditor(methodPath)) # { # /// Add the name of the method to the treenode path # mruWindowTitlesMap.insert(topmost, node.treeNodePath() + editorSuffix); # } # } # } # } # } # catch # { # infolog.cut(infologLine, infolog.line()); # } #} ENDSOURCE SOURCE #addAxPathFromHandle #void addAxPathFromHandle(HWND _handle) #{ # str axPath; # str title; # # TreeNode node; # FormRun formRun; # Args args; # Line infologLine; # int iPos; # MapIterator mapIterator; # ; # # try # { # infologLine = infolog.line(); # title = mruWindowTitlesMap ? (mruWindowTitlesMap.exists(_handle) ? mruWindowTitlesMap.lookup(_handle) : '') : ''; # # if (title) # { # if (mruOpenFormRunMap && mruOpenFormRunMap.exists(_handle)) # { # formRun = mruOpenFormRunMap.lookup(_handle); # if (formRun && formRun.hWnd()) # { # if (mruFormRunArgsMap && mruFormRunArgsMap.exists(_handle)) # args = mruFormRunArgsMap.lookup(_handle); # if (args && !args.caller() && args.menuItemName()) # { # axPath = tabax.AxPath_fromFormRun(formRun, args); # } # } # } # else # { # if (mruAOTWindowsMap && mruAOTWindowsMap.exists(_handle)) # { # axPath = mruAOTWindowsMap.lookup(_handle); # mruAOTWindowsMap.remove(_handle); # } # else # { # if (hasDevelopmentAccess) # { # node = TreeNode::findNode(title); # if (node && node.treeNodePath() != TreeNode::rootNode().treeNodePath()) # { # axPath = tabax.AxPath_fromTreeNode(node); # } # } # } # } # } # } # catch # { # axPath = ''; # infolog.cut(infologLine, infolog.line()); # } # # if (axPath) # { # if (!mruRecentWindowsMap) # mruRecentWindowsMap = new Map(Types::String, Types::String); # mruRecentWindowsMap.insert(title, axPath); # # iPos = conFind(mruTitleOrder, title); # if (iPos > 0) # mruTitleOrder = conDel(mruTitleOrder, iPos, 1); # mruTitleOrder = [title] + mruTitleOrder; # if (conLen(mruTitleOrder) > #WindowRecycleBinSize) # mruTitleOrder = conDel(mruTitleOrder, 1 + #WindowRecycleBinSize, conLen(mruTitleOrder) - #WindowRecycleBinSize); # # if (mruRecentWindowsMap.elements() > #WindowRecycleBinSize) # { # mapIterator = new MapIterator(mruRecentWindowsMap); # while (mapIterator.more()) # { # iPos = conFind(mruTitleOrder, mapIterator.key()); # if (iPos <= 0) # { # mapIterator.delete(); # } # mapIterator.next(); # } # } # } # # if (mruOpenFormRunMap) # mruOpenFormRunMap.remove(_handle); # if (mruFormRunArgsMap) # mruFormRunArgsMap.remove(_handle); #} ENDSOURCE SOURCE #afterWindowClosed #void afterWindowClosed(Tabax _tabax, HWND _handle) #{ # ; # super(_tabax, _handle); # # this.addAxPathFromHandle(_handle); # # if (mruWindowTitlesMap && mruWindowTitlesMap.exists(_handle)) # mruWindowTitlesMap.remove(_handle); #} ENDSOURCE SOURCE #afterWindowOpened ##define.MessageWindow("@SYS59273") #void afterWindowOpened(Tabax _tabax, HWND _handle, str _title) #{ # FormRun formRun; # Line infologLine; # str title; # Args args; # # boolean isSpecialWindow(str _windowTitle) # { # return (_windowTitle == #MessageWindow); # } # ; # super(_tabax, _handle, _title); # # mruOpenFormRunMap = mruOpenFormRunMap ? mruOpenFormRunMap : new Map(Types::Integer, Types::Class); # mruFormRunArgsMap = mruFormRunArgsMap ? mruFormRunArgsMap : new Map(Types::Integer, Types::Class); # mruWindowTitlesMap = mruWindowTitlesMap ? mruWindowTitlesMap : new Map(Types::Integer, Types::String); # # try # { # infologLine = infolog.line(); # title = WinApi::getWindowText(_handle); # /// Special system windows should not be processed # if (isSpecialWindow(title)) # return; # # mruWindowTitlesMap.insert(_handle, title); # /// Only windows that are called from the MainMenu are saved # formRun = tabax.currentFormRun(); # if (formRun) # { # args = formRun.args(); # if (formRun.hWnd() && args && !args.caller() && args.menuItemName()) # { # mruOpenFormRunMap.insert(_handle, formRun); # /// Have to include args as well, as they are set to null after the form is closed # mruFormRunArgsMap.insert(_handle, args); # } # } # else # { # this.addAxPathFromAOT(); # } # } # catch # { # infolog.cut(infologLine, infolog.line()); # } #} ENDSOURCE SOURCE #afterWindowUpdated #void afterWindowUpdated(Tabax _tabax, HWND _handle, str _title) #{ # ; # super(_tabax, _handle, _title); # # mruWindowTitlesMap = mruWindowTitlesMap ? mruWindowTitlesMap : new Map(Types::Integer, Types::String); # mruWindowTitlesMap.insert(_handle, WinApi::getWindowText(_handle)); #} ENDSOURCE SOURCE #beforeClose #void beforeClose(Tabax _tabax) #{ # void saveWindowList(Map _map) # { # MapEnumerator mruWindowsEnumerator; # ; # if (_map && _map.elements() > 0) # { # mruWindowsEnumerator = _map.getEnumerator(); # while (mruWindowsEnumerator.moveNext()) # { # this.addAxPathFromHandle(mruWindowsEnumerator.currentKey()); # } # } # } # ; # super(_tabax); # # try # { # saveWindowList(mruWindowTitlesMap); # saveWindowList(mruAOTWindowsMap); # # xSysLastValue::saveLast(this); ///Save RecentWindows to SysLastValue # } # catch # { # error(strFmt("@SYS70938", "@SYS67795", strFmt("@SYS63093", funcName()))); # } # # ///Clean up # WinApi::deleteFile(SysResource::getTempPath() + #imageName + #imageExt); # mruRecentWindowsMap = null; # mruWindowTitlesMap = null; # mruOpenFormRunMap = null; # mruFormRunArgsMap = null; # mruAOTWindowsMap = null; # infolog.globalCache().clear(classStr(TabaxPlugin_RecentWindows)); #} # ENDSOURCE SOURCE #classDeclaration #/// Recent Windows plugin for Tabax #///@desc #/// Version 0.1 #/// The list is based on last access time, not opening time #///@see #/// See http://www.axaptapedia.com/TabaxPlugin_RecentWindows #/// ContactInfo: Ivan Kashperuk, ivan.kashperuk@gmail.com ##define.imageName('DEV_TabaxPlugin_RecentWindows') #class TabaxPlugin_RecentWindows extends TabaxPluginBase implements SysPackable #{ # Map mruRecentWindowsMap; /// holds references (Title - AxPath) (String - String) # Map mruWindowTitlesMap; /// holds references (HWND - Title) (Integer - String) # Map mruOpenFormRunMap; /// holds references (HWND - FormRun) (Integer - Class) # Map mruFormRunArgsMap; /// holds references (HWND - Args for this FormRun) (Integer - Class) # Map mruAOTWindowsMap; /// holds references (HWND - AxPath) (Integer - String) # # container mruTitleOrder; /// holds window titles in the last access time order # boolean hasDevelopmentAccess; /// speed up the tick method a little # HWND lastEditorHWND; /// last active Editor window # HWND lastEditorListView; /// last active Editor window ListView # str lastEditorMethod; /// last active Method in the editor # # #define.CurrentVersion(2) # #define.WindowRecycleBinSize(15) # #define.WindowRecycleBinButton("WindowRecycleBinButton") # # /// No interface in Tabax to determine if it is Ax3 or Ax4 # #AOT # #if.ReferencesPath # #define.PaneWindowCL("AxPaneWnd") # #define.Ax4 # #define.imageExt('.PNG') # #endif # # #ifnot.ReferencesPath # #define.PaneWindowCL("PaneWindowCL") # #define.Ax3 # #define.imageExt('.BMP') # #endif #} ENDSOURCE SOURCE #connected #void connected() #{ # ; # super(); # # xSysLastValue::getLast(this); # # if (this.initPlugin()) # { # infolog.globalCache().set(classStr(TabaxPlugin_RecentWindows), identifierStr(instance), this); # hasDevelopmentAccess = hasSecurityKeyAccess(securityKeyNum(SysDevelopment), AccessType::Edit); # # #subscribe(afterWindowOpened) # #subscribe(afterWindowUpdated) # #subscribe(afterWindowClosed) # #subscribe(tick) # #subscribe(beforeClose) # } #} ENDSOURCE SOURCE #formControlTypeStr #/// Copied from SysFormRun::controlTypeStr() #/// AOSRunMode::Client #identifiername formControlTypeStr(classId classId) #{ # ; # switch (classId) # { # case classNum(FormBuild): # return 'STATICTEXT'; # case classNum(FormBuildStringControl): # return 'STRINGEdit'; # case classNum(FormBuildTabControl): # return 'TAB'; # case classNum(FormBuildCheckBoxControl): # return 'CHECKBOX'; # case classNum(FormBuildGroupControl): # return 'GROUP'; # case classNum(FormBuildButtonControl): # return 'BUTTON'; # case classNum(FormBuildRealControl): # return 'REALEdit'; # case classNum(FormBuildIntControl): # return 'INTEdit'; # case classNum(FormBuildComboBoxControl): # return 'COMBOBOX'; # case classNum(FormBuildWindowControl): # return 'Window'; # case classNum(FormBuildDateControl): # return 'DATEEdit'; # case classNum(FormBuildGridControl): # return 'GRID'; # case classNum(FormBuildRadioControl): # return 'RADIOBUTTON'; # case classNum(FormBuildButtonGroupControl): # return 'BUTTONGROUP'; # case classNum(FormBuildTabPageControl): # return 'TABPAGE'; # case classNum(FormBuildCommandButtonControl): # return 'COMMANDBUTTON'; # case classNum(FormBuildMenuButtonControl): # return 'MENUBUTTON'; # case classNum(FormBuildFunctionButtonControl): # return 'MENUItemBUTTON'; # case classNum(FormBuildListBoxControl): # return 'LISTBOX'; # case classNum(FormBuildTimeControl): # return 'TIMEEdit'; # case classNum(FormBuildTableControl): # return 'TABLE'; # case classNum(FormBuildButtonSeparatorControl): # return 'SEPARATOR'; # case classNum(FormBuildTreeControl): # return 'TREE'; # case classNum(FormBuildActiveXControl): # return 'ACTIVEX'; # case classNum(FormBuildListControl): # return 'LISTVIEW'; #// case classNum(FormBuildProgressControl): #// return 'PROGRESS'; # case classNum(FormBuildAnimateControl): # return 'ANIMATE'; # case classNum(FormBuildHTMLControl): # return 'HTML'; # } # # return ""; #} ENDSOURCE SOURCE #getCurMethod #/// Copied from \\Forms\\Tabax\\Methods\\getCurMethod for optimization ##WinAPI ##define.Methods('Methods') #TreeNode getCurMethod(HWND _editorHWnd) #{ # str name; # str editorSuffix = ' - '+'@SYS26985'; # str className; # str itemName; # # int hWndChild; # int childPos; # int listView; # int selectedItem; # # boolean editor; # # 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, boolean _addTrailingSymbol) # { # ; # _prefix = #AOTRootPath + _prefix; # if (_addTrailingSymbol) # _prefix += #AOTRootPath; # if (subStr(_name, 1, strLen(_prefix)) == _prefix) # return true; # # return false; # } # #localmacro.pref # pref(@'%1', _name, true) # #endmacro # #localmacro.pref2 # pref(@'%1', _name, false) # #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) || #pref2(Macros) || #pref2(Jobs)) # return parent.AOTfindChild(_methodName); # if (#pref(Data Dictionary\Tables) || #pref(Data Dictionary\Maps) || #pref(Data Dictionary\Views) || #pref(Queries)) # return fromMethods(parent, _methodName); # if (#pref(Forms)) # { # delimiterPos = strFind(_methodName, ':', 1, strLen(_methodName)); # if (delimiterPos) ///Means the method is located on a control # { # controlName = strRTrim(strLTrim(subStr(_methodName, 1, delimiterPos - 1))); # controlMethodName = strRTrim(strLTrim(subStr(_methodName, delimiterPos + 1, strLen(_methodName) - delimiterPos))); # return fromMethods(this.treeNodeFromFormControl(parent, controlName), controlMethodName); # } # else # return fromMethods(parent, _methodName); # } # if (#pref(Reports)) //ReportTemplates, SectionTemplates are not included here # { # delimiterPos = strFind(_methodName, ':', 1, strLen(_methodName)); # if (delimiterPos) ///Means the method is located on a control # { # controlName = strRTrim(strLTrim(subStr(_methodName, 1, delimiterPos - 1))); # controlMethodName = strRTrim(strLTrim(subStr(_methodName, delimiterPos + 1, strLen(_methodName) - delimiterPos))); # return this.treeNodeFromReportControl(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) : ''; # } # ; # name = WinApi::getWindowText(_editorHWnd); # name = subStr(name, 1, strLen(name) - strLen(editorSuffix)); # editor = true; # if (lastEditorHWND != _editorHWnd || !lastEditorListView) /// If editor is the same and listView is figured out # { # hWndChild = winapi::getWindow(_editorHWnd, #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.ax3 # editor = className == "SysTabControl32"; # #endif # #if.ax4 # editor = className == "AxPaneWnd"; # #endif # childPos++; # break; # default: # editor = false; # break; # } # hWndChild = winapi::getWindow(hWndChild, #GW_HWNDNEXT); # } # } # else # { # listView = lastEditorListView; # } # # if (editor && listView) # { # selectedItem = winapi::sendMessageEx(listView, #LVM_GETNEXTITEM, -1, #LVNI_SELECTED); # if (selectedItem >= 0) # { # itemName = getItemText(ListView, selectedItem); # if (itemName && itemName != lastEditorMethod) /// If not the same method again # { # lastEditorHWND = _editorHWnd; # lastEditorListView = listView; # lastEditorMethod = itemName; # return toTreeNode(name, itemName); # } # } # } # return null; #} ENDSOURCE SOURCE #initParmDefault #void initParmDefault() #{ # ; #} ENDSOURCE SOURCE #initPlugin #boolean initPlugin() #{ # FormGroupControl pluginsGroup; # FormFunctionButtonControl WindowRecycleBinButton; # Image windowRecycleBinImage; # FilePath imagePath = SysResource::getTempPath() + #imageName + #imageExt; # ; # try # { # pluginsGroup = tabax.pluginsGroup(); # WindowRecycleBinButton = pluginsGroup.addControl(FormControlType::MenuFunctionButton, #WindowRecycleBinButton); # WindowRecycleBinButton.buttonDisplay(FormButtonDisplay::ImageOnly); # windowRecycleBinImage = this.WindowRecycleBinImage(); # #if.ax3 # windowRecycleBinImage.saveImage(imagePath, ImageSaveType::BMP_UNCOMP); # #endif # #if.ax4 # windowRecycleBinImage.saveImage(imagePath, ImageSaveType::PNG); # #endif # WindowRecycleBinButton.normalImage(imagePath); # WindowRecycleBinButton.border(3); # WindowRecycleBinButton.backStyle(FormBackStyle::Transparent); # # WindowRecycleBinButton.menuItemType(MenuItemType::Action); # WindowRecycleBinButton.menuItemName(menuItemActionStr(DEV_TabaxPlugin_RecentWindows)); # } # catch # { # return false; # } # return true; #} ENDSOURCE SOURCE #isCodeEditor #/// Determines if the text belongs to an editor window #boolean isCodeEditor(str _windowTitle) #{ # return tabax.strEndsWith(_windowTitle, ' - '+'@SYS26985'); #} ENDSOURCE SOURCE #lastValueDataAreaId #DataAreaId lastValueDataAreaId() #{ # return curExt(); #} ENDSOURCE SOURCE #lastValueDesignName #str lastValueDesignName() #{ # return ''; #} ENDSOURCE SOURCE #lastValueElementName #str lastValueElementName() #{ # return classId2Name(ClassIdGet(this)); #} ENDSOURCE SOURCE #lastValueType #UtilElementType lastValueType() #{ # return UtilElementType::Class; #} ENDSOURCE SOURCE #lastValueUserId #UserId lastValueUserId() #{ # return curUserId(); #} ENDSOURCE SOURCE #lastWindow #str lastWindow() #{ # MapEnumerator mapEnumerator; # ; # if (mruRecentWindowsMap && conLen(mruTitleOrder) > 0) # { # mapEnumerator = mruRecentWindowsMap.getEnumerator(); # while (mapEnumerator.moveNext()) # { # if (mapEnumerator.currentKey() == conPeek(mruTitleOrder, 1)) # return mapEnumerator.currentValue(); # } # } # # return ''; #} ENDSOURCE SOURCE #pack #container pack() #{ # ; # if (!mruRecentWindowsMap) # mruRecentWindowsMap = new Map(Types::String, Types::String); # # return [#CurrentVersion, mruRecentWindowsMap.pack()] + [mruTitleOrder]; #} ENDSOURCE SOURCE #pickRecentWindow ##define.ImageArrow(1009) #str pickRecentWindow() #{ # Object pickListFormRun; # FormListControl list; # Form form; # FormBuildDesign design; # str choice; # //int mouseX; # //int mouseY; # ; # pickListFormRun = classFactory.createPicklist(); # # form = pickListFormRun.form(); # design = form.design(); # design.frame(FormFrame::Dialog); /// Frame - Dialog # design.alwaysOnTop(true); /// Always on Top - true # design.windowType(FormWindowType::PopUp); /// WindowType - Popup # //[mouseX, mouseY] = WinAPI::getCursorPos(); # //design.left(mouseX); # //design.top(mouseY); # # pickListFormRun.init(); # pickListFormRun.choices(mruTitleOrder, #ImageArrow); # pickListFormRun.caption("@SYS24005"); # # list = pickListFormRun.list(); # list.sort(0); /// SortOrder - None # list.rowSelect(true); # pickListFormRun.resizeWindow(670, 280); # # pickListFormRun.run(); # pickListFormRun.wait(); # # choice = pickListFormRun.choice(); # # if (choice && mruRecentWindowsMap && mruRecentWindowsMap.exists(choice)) # return mruRecentWindowsMap.lookup(choice); # # return ''; #} ENDSOURCE SOURCE #pickRecentWindowPopupMenu #str pickRecentWindowPopupMenu() #{ # FormFunctionButtonControl but; # PopupMenu menu; # int iWinId; # str menuItemPrefix; # ; # but = tabax.design().controlName(#WindowRecycleBinButton); # menu = new PopupMenu(but.hWnd()); # # for (iWinId = 1; iWinId <= conLen(mruTitleOrder); iWinId++) # { # menuItemPrefix = (iWinId < 10) ? '&' + int2str(iWinId) : (iWinId > 10) ? int2str(iWinId) : '1&0'; # menu.insertItem(menuItemPrefix + '. ' + conPeek(mruTitleOrder, iWinId), false, false, 0, 100 + iWinId); # } # iWinId = menu.draw() - 100; # # if (mruRecentWindowsMap && mruRecentWindowsMap.exists(conPeek(mruTitleOrder, iWinId))) # return mruRecentWindowsMap.lookup(conPeek(mruTitleOrder, iWinId)); # # return ''; #} ENDSOURCE SOURCE #tick #void tick(Tabax _tabax) #{ # ; # super(_tabax); # # /// Add the topmost window as an AxPath candidate # this.addAxPathFromAOT(); #} ENDSOURCE SOURCE #treeNodeFromFormControl #/// Returns control from form _form with the name _name (this includes dataSource, dataSource control methods and form controls) ##define.FormDesignPath('\\designs\\design') ##define.FormDataSourcePath('\\Data Sources\\') ##define.FieldsPath('\\Fields\\') #TreeNode treeNodeFromFormControl(TreeNode _form, str _name) #{ # Object currentControlObj; # Form form; # FormBuildDesign design; # FormBuildDataSource formBuildDataSource; # int iDataSourceNum; # int iControlNum; # str nodePath; # str path = _form.treeNodePath() + #FormDesignPath; # # str dsFieldName; # str dsName; # int delimiterPos; # # str getNodePath(FormBuildControl parent, str ControlName) # { # int iCtrlNum; # Object ctrlObj; # str ctrlNodePath; # ; # if (parent.isContainer()) # { # for (iCtrlNum = 1; iCtrlNum <= parent.controlCount(); iCtrlNum++) # { # ctrlObj = parent.controlNum(iCtrlNum); # if (ctrlObj.name() == ControlName) # { # if (ctrlObj.isContainer()) # return strfmt('\\[%1:%2]', this.formControlTypeStr(ctrlObj.handle()), ctrlObj.Name()); # return strfmt('\\%1:%2', this.formControlTypeStr(ctrlObj.handle()), ctrlObj.Name()); # } # if (ctrlObj.isContainer()) # { # ctrlNodePath = GetNodePath(ctrlObj, ControlName); # if (ctrlNodePath) # { # return strfmt('\\[%1:%2]', this.formControlTypeStr(ctrlObj.handle()), ctrlObj.Name()) + ctrlNodePath; # } # } # } # } # return ''; # } # ; # try # { # if (_form && SysDictClass::isEqualOrSuperclass(classIdGet(_form),classNum(Form))) # { # form = _form; # /// Search DataSource methods # for (iDataSourceNum = 1; iDataSourceNum <= form.dataSourceCount(); iDataSourceNum++) # { # if (_name == form.dataSource(iDataSourceNum).name()) # return TreeNode::findNode(_form.treeNodePath() + #FormDataSourcePath + form.dataSource(iDataSourceNum).name()); # } # /// Search DataSource field methods # delimiterPos = strFind(_name, '.', 1, strLen(_name)); # if (delimiterPos) # { # dsName = strRTrim(strLTrim(subStr(_name, 1, delimiterPos - 1))); # dsFieldName = strRTrim(strLTrim(subStr(_name, delimiterPos + 1, strLen(_name) - delimiterPos))); # # for (iDataSourceNum = 1; iDataSourceNum <= form.dataSourceCount(); iDataSourceNum++) # { # formBuildDataSource = form.dataSource(iDataSourceNum); # if (dsName == formBuildDataSource.name()) # { # if (fieldName2Id(formBuildDataSource.table(), dsFieldName)) /// If the dataSource has the specified field # return TreeNode::findNode(_form.treeNodePath() + #FormDataSourcePath + formBuildDataSource.name() + #FieldsPath + dsFieldName); # } # } # } # /// Search in the Design node of the Form # design = form.design(); # if (design) # { # for (iControlNum = 1; iControlNum <= design.controlCount(); iControlNum++) # { # currentControlObj = design.controlNum(iControlNum); # if (currentControlObj.name() == _name) # { # if (currentControlObj.isContainer()) # nodePath = path + strfmt('\\[%1:%2]', this.formControlTypeStr(currentControlObj.handle()), currentControlObj.Name()); # else # nodePath = path + strfmt('\\%1:%2', this.formControlTypeStr(currentControlObj.handle()), currentControlObj.Name()); # # return TreeNode::findNode(nodePath); # } # nodePath = getNodePath(currentControlObj, _name); # if (nodePath) # { # nodePath = path + strfmt('\\[%1:%2]', this.formControlTypeStr(currentControlObj.handle()), currentControlObj.Name()) + nodePath; # return TreeNode::findNode(nodePath); # } # } # } # } # } # catch # { # return null; # } # return null; #} ENDSOURCE SOURCE #treeNodeFromReportControl #/// Returns TreeNode to method _methodName from _report for control _name (this includes dataSource\Query methods and report controls) ##define.DataSourceQuery('\\Data Sources\\Query\\') ##define.MethodsPath('\\Methods\\') #TreeNode treeNodeFromReportControl(TreeNode _report, str _name, str _methodName) #{ # Report report; # ReportDesign design; # ReportSection section; # # int iDesignNum; # int iSectionNum; # # str methodNamePath = #MethodsPath + _methodName; # Set foundTreeNodeSet = new Set(Types::Class); # SetEnumerator setEnumerator; # # void findMethod(TreeNodePath _parentPath) # { # TreeNode treeNode; # ; # treeNode = TreeNode::findNode(_parentPath + methodNamePath); # if (treeNode) # foundTreeNodeSet.add(treeNode); # } # ; # try # { # if (_report && SysDictClass::isEqualOrSuperclass(classIdGet(_report),classNum(Report))) # { # report = _report; # /// Search DataSource\Query methods # findMethod(_report.treeNodePath() + #DataSourceQuery); # # for (iDesignNum = 1; iDesignNum <= report.designCount(); iDesignNum++) # { # design = report.designNumber(iDesignNum); # // AutoDesign # for (iSectionNum = 1; iSectionNum <= design.autoSectionCount(); iSectionNum++) # { # section = design.autoSectionNumber(iSectionNum); # findMethod(section.treeNodePath()); # } # /// GeneratedDesign # for (iSectionNum = 1; iSectionNum <= design.sectionCount(); iSectionNum++) # { # section = design.sectionNumber(iSectionNum); # findMethod(section.treeNodePath()); # } # } # } # else # info(classid2name(classIdGet(_report))); # if (foundTreeNodeSet.elements() >= 1) # { # setEnumerator = foundTreeNodeSet.getEnumerator(); # if (setEnumerator.moveNext()) # return setEnumerator.current(); # // Possibly allow for a selection in case there are more than 1 object with this name # // User chooses which object he actually clicked # } # } # catch # { # return null; # } # return null; #} ENDSOURCE SOURCE #unpack #boolean unpack(container packedClass) #{ # Integer version = conpeek(packedClass, 1); # container packedWindowsMap; # ; # switch (version) # { # case #CurrentVersion: # [version, packedWindowsMap, mruTitleOrder] = packedClass; # try # { # if (packedWindowsMap && conLen(packedWindowsMap) > 3) # { # mruRecentWindowsMap = Map::create(packedWindowsMap); # } # } # catch # { # mruRecentWindowsMap = new Map(Types::String, Types::String); # return false; # } # break; # default: # return false; # } # # return true; #} ENDSOURCE SOURCE #WindowRecycleBinImage #/// This methods holds the data of the RecycleBin window button, as Resource 1115 is not present in DAX 4.0 anymore #Image WindowRecycleBinImage() #{ # Image windowRecycleBinImage = new Image(); # str imageData = @'89504e470d0a1a0a0000000d4948445200000010000000100802000000909168 #36000000097048597300000dd700000dd70142289b78000002544944415478da #85f0fd4f525118c701f8bfb8b5d9d65a2faeada56e351134150d658a5aa4666f #ae16a9a46d4e6b95994570257c019406789917f2125ee4dc7b75bc5c20501310 #64b4d5dae007f4077ef08e5f6ceba0ac8dade9b3efce799eb3efe779ce9ea2dd #93a2ff30fe953900502681a8f8bfaaa92b431765916d2fa7ea9a1e7d9f03ec0e #e3f0ab8ec4af588b48d8286810b636f73e7ed024bc51c7af8567159773f0e780 #cdeec3472e8fe3f22c17c136d0dd73bf3b1addce66b32cbb0fadf50d757b7bbb #e515652ccb663219bfdfbff415abaee141731e809d0882a0699aa4c8b1b76f38 #dc4aa954ca300c06c38c59be58ca2aae405b1e58060658fc4efd3c5e2886e400 #192281d7f397a583a3a5d2918bfdc3172443e71f0d9c7b28397ba7f78cf8eee9 #f6ce1291b844d8710ada64c893dc9660e60a4a6c6b0d50569aaf37f30c962613 #dea5d2558d23e52363979f8d5e9a40daa02dbfd643e0e91180537cfb5a7734e1 #830a7cd7cca1cd931adebb49eee785e102c0b33e700404436a87ab17075dc12d #ed7a685e8b364feb1a1175bdd53e5e00783707ed4e21c9882371007b63441b8a #b7a0f82d821e51cdf33f4e5fb7d3b202209ad052de6ecadb198e038ae93313ed #be0dbd09ef0cc5569473f5e30a2e58551400b11f3a92b90d3c62e0be077fe2fa #36158993e11d60b4f4c867abc7e4950459382192d002cfcd1557bb956ac508e1 #c292c01dd0cc1a6a95da6ad914e7b5ecaacd31910792c924cc2cb6bef08e7a2b #36b3199e098454be8d4f9e80d2e94556dd0ae09413e08371f105b4a552a9dc04 #032a17888a4f14a21a4aa7d37f01f85fc8c90b72dbc20000000049454e44ae42 #6082'; # # try # { # windowRecycleBinImage.setData( BinData::stringToData(imageData)); # } # catch # { # return null; # } # return windowRecycleBinImage; #} ENDSOURCE SOURCE #main #static void main(Args args) #{ # TabaxPlugin_RecentWindows plugin; # str axPath; # ; # if (!args || !args.caller() || !SysDictClass::isEqualOrSuperclass(classIdGet(args.caller()), classNum(FormRun))) # throw error(Error::wrongUseOfFunction(classStr(TabaxPlugin_RecentWindows))); # # plugin = infolog.globalCache().get(classStr(TabaxPlugin_RecentWindows), identifierStr(instance), null); # if (!plugin) # throw error(Error::missingRecord(classStr(TabaxPlugin_RecentWindows))); # # try # { # axPath = winApi::isControlButtonDown() ? # plugin.lastWindow() # : # winApi::isShiftButtonDown() ? # plugin.pickRecentWindow() # : # plugin.pickRecentWindowPopupMenu(); # if (axPath) # { # try # { # plugin.tabax().AxPath_go(axPath); # } # catch # { # return; # } # } # } # catch # { # error(strFmt("@SYS63093", funcName())); # } #} ENDSOURCE ENDMETHODS ENDCLASS ***Element: FTM ; Microsoft Business Solutions-Axapta MENUITEM : DEV_TabaxPlugin_RecentWindows unloaded at Понедельник 14.05.2007 ; -------------------------------------------------------------------------------- VERSION 1 MENUITEM #DEV_TabaxPlugin_RecentWindows Type: 3 PROPERTIES Name #DEV_TabaxPlugin_RecentWindows Label #Recent windows HelpText #Reopen a recently closed window Class #Class Object #TabaxPlugin_RecentWindows Parameters # EnumTypeParameter # EnumParameter # RunOn #Client ConfigurationKey # CountryConfigurationkey # WebConfigurationkey # SecurityKey # NeededAccessLevel #View Web # WebAccess #All WebSecureTransaction #No WebPage # MultiSelect #No ENDPROPERTIES ENDMENUITEM ***Element: PRN ; Microsoft Business Solutions-Axapta Project : DEV_TabaxPlugin_RecentWindows unloaded at Понедельник 14.05.2007 ; -------------------------------------------------------------------------------- PROJECTVERSION 2 PROJECT #DEV_TabaxPlugin_RecentWindows SHARED PROPERTIES Name #DEV_TabaxPlugin_RecentWindows ENDPROPERTIES GROUP #Classes PROPERTIES Name #Classes ProjectGroupType #Classes GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 50288 NODETYPE 329 NAME #TabaxPlugin_RecentWindows ENDNODE ENDGROUP GROUP #Menu Items PROPERTIES Name #Menu Items ProjectGroupType #MenuItems GroupMask # PreventEditProperties #No ENDPROPERTIES GROUP #Action PROPERTIES Name #Action ProjectGroupType #Action GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 3 UTILOBJECTID 0 NODETYPE 296 NAME #DEV_TabaxPlugin_RecentWindows ENDNODE ENDGROUP ENDGROUP ENDPROJECT ***Element: END