ive take this code from somone else in this forum ive read the loops advice and ACTUALLY WORK. the issue here its if you try to set text to an menu you cant. let me explain:
e_ID 1 FILE
e_ID 3-copy
e_ID 2-paste
e_ID 4-exit
if you use MenuEX.SetText(3, "copytest") works perfectly.
but if you try MenuEX.SetText(1, "FILECHANGE")
not work, could somone assistme here?
thanks in advance.
BTW this is the fixed version for 8+ versions of the v7.5 code. (i dont take any credit, just ive fixed )
e_ID 1 FILE
e_ID 3-copy
e_ID 2-paste
e_ID 4-exit
if you use MenuEX.SetText(3, "copytest") works perfectly.
but if you try MenuEX.SetText(1, "FILECHANGE")
not work, could somone assistme here?
thanks in advance.
BTW this is the fixed version for 8+ versions of the v7.5 code. (i dont take any credit, just ive fixed )
Code:
MenuEX={} local function AdjustSubMenuProperties(tSubMenu, tItemProperties) for nIndex, tItem in pairs (tSubMenu) do if tItem.ID == tItemProperties.ID then for sKey, vValue in pairs (tItem) do if tItemProperties[sKey] == nil then tItemProperties[sKey] = vValue; end end tSubMenu[nIndex] = tItemProperties; break; elseif type(tItem.SubMenu) == 'table' and tItem.ID == -1 then tSubMenu[nIndex].SubMenu = AdjustSubMenuProperties(tSubMenu[nIndex].SubMenu, tItemProperties); end end return tSubMenu; end -- function MenuEX.SetChecked(nID, bChecked) tMenu = Application.GetMenu(); tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Checked=bChecked}); Application.SetMenu(tMenu); end function MenuEX.SetEnabled(nID, bEnabled) tMenu = Application.GetMenu(); tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Enabled=bEnabled}); Application.SetMenu(tMenu); end function MenuEX.SetText(nID, sText) tMenu = Application.GetMenu(); tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Text=sText}); Application.SetMenu(tMenu); end function MenuEX.SetIconID(nID, nIconID) tMenu = Application.GetMenu(); tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, IconID=nIconID}); Application.SetMenu(tMenu); end
Comment