WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   chat window strata (https://www.wowinterface.com/forums/showthread.php?t=20628)

khurzog 02-21-09 04:59 AM

chat window strata
 
i need to change the strata of certain chat windows, i use chatter but didn't see an option for it, if someone can work up some simple code, i'll just make a simple mod for it. thanks =D

Mera 02-21-09 05:42 AM

/script _G.ChatFrame1:SetFrameStrata("blabla")

ChatFrame goes from ChatFrame1 to ChatFrame7 maximum.

khurzog 02-21-09 07:15 AM

awesome thank you worked perfectly =D

khurzog 02-21-09 07:23 AM

actually, one more question about this. that line works perfectly ingame, but doesn't work in an lua. what would i change?

Miralen 02-21-09 08:39 AM

I would assume:

ChatFrame1:SetFrameStrata("blabla")

would be all you need in an lua for it to work, though im not 100% sure as I dont know what the _G. means.

Seerah 02-21-09 12:29 PM

The _G is the global table of all of the variables in that global scope. It's not needed in the script either.

Akryn 02-21-09 12:40 PM

Probably your addon isn't working because it's running too early. I suggest creating a frame, registering for VARIABLES_LOADED and running the code then.

khurzog 02-21-09 03:41 PM

doing it meras way in an lua brings up an error not liking the slashes, changing it to miralens way causes no errors but has no effect =(

Seerah 02-21-09 06:59 PM

Mera's way is a script to use in a macro or to enter in the chat frame (hence the /script). Miralen's way will work in an addon. You need to replace "blabla" with the valid strata that you want your chat frame to have, though.
http://wowprogramming.com/docs/widge...SetFrameStrata

khurzog 02-22-09 01:23 AM

this is my coding...

----ChatStrata.toc-------------
## Interface: 30000
## Title: ChatStrata
## Version: 1.0
## Author: khurzog
## Credits: Mera, Miralen

ChatStrata.lua
-------------------------------

----ChatStrata.lua-------------------
ChatFrame1:SetFrameStrata("high")
ChatFrame3:SetFrameStrata("high")
ChatFrame4:SetFrameStrata("high")
ChatFrame7:SetFrameStrata("high")
-------------------------------------

loads fine but does nothing. so what am i doing wrong?

Mera 02-22-09 06:14 AM

the delay is not good you are trying to change the strata while the chat frame arent built yet, the code below should work if you aren't using a chat mod, _G would have worked too but when the client loads your mod there is nothing called ChatFrame inside _G, basically that is safer to always delay mods that are "automatically" calling globals or wow apis always after the event PLAYER_LOGIN because you are sure then almost all is loaded client side or ADDON_LOADED might help you to delay it after a specific mod otherwise your code executes when nothing is ready in the client and the client is not ready too to send you a simple error notification:

Code:

local function Load(_, event)
        for i = 1, 7 do
                local j = _G["ChatFrame"..i]
                if j then j:SetFrameStrata("HIGH") end
        end
end

local event = CreateFrame("Frame")
event:SetScript("OnEvent", Load)
event:RegisterEvent("PLAYER_LOGIN")

note that this does not work with chatter because it resets stratas on load, to tweak it with chatter or another mod do this

Code:

local function Load(_, event, addon)
        if addon == "Chatter" then
                for i = 1, 7 do
                        local j = _G["ChatFrame"..i]
                        if j then j:SetFrameStrata("HIGH") end
                end
        end
end

local event = CreateFrame("Frame")
event:SetScript("OnEvent", Load)
event:RegisterEvent("ADDON_LOADED")

nor just change the name "Chatter" with any Chatmod, it should work as long as the chat mod does not rename default frames to something other.

so to mod only visible chatframe you can change

if j then j:SetFrameStrata("HIGH") end
to
if j and j:IsVisible() then j:SetFrameStrata("HIGH") end

etc

That's a good to practice writing mods, I'm sure you'll be mod author soon or later hehe, btw no requirement to credits us, these codes samples are so simple they have probably been used and reused millions of times ;)

khurzog 02-22-09 05:54 PM

thank you for the help, its almost working now.

btw i am using chatter, and also Chicchai (which is why the strata matters)

anyways the problem i have now is that my text in frame 1 is now under the background, which wasn't a problem before, nor when i used the macro to change the strata. all the other texts show up fine on my other 3 frames. also the last change about the visability broke the whole thing for me, but not sure if that is needed. the visable chat frames are 1,3,4,7. frame 2 is the real combat log which is hidden, 5 and 6 don't exist, and 7 is hitsmode. any idea how to fix the text? ill put up a screen shot...




p.s. giving other people credit is a great way to remember who to ask if i have a problem later on =D

Mera 02-23-09 06:10 AM

probably your background that have a higher strata than HIGH nor they use the same so the last modified strata is kept up the other I think thats probably why it worked with a macro and not in a script because seems you have something other than Chatter modding these stratas, try with a "TOOLTIP" strata that is the highest, nor something between HIGH and TOOLTIP should be fine

Stratas:
  • "PARENT" (very low)
  • "BACKGROUND"
  • "LOW"
  • "MEDIUM"
  • "HIGH"
  • "DIALOG"
  • "FULLSCREEN"
  • "FULLSCREEN_DIALOG"
  • "TOOLTIP" (very high)

khurzog 02-23-09 03:18 PM

so i did some testing, and it turns out the text appearing behind the background (only in frame 1) only happens when BasicMinimap is running. that seemed unlikely, but i switched Chatter with BasicMinimap in the code, and it solved the text issue, but broke the strata. so obviously it need to stay delayed until chatter loads. so how any why is BasicMinimap interfering?

Mera 02-23-09 04:05 PM

probably a code mistake of basicminimap, you can report that thread link to the mod author so he can provide fix

khurzog 02-27-09 12:18 AM

have yet to hear back from funkydude, anyone else have a moment to give basicminimap code a quick scan?

khurzog 03-11-09 01:52 AM

bump, still having this minor yet annoying issue of the strata not applying to chatframe1 (or at least its not staying) and only with basicminimap running, no response from the author funkydude yet =(

funkydude 03-12-09 08:35 PM

I'm not exactly sure what you're trying to say, BasicMinimap has nothing to do with the chatframe.

khurzog 03-13-09 10:44 AM

i had a long drawn out explanation with screen shots and everything, then i fell asleep, woke up, and the kids rebooted the computer, so here's the short version.

i needed to make the very simple addon as seen above, solely to make all my chatframe stratas be high (or as it turned out fullscreen) because this feature was left out of chatter, and with the used with Chicchai, my buffs from pitbull4 were overlapping my chatframes when they extended.

the example provided by mera worked fine for all the chat frames except chatframe1, which the text went under the background.

after a long process of narrowing down addons i discovered it works as intended without basicminimap loaded. further testing with only the two mods confirms somehow basicminimap is preventing the above example mod from correctly changing the strata of chatframe1. i have no idea how or why but that is whats happening.

i'll show some screenshots to explain better when i'm home from work, thanks


All times are GMT -6. The time now is 01:42 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI