Thread Tools Display Modes
08-11-13, 08:49 AM   #1
SkyTwister
A Murloc Raider
Join Date: Aug 2013
Posts: 4
Question Probably a stupid question

I'm trying to display a frame based upon an event.

The frame is defined in XML and is hidden on create. It has a script for OnLoad, which calls a LUA function and OnEvent which triggers a LUA function both detailed below.

LUA Code:

function DisplayFrame_OnLoad(self, event, ...)
self:RegisterEvent("PET_BATTLE_OPENING_START")
self:RegisterEvent("PET_BATTLE_CLOSE")
end

function DisplayFrame_OnEvent(self, event, ... )
if event == "PET_BATTLE_OPENING_START" then
DF_display("Show")
elseif event == "PET_BATTLE_CLOSE" then
DF_display("Hide")
end
end

function DF_display(DoWhat)
myDisplayFrame(DoWhat);
end

As I say I'm sure it's a stupid question and this is something simple and obvious but I'm not grasping it. Any help appreciated.
  Reply With Quote
08-11-13, 09:00 AM   #2
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Well, I don't understand what DF_display should be doing, but I think this is what you want:

Lua Code:
  1. function DisplayFrame_OnEvent(self, event, ... )
  2.   if event == "PET_BATTLE_OPENING_START" then
  3.     self:Show()
  4.   elseif event == "PET_BATTLE_CLOSE" then
  5.     self:Hide()
  6.   end
  7. end
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
08-11-13, 11:17 AM   #3
SkyTwister
A Murloc Raider
Join Date: Aug 2013
Posts: 4
Thumbs up

Perfect thanks, there will be more code in the DF_Display but pointing out I was needed to use self:Show() has fixed my issues.

You're a star
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Probably a stupid question


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