Thread Tools Display Modes
11-28-10, 04:23 PM   #1
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Hiding Actionbutton borders?

I'm almost finished with a little addon to add a custom vehicle bar wherever you'd like it anchored and I've got a small graphical issue I'd like gone. I'm sure this is an easy fix but I'd really like to hide the borders around the action buttons. I'm fairly certain its not the icons themselves as they should be border free (replacement icons).



Ideas?
  Reply With Quote
11-28-10, 04:46 PM   #2
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by maltese View Post
I'm almost finished with a little addon to add a custom vehicle bar wherever you'd like it anchored and I've got a small graphical issue I'd like gone. I'm sure this is an easy fix but I'd really like to hide the borders around the action buttons. I'm fairly certain its not the icons themselves as they should be border free (replacement icons).



Ideas?
Hmm looks like your missing an important button on that bar... the leave button!!

and try this VehicleMenuBarActionButton1.Border:Hide() see if that gets rid of it. Then of course do that for all the buttons...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 04:55 PM   #3
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Only sissys need the leave button

trying that gives this error:
attempt to index field 'Border' (a nil value)
  Reply With Quote
11-28-10, 05:03 PM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
try it without the . in there so it reads VehicleMenuBarActionButton1Border:Hide()

and leave buttons are a must. just ask all the people stuck in turkey day chairs because the addon or interface they are using failed to think about the leave button.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 05:09 PM   #5
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
I guess all those people didn't try the whole right click on yourself and choose the leave option? Silly people
I have leave vehicle keybound anyway.

Sadly no period doesn't work either. I've also tried SetBackdropBorderColor(0, 0, 0, 0) which doesn't work
  Reply With Quote
11-28-10, 05:09 PM   #6
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
you also want to hide... VehicleMenuBarActionButton1NormalTexture:Hide()


The no period is working. You just dont notice the border texture. Do the normal texture and its gone.

You can remove the highlight and pushed textures but i dont remember how to remove none named textures... or maybe you couldnt? i think i found a way i just dont remember it now. Unfortunately the highlight and pushed textures do not have names.

edit- it just hit me... you might be able to overwrite the xml texture setting with lua texture setting so if you do VehicleMenuBarActionButton1HighlightTexture:SetTexture(nil) or VehicleMenuBarActionButton1.HighlightTexture:SetTexture(nil)

you could also sub nil with your own texture... or a blank one if nil does not work...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 05:43 PM.
  Reply With Quote
11-28-10, 05:44 PM   #7
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Yep, thats working... sortof. They are initially hidden, but on use the border is coming back I tried unregistering the borders from events with:

Code:
	local buttonborder, buttontexture
	for i = 1, VEHICLE_MAX_ACTIONBUTTONS do
		buttonborder = _G["VehicleMenuBarActionButton"..i.."Border"]
		buttontexture = _G["VehicleMenuBarActionButton"..i.."NormalTexture"]
		buttonborder:SetScript("OnEvent", nil)
		buttontexture:SetScript("OnEvent", nil)
		buttonborder:Hide()
		buttontexture:Hide()
	end
but now I'm getting this error:
attempt to call method 'SetScript' (a nil value)

I might just move those frames offscreen and be done with it ghetto style.

Last edited by maltese : 11-28-10 at 05:54 PM.
  Reply With Quote
11-28-10, 06:05 PM   #8
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
no no dont do that.
what you need to do is...
yourframe:hide()
yourframe.show = yourframe:hide()

this will keep it always hidden there is a better way to do it actually but requires a bunch of other stuff be setup...

like here is my do nothing function take over and hide function

local function DoNothing()
end

local function HideFrame(reference)
local frame = type(reference) == 'string' and _G[reference] or reference
if type(frame) ~= 'table' then return end
frame.Show = DoNothing
frame:Hide()
end

then to actually hide your frame you do

HideFrame("yourframe")

then you can just do that HideFrame("yourframe") for each button instead of having to write out the .show = :hide part for each button

and youll never see it again.

Unregistering events from the frame will cause you a ton of problems.

Oh yea and on a final note... what your doing will cause an extreme amount of taint. You will most likely never notice it but just letting you know its happening. -- to do this with out so much taint you would have to write a bunch of secure code to move the buttons and the frame around.

Add that leave button and ill be downloading your addon
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 06:10 PM.
  Reply With Quote
11-28-10, 06:32 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Code:
local function DoNothing()
end

local function HideFrame(frame)
	if type(frame) == "string" then
		frame = _G[frame]
	end
	if type(frame) == "table" and frame.Show then
		frame.Show = DoNothing
		frame:Hide()
	end
end
Cleaner, and allows passing either the frame itself, or a string representing the frame's name:

Code:
HideFrame(Minimap)
HideFrame("Minimap")
  Reply With Quote
11-28-10, 08:25 PM   #10
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
I'll see about adding that leave vehicle button in. Couple people in my guild like it as well but all said "where's the leave button"

EDIT: Just a heads up, both of the above code segments hide the border frames, but as soon as I use the ability the border comes right back.

Last edited by maltese : 11-28-10 at 09:31 PM.
  Reply With Quote
11-29-10, 12:14 AM   #11
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Simply ":Hide"ing frame would server nothing, and redefining Show directly is not very good as well.
Try

frame:SetScript("OnShow", frame.Hide);
frame:Hide();

Even if it would not work for you, this is the preferred way of doing this thing.

P.S.
Try to override the OnUpdate handler as well.
  Reply With Quote
11-29-10, 01:08 AM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by AnrDaemon View Post
Simply ":Hide"ing frame would server nothing, and redefining Show directly is not very good as well.
Try

frame:SetScript("OnShow", frame.Hide);
frame:Hide();

Even if it would not work for you, this is the preferred way of doing this thing.

P.S.
Try to override the OnUpdate handler as well.
If you re"set" the setscript for the onshow it will break all of the stuff related to the onshow script written by bliz. This is a bad way to do things. same goes for the onupdate. Now granted it also depends on how much of bliz's code you rely on for things... being that you were asking about the button borders it tells me you simply adjusted a lot of bliz's stuff. Which tells me that if you screw with those scripts youll either have to write a lot more code to accommodate for it or do it the way previously stated.



oh and as another note to the whole re-setting bliz's set scripts... it will more then likely break other addons.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-29-10, 02:36 AM   #13
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Originally Posted by Grimsin View Post
If you re"set" the setscript for the onshow it will break all of the stuff related to the onshow script written by bliz. This is a bad way to do things. same goes for the onupdate. Now granted it also depends on how much of bliz's code you rely on for things... being that you were asking about the button borders it tells me you simply adjusted a lot of bliz's stuff. Which tells me that if you screw with those scripts youll either have to write a lot more code to accommodate for it or do it the way previously stated.



oh and as another note to the whole re-setting bliz's set scripts... it will more then likely break other addons.

Your post sounds just like i'm overriging global OnShow for all frames with single command... ... ............ go figure my reaction.
  Reply With Quote
11-29-10, 05:35 AM   #14
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Originally Posted by AnrDaemon View Post
Simply ":Hide"ing frame would server nothing, and redefining Show directly is not very good as well.
Try

frame:SetScript("OnShow", frame.Hide);
frame:Hide();

Even if it would not work for you, this is the preferred way of doing this thing.

P.S.
Try to override the OnUpdate handler as well.
I actually did try doing that, but it didn't work either. It threw lots of errors. Seeing how I struggled for a couple days with this very issue on trying to find a way to hide the blizzard bars while still retaining their functionality to no avail, I ended up just moving the selected frame offscreen. I know its not pretty nor is it the ideal method, but it works remarkably well.

I'll hopefully have the vehicle exit button working sometime on tuesday. I wont have a chance to work on it today.
  Reply With Quote
11-29-10, 08:26 AM   #15
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by AnrDaemon View Post
Your post sounds just like i'm overriging global OnShow for all frames with single command... ... ............ go figure my reaction.
With the frames he's referring to you would be. Not for all frames but ones that do have important functions within the onshow and onupdate. Further more as i previously stated... the VehicleMenuBar causes major taint errors and i guarantee with the things you have done that you are going to be producing heavy taint. If you dont know what taint is i suggest you look it up.

Also note that if you really need to change/add those scripts you do hookscript or hooksecurefunc. OR you go to the bliz setscript you want to modify you copy the entire thing paste it into your code and then modify it. That way you maintain any other functionality within it. This also means any other functions used within that script that are not global will have to be cut and pasted as well.

and quite frankly if you are not going to rebuild from scratch the vehiclemenubar then frame adjustments and button positioning should be done in secure code. The vehiclemenubar is tied into the frame animation system pretty heavily, you will taint the living hell out of it if you do not use secure code. it WILL cause funny problems down the road. Like getting no buttons or bar at all when entering/exiting a vehicle. Even worse glitchs while in combat.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-29-10 at 08:43 AM.
  Reply With Quote
11-29-10, 08:27 AM   #16
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by maltese View Post
I actually did try doing that, but it didn't work either. It threw lots of errors. Seeing how I struggled for a couple days with this very issue on trying to find a way to hide the blizzard bars while still retaining their functionality to no avail, I ended up just moving the selected frame offscreen. I know its not pretty nor is it the ideal method, but it works remarkably well.

I'll hopefully have the vehicle exit button working sometime on tuesday. I wont have a chance to work on it today.
The way i posted is the best method and should work no problem.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-29-10, 08:46 AM   #17
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Oh and you should put this line at the top of your file... not that it really helps as much as one would hope.. it does help a lil with the tainting issues.

UIPARENT_MANAGED_FRAME_POSITIONS['VehicleMenuBar'] = nil

