Thread Tools Display Modes
08-09-13, 05:34 PM   #61
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Ok I found the way to fix the problem of combat log:

The problem was, that I need hide the tabs with the chatter cause I am using Kgpanels, and when I use that option, the filter of Combat log hide too, so... I need a way that leave me see the filter of combat log, and dont see the tabs of Chatter.

Just with NibChatTab!!, I need change the max (or min) values of "x" or "y" in Config.lua file, a value enought to put the tabs out of the screen, (regular tabs, and combat log tab).


Code:
type = "range",
name = "Y Offset",
min = -10, max = 10, step = 0.5.
Change this for this values example:

Code:
type = "range",
name = "Y Offset",
min = -1000, max = 1000, step = 0.5,
And on ingame config of the addon use the xxxxxx value of min or max.... Now the tabs are in Mordor, but the filter of combat log be in the chat.

Results:




-------------------------------------------------

Now I have some questions, could help me with this?.

¿Its possible, change the color´s text of a panel, when a new private message (Wisp/ real ID, BattleTag...) received on a ChatFrame?.

What I want do: When a FrameChat receive a new private message, and this tab dont be the active tab, the color of the text change to yellow.

One more question.

How can I do for change the text´s font size of a tootltip?

The panel use font size (12), and the tootltip use it too 12, I need a font a bit smoller for the tooltip 10 or less

I use that code for the tootltip.

GameTooltip:SetOwner(self)
GameTooltip_AddNewbieTip(self, "|cffffcc00 Click|r to show the map", 1.0, 1.0, 1.0, "")
GameTooltip:Show()

GameTooltip:SetAnchorType("ANCHOR_BOTTOM", 0, 1);
I think maybe this is hard to do.... I need your help!

Thanks!!!

Last edited by Akatosh : 08-10-13 at 01:36 AM.
  Reply With Quote
08-13-13, 11:48 PM   #62
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Exclamation

Bump!!

I found a little error on the code of zone text.

http://www.wowinterface.com/forums/s...5&postcount=32

Allways appear a coma at the end, because:

OnEvent (old)

Code:
.....
Be the same here
.....
if sub == zone then
be allways true when the return of the zone be "" (or nothing).

For example Dalaran or Orgrimar.

So it go to the "else" part allways and appear the coma.

with that works now ok:

OnUpdate (now)

Code:
.....
Be the same here
.....

local zone, sub = GetZoneText(), GetSubZoneText()
if sub ==  "" or sub == zone then
self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
self.text:SetText(string.format("|cff%s%s, %s|r", col, zone, sub))
end

Please, I need help with that, I dont have idea how can I do it:


¿Its possible, change the color´s text of a panel, when a new private message (Wisp/ real ID, BattleTag...) received on a ChatFrame?.

For example I receive a new private message, and the tab (no active tab), change the color of the text to yellow.

One more question.

How can I do for change the text´s font size of a tootltip?

I use a panel with font size (12), and the tootltip use 12 too, I need a font a bit smaller for the tooltip 10 or less.

I use that code for the tootltip.

Code:
GameTooltip:SetOwner(self)
GameTooltip_AddNewbieTip(self, "|cffffcc00 Click|r to show the map", 1.0, 1.0, 1.0, "")
GameTooltip:Show()

GameTooltip:SetAnchorType("ANCHOR_BOTTOM", 0, 1);

Thanks!!!

Last edited by Akatosh : 08-14-13 at 03:08 AM.
  Reply With Quote
08-14-13, 12:16 PM   #63
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Akatosh View Post
OnUpdate (now)
Don't use OnUpdate for this. Events fire when your zone changes. That's why this code was in your OnEvent section. You don't need your code to ask 45 (or more or less) times EVERY SECOND where your character is.

¿Its possible, change the color´s text of a panel, when a new private message (Wisp/ real ID, BattleTag...) received on a ChatFrame?.

For example I receive a new private message, and the tab (no active tab), change the color of the text to yellow.
Of course. You receive an event for this, too. For example, CHAT_MSG_WHISPER. Register for this event. When it fires, change the color. Then when your text is clicked (to switch to that chat frame) you can change the color back.

One more question.

How can I do for change the text´s font size of a tootltip?

I use a panel with font size (12), and the tootltip use 12 too, I need a font a bit smaller for the tooltip 10 or less.
You're using the GameTooltip. This is the main tooltip for your whole UI. If you want to change the size of the text in your tooltip, you can get a tooltip addon that has this feature. (My addon TipTop does this, for example.)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-14-13, 02:56 PM   #64
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Thanks for your help, but I got nothing clear, I need just a bit more of help...

Is possible make a custom tooltip for each panel in the kgpanels?. (An example if be posble pls!).

(¿Can be posible adjust the padding of each side?).

Can you pls use (CHAT_MSG_WHISPER) in one example pls!!, I dont have idea how to use it.

I change the OnUpdate(old) code of zone for OnEvent Zone (now), I add this lines to OnLoad section:

Code:
.....
The same
......
self:RegisterEvent("WORLD_MAP_UPDATE")
self:RegisterEvent("ZONE_CHANGED")
Now works ok, now only need the part of the tooltip for leave it perfect.

Thanks.

Last edited by Akatosh : 08-14-13 at 03:22 PM.
  Reply With Quote
10-26-13, 04:12 AM   #65
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Hi again.

I Found a posible way to do it, when I recieve a new whisper the text of the panel change the color, and only when the tab, dont be the active tab, in this moment.

I try that with no results....

I make a recap:

I have 3 Tabs, do it with Kgpanels, "General", "Log", And "Trash".

The code that I am using on Tab "General", is that:

OnLoad:

Code:
self:RegisterEvent("CHAT_MSG_WHISPER")

local font,size = self.text:GetFont()
    self.text:SetFont(font,size,"OUTLINE")
    self.text:SetJustifyH("CENTER")
    self.text:SetJustifyV("CENTER")
     
    self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
    self.frame = "ChatFrame1"

OnUpdate:

Code:
local myName = UnitName("player")

if _G[self.frame]:IsShown() or self.entered then
        self.text:SetTextColor(1,1,1)
else

if event == "CHAT_MSG_WHISPER" and sender == myName and not ChatFrame1:IsVisible() then

self.text:SetTextColor(0,1,1)
end

self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
end
OnEnter:

Code:
self.entered = true
OnLeave:

Code:
self.entered = false
So I click in the tab 2 (aka "log"), and whiper myself, and nothing happens the text color dont change.

Anyone know how can I do it?.

Thanks!!
  Reply With Quote
11-04-13, 10:12 AM   #66
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Ok thanks to Phanx for give me a solution of that, the code now is:

http://www.wowinterface.com/forums/s...636#post286636

OnLoad:

Code:
local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")
     
self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
self.frame = "ChatFrame1"

self:RegisterEvent("CHAT_MSG_WHISPER")
self:RegisterEvent("CHAT_MSG_BN_WHISPER")
self:RegisterEvent("CHAT_MSG_SYSTEM")
self:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE")
self:RegisterEvent("BN_FRIEND_ACCOUNT_OFFLINE")
OnEvent:

Code:
if event == "CHAT_MSG_WHISPER"  then
    self.whisper = true
end

if event == "CHAT_MSG_BN_WHISPER" then
    self.real = true
end

if event == "BN_FRIEND_ACCOUNT_ONLINE" or "BN_FRIEND_ACCOUNT_OFFLINE"  then
    self.news = true
end

if event == "CHAT_MSG_SYSTEM" then

   local ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.-)"):gsub("[%[%]]", "%%%1")
   local OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.-)")

   local function IsFriend(name)
       for i = 1, GetNumFriends() do
           if GetFriendInfo(i) == name then
               return true
           end
       end
   end

   ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(frame, event, message)
       local action = "OFFLINE"
       local _, name = strmatch(message, ONLINE)
       if name then
           action = "ONLINE"
       else
           name = strmatch(message, OFFLINE)
       end
       if not name then
           return
       end
       if action == "ONLINE" then
           if IsFriend(name) then
                  self.news = true
           end
       elseif action == "OFFLINE" then
           if IsFriend(name) then
                  self.news = true
           end
       end
   end)
end
OnUpdate:

Code:
if ChatFrame1:IsVisible() then
self.whisper = false
self.real = false
self.news = false

end

if _G[self.frame]:IsShown() or self.entered then
        self.text:SetTextColor(1,1,1)
    else

if self.whisper then

self.text:SetTextColor(1,0.50,1)

elseif self.real then

self.text:SetTextColor(0, 0.69, 0.94)

elseif self.news then

self.text:SetTextColor(1, 1, 0)

else

        self.text:SetTextColor(self.color.r,self.color.g,self.color.b)

    end

end
OnEnter:

Code:
self.entered = true
OnLeave:
Code:
self.entered = false
OnClick:

Code:
FCF_Tab_OnClick(_G[self.frame.."Tab"],button)

self.whisper = false
self.real = false
self.news = false

Last edited by Akatosh : 11-04-13 at 10:46 AM.
  Reply With Quote
11-05-13, 05:48 AM   #67
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Don't do this:
Code:
if event == "CHAT_MSG_SYSTEM" then

   local ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.-)"):gsub("[%[%]]", "%%%1")
   local OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.-)")

   local function IsFriend(name)
       for i = 1, GetNumFriends() do
           if GetFriendInfo(i) == name then
               return true
           end
       end
   end

   ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(frame, event, message)
       local action = "OFFLINE"
       local _, name = strmatch(message, ONLINE)
       if name then
           action = "ONLINE"
       else
           name = strmatch(message, OFFLINE)
       end
       if not name then
           return
       end
       if action == "ONLINE" then
           if IsFriend(name) then
                  self.news = true
           end
       elseif action == "OFFLINE" then
           if IsFriend(name) then
                  self.news = true
           end
       end
   end)
There, you are performing 4 extra calls to gsub, creating 2 functions, and registering a duplicate chat filter every time any system message occurs. If you want to use events instead of chat filters, just use events, and define static (unchanging) stuff just once, in your OnLoad:

OnLoad:
Code:
self.STRING_ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.-)"):gsub("[%[%]]", "%%%1")
self.STRING_OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.-)")

function self.IsFriend(name)
	for i = 1, GetNumFriends() do
		if GetFriendInfo(i) == name then
		return true
		end
	end
end
OnEvent:
Code:
if event == "CHAT_MSG_SYSTEM" then
	local action = "OFFLINE"
	local _, name = strmatch(message, self.STRING_ONLINE)
	if name then
		action = "ONLINE"
	else
		name = strmatch(message, self.STRING_OFFLINE)
	end
	if not name then
		return
	end
	if action == "ONLINE" then
		if self.IsFriend(name) then
			self.news = true
		end
	elseif action == "OFFLINE" then
		if self.IsFriend(name) then
			self.news = true
		end
	end
Also, you should be using if X then ... elseif Y then ... elseif Z then ... end instead of if X then ... end if Y then ... end if Z then ... end in your event handler, since X Y and Z are mutually exclusive -- if it's one, then it can't be any of the others -- so it's wasteful to check them all anyway.

Finally, you can simplify your CHAT_MSG_SYSTEM handler a lot if you don't actually care what happened, only that something happened:
Code:
if event == "CHAT_MSG_SYSTEM" then
	local _, name = strmatch(message, self.STRING_ONLINE)
	name = name or strmatch(message, self.STRING_OFFLINE)
	self.news = name and self.IsFriend(name)
Edit:
Also, instead of assigning self.frame to the string "ChatFrame1" and then looking that up in _G to get a reference to the frame ChatFrame1, just assign self.frame to ChatFrame1 (no quotes) in the first place and save yourself the global table lookup.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-05-13, 10:42 AM   #68
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Sorry Phanx, I am trying my best but I dont understand nothing.

Only I have 3 tabs.

I follow my intuition and I change the code as I can, but I think that I do it wrong, so ¿Can you pls Check that code, and tell me how can I do it?.

now self.news fires allways, in all yellow msg like "you are AUS / dnd etc etc".

OnLoad:

Code:
local font,size = self.text:GetFont()
    self.text:SetFont(font,size,"OUTLINE")
    self.text:SetJustifyH("CENTER")
    self.text:SetJustifyV("CENTER")
     
    self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
    self.frame = ChatFrame1

self:SetBackdropBorderColor(0, 0 , 0, 0)
self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1,0.25, 0.25, 0.25, 1)

