Reply
Thread Tools Display Modes
Unread 01-08-13, 12:35 PM   #1
Bombshelly
Zombie
AddOn Author - Click to view addons
Join Date: Jan 2013
Posts: 1
Refreshing a frame?

I'm trying to write a routine that makes a simple box on the screen. Based on a conditional statement, I would like to change the background color of the box and have it refresh.

I have everything written and it makes sense, except for the "refresh" part. I can't find how to do this. Can anyone lend a hand? Here's a few of the pieces, and thanks in advance!

Code:
local context=UI.CreateContext("myWindowFrame")
local bigBox = UI.CreateFrame("Text", "placeHolder", context)

bigBox:SetWidth(20)
bigBox:SetHeight(20)
bigBox:SetPoint("TOPCENTER", UIParent, "TOPCENTER",0,0)
bigBox:SetBackgroundColor(0,0,0,1)
bigBox:SetVisible(true)

local box1 = UI.CreateFrame("Text", "box1", bigBox)
box1:SetWidth(10)
box1:SetHeight(10)
box1:SetPoint("TOPLEFT", bigBox, "TOPLEFT",0,0)
--box1:SetBackgroundColor(1,0,0,1)
box1:SetVisible(true)

--the conditional will call this:
function changemyColor(myC)
	if myC == "whatever" then
                box1:SetBackgroundColor(1,0,0,1)
                --How do I trigger a refresh of my little box after this?
        end
end
__________________
Bombshelly@Wolfsbane
Bombshelly is offline   Reply With Quote
Unread 01-11-13, 07:49 PM   #2
Bullarky
Zombie
 
Bullarky's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2013
Posts: 2
Not sure you need to do anything. I just plugged your code in and added the following line only to trigger the change:

bigBox.Event.LeftClick = function() changemyColor("whatever") end

Now when you click the box, it turns the top left quad red. Is that what you are attempting?

Code:
local context=UI.CreateContext("myWindowFrame")
local bigBox = UI.CreateFrame("Text", "placeHolder", context)

bigBox:SetWidth(20)
bigBox:SetHeight(20)
bigBox:SetPoint("TOPCENTER", UIParent, "TOPCENTER",0,0)
bigBox.Event.LeftClick = function() changemyColor("whatever") end
bigBox:SetBackgroundColor(0,0,0,1)
bigBox:SetVisible(true)

local box1 = UI.CreateFrame("Text", "box1", bigBox)
box1:SetWidth(10)
box1:SetHeight(10)
box1:SetPoint("TOPLEFT", bigBox, "TOPLEFT",0,0)
--box1:SetBackgroundColor(1,0,0,1)
box1:SetVisible(true)

--the conditional will call this:
function changemyColor(myC)
	if myC == "whatever" then
                box1:SetBackgroundColor(1,0,0,1)
                --How do I trigger a refresh of my little box after this?
        end
end
Bullarky is offline   Reply With Quote
Reply

Go BackRiftui » Developer Discussions » Lua Help » Refreshing a frame?

Thread Tools
Display Modes

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