here is what my vehicle code looks like, all my code does is modify the graphics and scale as well as allow for positioning without AS much taint. You can see the 3 functions at the bottom, those seem to be the main controllers for bliz frames and buttons. If you hook your frame changes to it things should work just fine. Also note that the way it lays out the frames changes based on if it is a vehicle with angle/pitch button and meter or not. edit - The reason for this is because bliz reused texture names but not textures on the vehic bar so if you hide TextureblahblahblahA on the nonpitch it may be a different piece of the bar then TextureblahblahblahA on the pitch enabled vehic bar, but all having same frame and texture names.
lua Code:
  1. local addonName, addon = ...
  2.  
  3. UIPARENT_MANAGED_FRAME_POSITIONS['MultiBarBottomLeft'] = nil
  4. UIPARENT_MANAGED_FRAME_POSITIONS['MultiBarBottomRight'] = nil
  5. UIPARENT_MANAGED_FRAME_POSITIONS['MultiBarLeft'] = nil
  6. UIPARENT_MANAGED_FRAME_POSITIONS['MultiBarRight'] = nil
  7. UIPARENT_MANAGED_FRAME_POSITIONS['MultiCastActionBarFrame'] = nil
  8. UIPARENT_MANAGED_FRAME_POSITIONS['MULTICASTACTIONBAR_YPOS'] = nil
  9. UIPARENT_MANAGED_FRAME_POSITIONS['PetActionBar'] = nil
  10. UIPARENT_MANAGED_FRAME_POSITIONS['PETACTIONBAR_YPOS'] = nil
  11. UIPARENT_MANAGED_FRAME_POSITIONS['PossessBarFrame'] = nil
  12. UIPARENT_MANAGED_FRAME_POSITIONS['ShapeshiftBarFrame'] = nil
  13. UIPARENT_MANAGED_FRAME_POSITIONS['VehicleMenuBar'] = nil
  14. UIPARENT_MANAGED_FRAME_POSITIONS['ContainerFrame1'] = nil
  15. UIPARENT_MANAGED_FRAME_POSITIONS['ContainerFrame2'] = nil
  16. UIPARENT_MANAGED_FRAME_POSITIONS['ContainerFrame3'] = nil
  17. UIPARENT_MANAGED_FRAME_POSITIONS['ContainerFrame4'] = nil
  18. UIPARENT_MANAGED_FRAME_POSITIONS['ContainerFrame5'] = nil
  19. UIPARENT_MANAGED_FRAME_POSITIONS["CONTAINER_OFFSET_X"] = nil
  20. UIPARENT_MANAGED_FRAME_POSITIONS["CONTAINER_OFFSET_Y"] = nil
  21.  
  22. -- VehicleMenuBar
  23. --VehicleMenuBar:SetScale(0.84)
  24. function addon:VehicFrameSetup()
  25.     local vehicpitchShown = IsVehicleAimAngleAdjustable()
  26.     if vehicpitchShown == 1 then
  27.         VehicleMenuBar:SetScale(0.77)
  28.         VehicleMenuBarPowerBar:ClearAllPoints()
  29.         VehicleMenuBarPowerBar:SetPoint("CENTER", VehicleMenuBar, "CENTER", 235, 12)
  30.  
  31.        
  32.         VehicleMenuBarHealthBar:ClearAllPoints()
  33.         VehicleMenuBarHealthBar:SetPoint("CENTER", VehicleMenuBar, "CENTER", 170, 12)
  34.  
  35.        
  36.         VehicleMenuBarArtFrameBACKGROUND1:Hide()
  37.         VehicleMenuBarArtFrameBACKGROUND2:Hide()
  38.         VehicleMenuBarArtFrameBACKGROUND3:Hide()
  39.    
  40.    
  41.     else
  42.         VehicleMenuBar:SetScale(0.84)
  43.         VehicleMenuBarPowerBar:ClearAllPoints()
  44.         VehicleMenuBarPowerBar:SetPoint("CENTER", VehicleMenuBar, "CENTER", 165, 12)
  45.  
  46.  
  47.         VehicleMenuBarHealthBar:ClearAllPoints()
  48.         VehicleMenuBarHealthBar:SetPoint("CENTER", VehicleMenuBar, "CENTER", 100, 12)
  49.  
  50.        
  51.         VehicleMenuBarArtFrameBACKGROUND1:Show()
  52.         VehicleMenuBarArtFrameBACKGROUND2:Show()
  53.         VehicleMenuBarArtFrameBACKGROUND3:Show()
  54.    
  55.     end
  56. end
  57.  
  58.  
  59.  
  60. hooksecurefunc("UIParent_ManageFramePositions", function(self)
  61.     addon:SafeCall("VehicFrameSetup")
  62. end)
  63.  
  64. hooksecurefunc("UpdateUIPanelPositions", function(self)
  65.     addon:SafeCall("VehicFrameSetup")
  66. end)
  67.  
  68. hooksecurefunc("ValidateFramePosition", function(self)
  69.     addon:SafeCall("VehicFrameSetup")
  70. end)