self:RegisterEvent("CHAT_MSG_WHISPER")
self:RegisterEvent("CHAT_MSG_BN_WHISPER")
self:RegisterEvent("CHAT_MSG_SYSTEM")
self:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE")
self:RegisterEvent("BN_FRIEND_ACCOUNT_OFFLINE")

self.STRING_ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.-)"):gsub("[%[%]]", "%%%1")
self.STRING_OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.-)")

function self.IsFriend(name)
    for i = 1, GetNumFriends() do
        if GetFriendInfo(i) == name then
        return true
        end
    end
end
OnEvent:

Code:
if event == "CHAT_MSG_WHISPER"  then
   self.whisper = true

elseif event == "CHAT_MSG_BN_WHISPER" then
   self.real = true

elseif event == "BN_FRIEND_ACCOUNT_ONLINE" or "BN_FRIEND_ACCOUNT_OFFLINE"  then
   self.news = true

elseif event == "CHAT_MSG_SYSTEM" then
    local _, name = strmatch(message, self.STRING_ONLINE)
    name = name or strmatch(message, self.STRING_OFFLINE)
    self.news = name and self.IsFriend(name)

end
OnUpdate:

Code:
if self.frame:IsVisible() then
   self.whisper = false
   self.real = false
   self.news = false
end

if self.frame:IsShown() or self.entered then
   self.text:SetTextColor(1,1,1)
else

if self.whisper then
    self.text:SetTextColor(1,0.50,1)
    self.bg:SetGradientAlpha("VERTICAL", 0.8, 0.2, 0.8, 0.7, 0.25, 0.25, 0.25, 1)

elseif self.real then
   self.text:SetTextColor(0, 0.69, 0.94)
   self.bg:SetGradientAlpha("VERTICAL", 0, 0.5, 0.96, 1, 0.25, 0.25, 0.25, 1)

elseif self.news then
   self.text:SetTextColor(1, 1, 0)
   self.bg:SetGradientAlpha("VERTICAL", 0.6, 0.6, 0, 1, 0.25, 0.25, 0.25, 1)

else
   self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
   end
end
OnEnter:

Code:
self.entered = true
OnLeave:

Code:
self.entered = false
OnClick:

Code:
self.frame:Show()
ChatFrame2:Hide()
ChatFrame3:Hide()

local tab2 = kgPanels:FetchFrame("ChatTab_Log")  
local tab3 = kgPanels:FetchFrame("ChatTab_Other")

self:SetBackdropBorderColor(0, 0 , 0, 0)
tab2:SetBackdropBorderColor(0, 0 , 0, 1)
tab3:SetBackdropBorderColor(0, 0 , 0, 1)
self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0.25, 0.25, 0.25, 1)
tab2.bg:SetVertexColor(0.25, 0.25, 0.25)
tab3.bg:SetVertexColor(0.25, 0.25, 0.25)

self.whisper = false
self.real = false
self.news = false

if released then
PlaySoundFile("Sound\\Interface\\uChatScrollButton.ogg")
end
Thanks for all!!

Last edited by Akatosh : 11-05-13 at 10:51 AM.
  Reply With Quote
11-05-13, 06:05 PM   #69
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Your OnLoad script looks fine. The problem is in your OnEvent script:

Code:
elseif event == "BN_FRIEND_ACCOUNT_ONLINE" or "BN_FRIEND_ACCOUNT_OFFLINE"  then
Here's how Lua interprets that line:
otherwise,
  if the result of comparing event == "BN_FRIEND_ACCOUNT_ONLINE" is neither nil nor false,
  or the value of the string "BN_FRIEND_ACCOUNT_OFFLINE" is neither nil nor false,
then:
In some other programming languages you can compare a value against multiple values like this (if X == A | B then) but in Lua you have to explicitly compare the value against each of the other values:

Code:
elseif event == "BN_FRIEND_ACCOUNT_ONLINE" or event == "BN_FRIEND_ACCOUNT_OFFLINE"  then
I didn't look into your OnUpdate or other scripts, so let me know if fixing the above problem doesn't solve the issue.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-05-13, 07:12 PM   #70
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Originally Posted by Phanx View Post
Your OnLoad script looks fine. The problem is in your OnEvent script:

