This is what I use to black out everything I can't mail when I open the mailbox..
Lua Code:
local tip = CreateFrame('GameTooltip', 'MailBagScantip', nil, 'GameTooltipTemplate')
hooksecurefunc('ContainerFrame_Update', function(frame)
local name, bag = frame:GetName(), frame:GetID()
for j = 1, frame.size do
local itemButton = _G[name .. 'Item' .. j]
local slot = itemButton:GetID()
tip:SetOwner(UIParent,'ANCHOR_NONE')
tip:SetBagItem(bag, slot)
if SendMailFrame:IsVisible() then
for t = 1, tip:NumLines() do
local str = _G['MailBagScantipTextLeft' .. t]
if str and (str:GetText() == ITEM_SOULBOUND or str:GetText() == ITEM_BIND_QUEST) then
itemButton.searchOverlay:Show()
break
end
end
--else
-- itemButton.searchOverlay:Hide() -- execute this somewhere else when the mailframe closes
end
end
end)
This is for the default interface but you can probably adapt it for whatever.