This is my frame hider code, you can see a lot of vehiclemenubar frames listed. Note that you should not unregister any events for any of the vehic bar frames.
lua Code:
  1. local addonName, addon = ...
  2.  
  3. -- Frames to permanently hide:
  4. --      false = no need to unregister events
  5. --      true = unregister events (no point processing stuff we'll never see)
  6. local frames = {
  7.     --TargetFrame = false,
  8.     --TargetFrameToT = true,
  9.     ReputationWatchBar = true,
  10.     GameTimeFrame = true,
  11.     CastingBarFrameBorder = false,
  12.     TimeManagerClockButton = false,
  13.     ExhaustionTick = true,
  14.     MainMenuExpBar = true,
  15.     MainMenuBarArtFrame = false,
  16.     MainMenuBarMaxLevelBar = false,
  17.    
  18.     VehicleMenuBarArtFrameOVERLAY1 = false,
  19.     VehicleMenuBarArtFrameOVERLAY2 = false,
  20.     VehicleMenuBarArtFrameOVERLAY3 = false,
  21.     VehicleMenuBarArtFrameOVERLAY4 = false,
  22.    
  23.     --VehicleMenuBarArtFrameARTWORK1 = false,
  24.     --VehicleMenuBarArtFrameARTWORK2 = false,
  25.     --VehicleMenuBarArtFrameARTWORK3 = false,
  26.     --VehicleMenuBarArtFrameARTWORK4 = false,
  27.     --VehicleMenuBarArtFrameARTWORK5 = false,
  28.     --VehicleMenuBarArtFrameARTWORK6 = false,
  29.     --VehicleMenuBarArtFrameARTWORK7 = false,
  30.     --VehicleMenuBarArtFrameARTWORK8 = false,
  31.     --VehicleMenuBarArtFrameARTWORK9 = false,
  32.     --VehicleMenuBarArtFrameARTWORK10 = false,
  33.  
  34.     --VehicleMenuBarArtFrameBORDER1 = false,
  35.     --VehicleMenuBarArtFrameBORDER2 = false,
  36.     --VehicleMenuBarArtFrameBORDER3 = false,
  37.     --VehicleMenuBarArtFrameBORDER4 = false,
  38.     --VehicleMenuBarArtFrameBORDER5 = false,
  39.     --VehicleMenuBarArtFrameBORDER6 = false,
  40.     --VehicleMenuBarArtFrameBORDER7 = false,
  41.    
  42.     --VehicleMenuBarArtFrameBACKGROUND1 = false,
  43.     --VehicleMenuBarArtFrameBACKGROUND2 = false,
  44.     --VehicleMenuBarArtFrameBACKGROUND3 = false,
  45.  
  46.    
  47.     MiniMapMailFrame = true,
  48.     MinimapZoomIn = false,
  49.     MinimapZoomOut = false,
  50.     MinimapBackdrop = false,
  51.     MinimapZoneTextButton = false,
  52.     MinimapToggleButton = false,
  53.     MiniMapWorldMapButton = true,
  54.  
  55.     SmartBuff_MiniMapButton = false,
  56.     CritlineMinimapFrame = false,
  57.     TrinketMenu_IconFrame = false,
  58.     ItemRackMiniMapFrame = false,
  59.     MI3_MinimapButton = false,
  60.     FishingBuddyMinimapFrame = false,
  61.     AltoholicMinimapButton = false,
  62.     --MacaroonMinimapButton = false,
  63.     Gatherer_MinimapOptionsButton = false,
  64.     DBMMinimapButton = false,
  65.     LibDBIcon10_EasyDND = false,
  66.     LibDBIcon10_sRaidFrames = false,
  67.     WIM3MinimapButton = false,
  68.     LibDBIcon10_oRA2 = false,
  69.     LibDBIcon10_AutoBar = false,
  70.     LibDBIcon10_Broker_Auditor = false,
  71. --  LibDBIcon10_BugSack = false,
  72.     DHUDMinimapButton = false,
  73. }
  74.  
  75. -- Events that no longer need to be monitored:
  76. MainMenuBarArtFrame:UnregisterEvent('ACTIONBAR_PAGE_CHANGED')
  77.  
  78. --[[-----------------------------------------------------------------------------
  79. Initialize
  80. -------------------------------------------------------------------------------]]
  81. addon.RegisterEvent("HideFrames-Monitor", 'ADDON_LOADED', function(self, event)
  82.     for name, unregister in pairs(frames) do
  83.         local frame = _G[name]
  84.         if frame then
  85.             frames[name] = nil
  86.             addon:HideFrame(frame)
  87.             if unregister then
  88.                 frame:UnregisterAllEvents()
  89.                 frame:SetScript('OnEvent', nil)
  90.             end
  91.         end
  92.     end
  93.     if next(frames) then return end
  94.     addon.UnregisterEvent(self, event)
  95. end)

oh and i guess you need to see the core functions to or some of this may not make sense...
lua Code:
  1. local addonName, addon = ...
  2.  
  3. _G[addonName] = addon
  4.  
  5. local function DoNothing()
  6. end
  7. addon.DoNothing = DoNothing
  8.  
  9. --[[-----------------------------------------------------------------------------
  10. Event handling - Use one frame to process multiple individual OnEvent needs
  11. -------------------------------------------------------------------------------]]
  12. do
  13.     local frame, select, next, events = CreateFrame('Frame'), select, pairs({ })
  14.     local register, unregister = frame.RegisterEvent, frame.UnregisterEvent
  15.     frame:Hide()
  16.  
  17.     frame:SetScript('OnEvent', function(self, event, ...)
  18.         for reference, func in next, events[event], nil do
  19.             func(reference, event, ...)
  20.         end
  21.     end)
  22.  
  23.     function addon.RegisterEvent(reference, event, func)
  24.         if not events[event] then
  25.             events[event] = { }
  26.             register(frame, event)
  27.         end
  28.         events[event][reference] = func
  29.     end
  30.  
  31.     function addon.RegisterEvents(reference, func, ...)
  32.         local event
  33.         for index = 1, select('#', ...) do
  34.             event = select(index, ...)
  35.             if not events[event] then
  36.                 events[event] = { }
  37.                 register(frame, event)
  38.             end
  39.             events[event][reference] = func
  40.         end
  41.     end
  42.  
  43.     function addon.UnregisterEvent(reference, event)
  44.         if events[event] then
  45.             events[event][reference] = nil
  46.             if not next(events[event]) then
  47.                 events[event] = nil
  48.                 unregister(frame, event)
  49.             end
  50.         end
  51.     end
  52.  
  53.     function addon.UnregisterAllEvents(reference)
  54.         for event, registry in next, events, nil do
  55.             registry[reference] = nil
  56.             if not next(registry) then
  57.                 events[event] = nil
  58.                 unregister(frame, event)
  59.             end
  60.         end
  61.     end
  62. end
  63.  
  64. --[[-----------------------------------------------------------------------------
  65. SafeCall - Queue a method of addon to run once combat ends if needed
  66. -------------------------------------------------------------------------------]]
  67. do
  68.     local combatLockdown, queue = InCombatLockdown(), { }
  69.  
  70.     addon.RegisterEvent("Core-SafeCall-EnterCombat", 'PLAYER_REGEN_DISABLED', function(self)
  71.         combatLockdown = true
  72.     end)
  73.  
  74.     addon.RegisterEvent("Core-SafeCall-LeaveCombat", 'PLAYER_REGEN_ENABLED', function(self)
  75.         combatLockdown = nil
  76.         for method, arg in pairs(queue) do
  77.             addon[method](addon, arg)
  78.             queue[method] = nil
  79.         end
  80.     end)
  81.  
  82.     function addon:SafeCall(method, arg)
  83.         if combatLockdown then
  84.             queue[method] = arg or false
  85.         else
  86.             addon[method](addon, arg)
  87.         end
  88.     end
  89. end
  90.  
  91. --[[-----------------------------------------------------------------------------
  92. Localized class name to file class name look up table
  93. -------------------------------------------------------------------------------]]
  94. local CLASS = { }
  95. for fileName, localName in pairs(LOCALIZED_CLASS_NAMES_MALE) do
  96.     CLASS[localName] = fileName
  97. end
  98. for fileName, localName in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
  99.     CLASS[localName] = fileName
  100. end
  101. addon.CLASS = CLASS
  102.  
  103. --[[-----------------------------------------------------------------------------
  104. MoneyToString - Get formatted text from an ammount of copper
  105. -------------------------------------------------------------------------------]]
  106. function addon:MoneyToString(ammount, forceIcons)
  107.     local cu = ammount % 100
  108.     ammount = floor(ammount / 100)
  109.     local ag, au = ammount % 100, floor(ammount / 100)
  110.     local cuInd, agInd, auInd
  111.     if GetCVarBool('showChatIcons') or forceIcons then
  112.         cuInd = [[|TInterface\MoneyFrame\UI-CopperIcon:0|t]]
  113.         agInd = [[|TInterface\MoneyFrame\UI-SilverIcon:0|t ]]
  114.         auInd = [[|TInterface\MoneyFrame\UI-GoldIcon:0|t ]]
  115.     else
  116.         cuInd = "|cffeda55fc|r"
  117.         agInd = "|cffc7c7cfs|r "
  118.         auInd = "|cffffd700g|r "
  119.     end
  120.     local string = ""
  121.     if au > 0 then
  122.         string = au .. auInd .. ag .. agInd
  123.     elseif ag > 0 then
  124.         string = ag .. agInd
  125.     end
  126.     return string .. cu .. cuInd
  127. end
  128.  
  129. --[[-----------------------------------------------------------------------------
  130. HideTooltip - Hide GameTooltip (several frames use this)
  131. -------------------------------------------------------------------------------]]
  132. function addon:HideTooltip()
  133.     GameTooltip:Hide()
  134.     self.tooltip = nil
  135. end
  136.  
  137. --[[-----------------------------------------------------------------------------
  138. HideFrame - Hide a frame, prevents it from being reshown
  139. -------------------------------------------------------------------------------]]
  140. function addon:HideFrame(reference)
  141.     local frame = type(reference) == 'string' and _G[reference] or reference
  142.     if type(frame) ~= 'table' then return end
  143.     frame.Show = DoNothing
  144.     frame:Hide()
  145. end
  146.  
  147. --[[-----------------------------------------------------------------------------
  148. ShowFrame - Show a frame, undoing :HideFrame behavior
  149. -------------------------------------------------------------------------------]]
  150. function addon:ShowFrame(reference)
  151.     local frame = type(reference) == 'string' and _G[reference] or reference
  152.     if type(frame) ~= 'table' then return end
  153.     frame.Show = nil
  154.     frame:Show()
  155. end
  156.  
  157. --[[-----------------------------------------------------------------------------
  158. LockFrame - Lock a frame, prevents SetPoint and ClearAllPoints from working
  159. -------------------------------------------------------------------------------]]
  160. function addon:LockFrame(reference)
  161.     local frame = type(reference) == 'string' and _G[reference] or reference
  162.     if type(frame) ~= 'table' then return end
  163.     frame.SetPoint = DoNothing
  164.     frame.ClearAllPoints = DoNothing
  165. end
  166.  
  167. --[[-----------------------------------------------------------------------------
  168. UnlockFrame - Undo :LockFrame
  169. -------------------------------------------------------------------------------]]
  170. function addon:UnlockFrame(reference)
  171.     local frame = type(reference) == 'string' and _G[reference] or reference
  172.     if type(frame) ~= 'table' then return end
  173.     frame.SetPoint = nil
  174.     frame.ClearAllPoints = nil
  175. end
  176.  
  177. --[[-----------------------------------------------------------------------------
  178. RunSlashCmd
  179. -------------------------------------------------------------------------------]]
  180. function addon:RunSlashCmd(cmd)
  181.     local slash, rest = cmd:match("^(%S+)%s*(.-)$")
  182.     for name, func in pairs(SlashCmdList) do
  183.         local i, slashCmd = 1
  184.         repeat
  185.             slashCmd = _G['SLASH_' .. name .. i]
  186.             if slashCmd == slash then
  187.                 func(rest)
  188.                 return true
  189.             end
  190.             i = i + 1
  191.         until not slashCmd
  192.     end
  193. end
  194.  
  195. --[[-----------------------------------------------------------------------------
  196. Delay a function
  197. -------------------------------------------------------------------------------]]
  198. local waitTable = {};
  199. local waitFrame = nil;
  200. function addon:FuncDelay(delay, func, ...)
  201.   if(type(delay)~="number" or type(func)~="function") then
  202.     return false;
  203.   end
  204.   if(waitFrame == nil) then
  205.     waitFrame = CreateFrame("Frame","WaitFrame", UIParent);
  206.     waitFrame:SetScript("onUpdate",function (self,elapse)
  207.       local count = #waitTable;
  208.       local i = 1;
  209.       while(i<=count) do
  210.         local waitRecord = tremove(waitTable,i);
  211.         local d = tremove(waitRecord,1);
  212.         local f = tremove(waitRecord,1);
  213.         local p = tremove(waitRecord,1);
  214.         if(d>elapse) then
  215.           tinsert(waitTable,i,{d-elapse,f,p});
  216.           i = i + 1;
  217.         else
  218.           count = count - 1;
  219.           f(unpack(p));
  220.         end
  221.       end
  222.     end);
  223.   end
  224.   tinsert(waitTable,{delay,func,{...}});
  225.   return true;
  226. end
  227.  
  228. --[[-----------------------------------------------------------------------------
  229. Blizzard Build comparisonn for ptr/beta/live compatible versions
  230. -------------------------------------------------------------------------------]]
  231. function addon:CompareBuild(comver, combuild, comref, lowcomref, highcomref)
  232.     local version, build, bdate, toc = GetBuildInfo()
  233.     if version > comver and build > combuild then
  234.         addon[highcomref]()
  235.     elseif version < comver and build < combuild then
  236.         addon[lowcomref]()
  237.     elseif version == comver and build == combuild then
  238.         addon[comref]()
  239.     end
  240. end
  241.  
  242. --[[-----------------------------------------------------------------------------
  243. LibSharedMedia support
  244. -------------------------------------------------------------------------------]]
  245. local LSM = LibStub('LibSharedMedia-3.0')
  246.  
  247. LSM:Register('background', addonName, [[Interface\Addons\]] .. addonName .. [[\Media\MainBG]])
  248.  
  249. LSM:Register('font', "Franklin Gothing Medium", [[Interface\Addons\]] .. addonName .. [[\Media\Font1.ttf]])
  250. LSM:Register('font', "Comic Sans MS", [[Interface\Addons\]] .. addonName .. [[\Media\Font3.ttf]])
  251.  
  252. --[[-----------------------------------------------------------------------------
  253. Extra Key Binding Data
  254. -------------------------------------------------------------------------------]]
  255.  
  256. BINDING_HEADER_GRIMUI = "-- GrimUI --"
  257. BINDING_HEADER_RAID_MOUSEOVER = "Raid Targeting (Mouseover)"
  258.  
  259.  
  260. --[[-----------------------------------------------------------------------------
  261. Localization support. AceLocale
  262. -------------------------------------------------------------------------------]]
  263. local AceLocale = LibStub("AceLocale-3.0")
  264. local L = AceLocale:GetLocale( "GrimUI", true )
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-29-10 at 03:34 PM.
  Reply With Quote
11-30-10, 07:52 AM   #18
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Originally Posted by Grimsin View Post
The way i posted is the best method and should work no problem.
Aye, what you posted did infact hide the borders on entering a vehicle but the issue arises when you actually use the ability. The border for that ability pops back instantly. I'm looking at the code you posted for secure headers. I should have the vehicle exit button implemented today.

As for taint issues, you'll have to excuse my newbness here. My knowledge of lua is extremely limited and I've learned mostly everything from looking at code over the years and researching wowwiki's API pages. I've done some searches on the topic of taint and turned up discussion about moving actionbars when in combat. I do know that with some of the first iterations of the code I tried I did run into a LOT of errors when getting into a vehicle in combat with wow giving the error "Interface action failed because of an Addon". I'm assuming thats what you are referring to.

I worked around that by moving all the positioning code around to move the frames during the PLAYER_ENTERING_WORLD event and haven't that issue since, even when entering a vehicle in combat. I'm just setting the Alpha to 0 when you are not actually in a vehicle and since the vehicle bar isn't there anyway, you wont have issues with buttons being invisible but click able.

Now if you are saying that taint is still occurring even though I'm not moving anything in combat, then I guess this entire addon would have to be rewritten using secure code, which I guess I could do but I'll have to read up on the subject. Furthermore I think the only time there would actually be an issue is if you DC'd in the middle of a boss fight that required vehicles and logging back in would break the functionality of the mod (since I move everything at login).

I guess its time to look at your code and read up to see if its actually something I can fix.

EDIT: On reflection of the very sort period of time I worked on adding the vehicle exit button the other night I noticed that the button was displayed correctly but was not clickable at all. I realize now a couple things:

1: I'm fairly certain that the vehicle action bar that I'm displaying isn't clickable either. I didn't test that because I used keybindings to test to see if the cooldown frame was working.
2: All this addon is doing (I think) is moving the graphics of the buttons to the defined anchor and not the actual button itself.
3: This explains why I'm not getting the errors anymore when getting into and out of combat (since I'm not moving the buttons themselves)
4: If I wanted the actual buttons moved I'd have to completely rewrite the addon to use secure functions like you suggested.
5: The taint issue you are talking about is going to affect my other addon as well (I think its limited to DCing and relogging in combat, but what do I know )
6: All of the clicking issues could be the taint you are describing and I just have no clue what I'm talking about (likely)
7: I'm a piss poor coder