Code:
elseif event == "BN_FRIEND_ACCOUNT_ONLINE" or "BN_FRIEND_ACCOUNT_OFFLINE"  then
Here's how Lua interprets that line:
otherwise,
  if the result of comparing event == "BN_FRIEND_ACCOUNT_ONLINE" is neither nil nor false,
  or the value of the string "BN_FRIEND_ACCOUNT_OFFLINE" is neither nil nor false,
then:
In some other programming languages you can compare a value against multiple values like this (if X == A | B then) but in Lua you have to explicitly compare the value against each of the other values:

Code:
elseif event == "BN_FRIEND_ACCOUNT_ONLINE" or event == "BN_FRIEND_ACCOUNT_OFFLINE"  then
I didn't look into your OnUpdate or other scripts, so let me know if fixing the above problem doesn't solve the issue.

Hi thanks for all!!

Now I get that error:

Code:
Message: [string "ChatTab_General_OnEvent"]:11: bad argument #1 to 'strmatch' (string expected, got function)
Time: 11/06/13 02:10:40
Count: 1
Stack: [C]: in function `strmatch'
[string "ChatTab_General_OnEvent"]:11: in function <[string "ChatTab_General_OnEvent"]:1>
[C]: in function `TurnOrActionStart'
[string "TURNORACTION"]:2: in function <[string "TURNORACTION"]:1>

Locals: (*temporary) = <function> defined Interface\FrameXML\BasicControls.xml:<Scripts>:1
(*temporary) = "%[(.-)%] se ha conectado."
(*temporary) = "string expected, got function"
  Reply With Quote
11-05-13, 08:29 PM   #71
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, I'm not really sure how kgPanels names event arguments, but you need to change "message" to whatever it uses (try "arg1" or check its wiki pages) ... however, that specific error also indicates that some addon you're using is leaking a global variable named "message" which is pretty bad. :/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-05-13, 10:21 PM   #72
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Originally Posted by Phanx View Post
Well, I'm not really sure how kgPanels names event arguments, but you need to change "message" to whatever it uses (try "arg1" or check its wiki pages) ... however, that specific error also indicates that some addon you're using is leaking a global variable named "message" which is pretty bad. :/
Man, arg1, arg1!!!!!


Code:
elseif event == "CHAT_MSG_SYSTEM" then
    local _, name = strmatch(arg1, self.STRING_ONLINE)
    name = name or strmatch(arg1, self.STRING_OFFLINE)
    self.news = name and self.IsFriend(name)

end
Now works OK no, the next of ok, thanks!!!.


I have another question!!

¿Can you confirm, that is imposibru do a Reload UI with kgpanels?.
  Reply With Quote
11-05-13, 10:48 PM   #73
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
ReloadUI()
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
11-05-13, 10:59 PM   #74
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Originally Posted by Fizzlemizz View Post
ReloadUI()
"Interface action failed because of an AddOn" I get that.
  Reply With Quote
11-05-13, 11:17 PM   #75
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
It has to be part of the code for a hardware event like a keyboard button push or a frames OnClick code. It would be annoying to have a ReloadUI() say on entering combat or some such.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-05-13 at 11:33 PM.
  Reply With Quote
11-05-13, 11:35 PM   #76
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Originally Posted by Fizzlemizz View Post
It has to be part of the code for a hardware event like a button push or a frames OnClick code. It would be annoying to have a ReloadUI() say on entering combat or some such.
I Found that and I adap it a bit:

Code:
## Interface: 50400
## Title: Reload_UI
code.lua
Code:
local _, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
local r,g,b = color.r, color.g, color.b
local button = CreateFrame("Button", "Reload_UI", UIParent)
button:SetPoint("CENTER", -730, 531)
button:SetSize(36, 18)
button:SetFrameStrata("Low") 

local texture = button:CreateTexture(nil, "LOW")
texture:SetAllPoints(true)
texture:SetTexture("Interface\\BUTTONS\\WHITE8X8")
texture:SetVertexColor(0.1019,0.1019,0.1019, 1)

local text = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
text:SetPoint("CENTER",1,0)
text:SetJustifyH("CENTER")
text:SetJustifyV("CENTER")
text:SetFont("Interface\\AddOns\\SharedMedia_MyMedia\\font\\Continuum_Medium.ttf", 12, "OUTLINE")
text:SetFormattedText("|cff%02x%02x%02x[ |r|cffffffffR|r|cff%02x%02x%02x ]|r",r*255,g*255,b*255,r*255,g*255,b*255)

button:SetScript("OnEnter", function(self)
self.entered = true
GameTooltip:SetOwner(button, "ANCHOR_NONE")
	GameTooltip:AddLine("Click|cffffffff to Reload UI|r", r, g, b, "")
        GameTooltip:SetAnchorType("ANCHOR_BOTTOM", -48, 1)
	GameTooltip:Show()
end)
button:SetScript("OnLeave", function(self)
self.entered = false
GameTooltip:Hide()
end)

button:SetScript("OnClick", ReloadUI)
button:SetScript("OnUpdate", function(self)

if self.entered then
text:SetFormattedText("|cffffffff[ R ]|r",r*255,g*255,b*255,r*255,g*255,b*255)
else
text:SetFormattedText("|cff%02x%02x%02x[ |r|cffffffffR|r|cff%02x%02x%02x ]|r",r*255,g*255,b*255,r*255,g*255,b*255)
end
end)
After serveral Edits, at the end is that.

Thanks for all!!

Last edited by Akatosh : 11-06-13 at 12:29 AM.
  Reply With Quote
11-05-13, 11:48 PM   #77
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
The current interface is 50400.

I thought you were creating buttons with KgPanels. Can't you add ReloadUI() to a KgPanels frames OnClick script and get all the text and mouseover stuff with it?

Admittedly I don't know Kgpanels.

Edit: just to be clear ReloadUI() does not need to be stand-alone, you can have a button that when clicked does all sorts of configuration and whatever and then at the very end does the ReloadUI() if required or even if not required, it's up to you.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-05-13 at 11:57 PM.
  Reply With Quote
11-06-13, 12:37 AM   #78
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Originally Posted by Fizzlemizz View Post
The current interface is 50400.

I thought you were creating buttons with KgPanels. Can't you add ReloadUI() to a KgPanels frames OnClick script and get all the text and mouseover stuff with it?

Admittedly I don't know Kgpanels.

Edit: just to be clear ReloadUI() does not need to be stand-alone, you can have a button that when clicked does all sorts of configuration and whatever and then at the very end does the ReloadUI() if required or even if not required, it's up to you.

I try all the ways that google allows me... and at the end... Kgpanels don't allow Reload UI(), or similar.... The only way that works for me I found here: http://www.wowinterface.com/forums/s...6&postcount=10

So I google more and found how can I adap it, to the default style of the interface..., font, size, text... etc.

Thanks for the tip of 50400, I change it.
  Reply With Quote
11-06-13, 02:15 AM   #79
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Fizzlemizz View Post
Can't you add ReloadUI() to a KgPanels frames OnClick script and get all the text and mouseover stuff with it?
No, because kgPanels frames aren't buttons -- they don't actually have OnClick scripts, they just misleadingly use the name to label a script that will be run for both OnMouseDown and OnMouseUp, which is why you need to discard one or the other by checking the custom pressed variable in your "OnClick" script before proceeding with anything else. I'm not really sure why this was the design decision, since there's nothing you can do with a plain Frame object that you can't also do with a Button object, but there are things you can do with a Button object that you can't do with a Frame object, like actual clicking... but that's how it works.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-06-13, 11:24 AM   #80
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Aahh ok, apologies. As I said, I don't know KgPanels, I use Discord Art which does use buttons.

Originally Posted by Phanx View Post
No, because kgPanels frames aren't buttons -- they don't actually have OnClick scripts, they just misleadingly use the name to label a script that will be run for both OnMouseDown and OnMouseUp, which is why you need to discard one or the other by checking the custom pressed variable in your "OnClick" script before proceeding with anything else. I'm not really sure why this was the design decision, since there's nothing you can do with a plain Frame object that you can't also do with a Button object, but there are things you can do with a Button object that you can't do with a Frame object, like actual clicking... but that's how it works.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Helps with Kgpanels!


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