if oldcreateForm==nil then oldcreateForm = createForm createForm = nil end GlobalFormTable = {} function createForm(Visible) if Visible==nil then Visible = true end GlobalFormTable[#GlobalFormTable+1] = oldcreateForm(Visible) GlobalFormTable[#GlobalFormTable].onClose = function (sender) -- Closing the form itself, return sender.hide() -- will result an error in function of the Form Tracer end return GlobalFormTable[#GlobalFormTable] end EasyFormAccess = { _fheight = 310 ; _fwidth = 300 ; _bheight = 20 ; _bwidth = 70 ; _lvheight = 250 ; _lvwidth = 290 ; _lvccaption = "Form Caption" ; _lvcolumwidth = 286 ; _caption = "Form tarcer" ; _title = "All user defined forms :" ; _bcaption1 = "initialize" ; _bcaption2 = "show/hide" ; } function EasyFormAccess:Start() TrainerTracerClose = 1 self.MainForm = oldcreateForm(false) setProperty(self.MainForm, "BiDiMode", "bdLeftToRight") self.MainForm.height = self._fheight self.MainForm.width = self._fwidth self.MainForm.Caption = self._caption self.FormLv = createListView(self.MainForm) setProperty(self.FormLv, 'ViewStyle', 'vsReport') setProperty(self.FormLv, 'RowSelect', 'True') setProperty(self.FormLv, 'ReadOnly', 'True') setProperty(self.FormLv, 'HideSelection', 'False') self.FormLv.height = self._lvheight self.FormLv.width = self._lvwidth self.FormLvC = self.FormLv.getColumns() self.FormLvColum = self.FormLvC.add() self.FormLvColum.Width = self._lvcolumwidth self.FormLvColum.Caption = self._lvccaption self.FormLvI = self.FormLv.getItems() self.Title = createLabel(self.MainForm) self.Title.caption = self._title self.IntB = createButton(self.MainForm) self.IntB.height = self._bheight self.IntB.width = self._bwidth self.IntB.caption = self._bcaption1 self.IntB.OnClick = function( ) self:Initialize() end self.ShowB = createButton(self.MainForm) self.ShowB.height = self._bheight self.ShowB.width = self._bwidth self.ShowB.caption = self._bcaption2 self.ShowB.enabled = false self.ShowB.OnClick = function( ) self:ShowSelect() end self.MainForm.centerScreen() self.Title.top = 5 self.Title.left = math.floor((self.MainForm.width - self.Title.width - 50) / 2) self.FormLv.top = self.Title.top + self.Title.height + 5 self.FormLv.left = 5 self.IntB.top = self.FormLv.top + self.FormLv.height + 5 self.IntB.left = math.floor(self.MainForm.width - (self.IntB.width + self.ShowB.width + self.ShowB.width) - 2.5) self.ShowB.top = self.FormLv.top + self.FormLv.height + 5 self.ShowB.left = math.ceil(self.IntB.left + self.ShowB.width + 2.5) end function EasyFormAccess:AddItemsLv(FormCaption) local Temp Temp = self.FormLvI.add() Temp.Caption = FormCaption end function EasyFormAccess:Initialize() self.FormLv.clear() if #GlobalFormTable < 1 then return end if #GlobalFormTable > 12 then self.FormLvColum.Width = 269 end for i = 1,#GlobalFormTable do self:AddItemsLv(GlobalFormTable[i].caption) end self.ShowB.enabled = true end function EasyFormAccess:ShowSelect() local index index = self.FormLv.getItemIndex() + 1 if GlobalFormTable[index] ~= nil then if GlobalFormTable[index].getVisible() then GlobalFormTable[index].hide() else GlobalFormTable[index].show() end end end EasyFormAccess:Start() function TrainerTracerMenu() if EasyFormAccess.MainForm.getVisible() then EasyFormAccess.MainForm.hide() else EasyFormAccess.MainForm.show() end end CEMenu = menu_getItems(form_getMenu(getMainForm())) TrainerTracer = createMenuItem(CEMenu) menuItem_add(CEMenu, TrainerTracer) menuItem_setCaption(TrainerTracer, "Trainer Tracer") menuItem_onClick(TrainerTracer, TrainerTracerMenu)