I'll try to test this today and figure out what exactly is going on and see if its an easy fix. If not then I'm tempted to just leave it as is with the understanding that this addon is just for the graphical display of the vehicle bar for reference and know that it will not fit the needs of 99.9999% of people that use addons. Minus the unconfirmed issues with errors on reloading in combat it fits all the needs I have for it and I'm really just not good enough of a coder to provide full feature addons like the pros here.

Last edited by maltese : 11-30-10 at 08:26 AM.
  Reply With Quote
11-30-10, 10:41 AM   #19
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Taint sucks lemme tell ya. what taint is, hmm well basically its a small error that happens any time you move or do anything tied into any part of the secure bliz code.? It is most noticeable when it comes to combat but it does happen at other times. Often times taint is not a big deal, like moving simple frames and such. When it becomes a bigger deal though is when it comes to action buttons. Or adjusting frames tied into the animation system like the pet bar, stance change bars, and the vehicle bar most notably.

The thing about most taint is you can ignore it. When its really a problem is when it actually pops that msg about action blocked. Then it stops game play and something definitely did not work. If you turn taint logging off which i think by default it is off then most taint will never be an issue.

As far as when you do the layout, so the frame is not movable once the game loads? Want to post your code? ill take a look, i know a little bit about secure code. With my code the bar is movable via my frame moving system and the buttons are still click-able. Biggest glitches i have is getting in and out of vehicles while in combat. I jump out of siege a lot to deal with people chasing me. .. My code does not use secure code just secure function hooks, the buttons do not have to have secure code to be moved... although secure code is better lol.

It might be easiest to modify the bliz frame like i was rather then rebuild one. At the same time if you rebuild the frame all together and use some secure code for the buttons you would get away from all the taint issues.

Here are some secure chunks out of GrimUI.

This is a secure method to toggle the backpack so it does not taint when using the inventory in combat.
lua Code:
  1. backpackButton:SetAttribute('_onclick', [[
  2.     if button == 'LeftButton' then
  3.         control:CallMethod("ToggleBags")
  4.     else
  5.         local bagBar = self:GetFrameRef("bagBar")
  6.         if bagBar:IsVisible() then
  7.             bagBar:Hide()
  8.         else
  9.             bagBar:Show()
  10.         end
  11.     end
  12. ]])

this chunk here toggles the combatlog on/off as well as a bank of buttons.
lua Code:
  1. local hotSpot = CreateFrame('Button', nil, UIParent, 'SecureHandlerClickTemplate')
  2. hotSpot:SetPoint('BOTTOMRIGHT', -370, 220)
  3. hotSpot:SetHeight(15)
  4. hotSpot:SetWidth(15)
  5.  
  6. hotSpot:SetFrameRef("contextMenu", contextMenu)
  7. hotSpot:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
  8. hotSpot:SetAttribute('_onclick', [[
  9.     local frame = self:GetFrameRef("contextMenu")
  10.     if button == 'LeftButton' then
  11.         if frame:IsVisible() then
  12.             frame:Hide(true)
  13.         else
  14.             frame:Show(true)
  15.         end
  16.     elseif button == 'RightButton' then
  17.         control:CallMethod("ToggleCombatLog")
  18.     end
  19. ]])
  20.  
  21.  hotSpot:SetScript('OnEnter', function(self)
  22.     GameTooltip:SetOwner(self, 'ANCHOR_TOP', 0, 1)
  23.     GameTooltip:AddLine("|cffeda55fLeft Click|r for ContextMenu", 0.2, 1, 0.2)
  24.     GameTooltip:AddLine("|cffeda55fRight Click|r toggle CombatLog", 0.2, 1, 0.2)
  25.     GameTooltip:Show()
  26. end)
  27.  
  28. hotSpot:SetScript('OnLeave', addon.HideTooltip)
  29.  
  30. function hotSpot:ToggleCombatLog()
  31.     addon.settings.showCombatLog = not addon.settings.showCombatLog
  32.     addon:ConfigureCombatLog()
  33. end

this is the button creation you either are dealing with button id 121-132 or they made something else for vehics but i think it is the same buttons for posses so... if you try to remake the buttons i would go with id 121-132
This is the chunk that was originaly from Giest although heavily modified now.
Notice it is not really secure code just the option to show hide it needed to be to avoid in combat problems.

lua Code:
  1. --[[-----------------------------------------------------------------------------
  2. This is used to set the default button ids . These buttons do not conflict with
  3. known stance/form/stealth bars.  These settings are not ideal, but are the best
  4. compromise I could come up with short of writing virtual action buttons.
  5.  
  6. Default Blizzard IDs:
  7. 1-12        Main Bar (Unused by Warriors)
  8. 13-24       Second Bar
  9. 25-36       Side Bar 1
  10. 37-48       Side Bar 2
  11. 49-60       Bottom Right Bar
  12. 61-72       Bottom Left Bar
  13. 73-84       Warrior Battle, Druid Cat, Rogue Stealth, Priest Shadowform
  14. 85-96       Warrior Defensive, Druid Tree
  15. 97-108  Warrior Berserker, Druid Bear
  16. 109-120 Druid Moonkin
  17. 121-132 Possess Bar (Unusable)
  18. -------------------------------------------------------------------------------]]
  19. local actionID, class = UnitClass('player')
  20.  
  21. if class == 'DRUID' then
  22.     actionID = {
  23.         48, --01
  24.         49, --02
  25.         50, --03
  26.         51, --04
  27.         52, --05
  28.         53, --06
  29.         54, --07
  30.         55, --08
  31.         56, --09
  32.         57, --10
  33.         58, --11
  34.         59, --12
  35.         60, --13
  36.         61, --14
  37.         62, --15
  38.         63, --16
  39.         64, --17
  40.         65, --18
  41.         66, --19
  42.         67, --20
  43.         68, --21
  44.         69, --22
  45.         70, --23
  46.         71, --24
  47.         72  --25
  48.     }
  49. elseif class == 'WARRIOR' then
  50.     actionID = {
  51.         1, --01
  52.         2, --02
  53.         3, --03
  54.         4, --04
  55.         5, --05
  56.         6, --06
  57.         7, --07
  58.         8, --08
  59.         9, --09
  60.         10, --10
  61.         11, --11
  62.         12, --12
  63.         72, --13, Pesky warriors.
  64.         109, --14
  65.         110, --15
  66.         111, --16
  67.         112, --17
  68.         113, --18
  69.         114, --19
  70.         115, --20
  71.         116, --21
  72.         117, --22
  73.         118, --23
  74.         119, --24
  75.         120  --25
  76.     }
  77. else
  78.     actionID = {
  79.         96, --01
  80.         97, --02
  81.         98, --03
  82.         99, --04
  83.         100, --05
  84.         101, --06
  85.         102, --07
  86.         103, --08
  87.         104, --09
  88.         105, --10
  89.         106, --11
  90.         107, --12
  91.         108, --13
  92.         109, --14
  93.         110, --15
  94.         111, --16
  95.         112, --17
  96.         113, --18
  97.         114, --19
  98.         115, --20
  99.         116, --21
  100.         117, --22
  101.         118, --23
  102.         119, --24
  103.         120  --25
  104.     }
  105. end
  106.  
  107. local contextMenu = CreateFrame('Frame', nil, UIParent, 'SecureFrameTemplate')
  108. contextMenu:SetPoint('RIGHT', UIParent, 'RIGHT', -280, -120)
  109.  
  110. local buttons = { }
  111. for index = 1, #actionID do
  112.     local button = CreateFrame('CheckButton', addonName .. "ContextMenuButton" .. index, contextMenu, 'ActionBarButtonTemplate')
  113.     buttons[index] = button
  114.     if (index - 1) % 5 ~= 0 then
  115.         button:SetPoint('LEFT', buttons[index - 1], 'RIGHT', 2, 0)
  116.     elseif index ~= 1 then
  117.         button:SetPoint('TOPLEFT', buttons[index - 5], 'BOTTOMLEFT', 0, -2)
  118.     else
  119.         button:SetPoint('TOPLEFT')
  120.     end
  121.     button:SetAttribute('type', 'action')
  122.     button:SetAttribute('action', actionID[index])
  123. end
  124.  
  125. contextMenu:SetHeight(buttons[1]:GetHeight() * 5 + 8)
  126. contextMenu:SetWidth(buttons[1]:GetWidth() * 5 + 8)
  127. contextMenu:SetScale(0.8)
  128.  
  129. local texture = contextMenu:CreateTexture(nil, 'ARTWORK')
  130. texture:SetTexture([[Interface\DialogFrame\UI-DialogBox-Background]])
  131. texture:SetVertexColor(1, 1, 1, 0.5)
  132. texture:SetPoint('CENTER')
  133. texture:SetWidth(36)
  134. texture:SetHeight(36)
  135.  
  136. local title = contextMenu:CreateFontString(nil, 'OVERLAY')
  137. title:SetFont([[Fonts\FRIZQT__.TTF]], 12, 'OVERLAY')
  138. title:SetTextColor(1, 1, 0, 0.8)
  139. title:SetPoint('TOP', texture, 'TOP', 0, -1)
  140. title:SetText('GCM')
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-30-10, 10:46 AM   #20
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Oh also might wanna take a look at some of the other actionbar addons that have something that deals with the vehicle bar like macaroon has a vehicle bar replacement but all it replaces is the action buttons it does not deal with the health/power stuff. It does deal with the leave button as well as pitch buttons. His code is pretty complex though hehe ive looked a few times and get overwhelmed real quick.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hiding Actionbutton borders?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off