View Single Post
10-03-16, 07:51 PM   #1
Lazare
An Aku'mai Servant
 
Lazare's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 36
setText or setFormattedText or ?

I have a button defined in my xml file as TRACK_QUEST_ABBREV The normal text for it is "Track". I would love to be able to change it to "UnTrack" if the quest is being tracked (like the Blizz quest log does). I copied the following Lua code from the Blizz quest log but it is giving me errors:
Lua Code:
  1. function qgc:ToggleWatch(index)
  2.     if not index then
  3.         index = GetQuestLogSelection()
  4.     end
  5.     if index>0 then
  6.         if IsQuestWatched(index) then -- already watched, remove from watch
  7.             RemoveQuestWatch(index)
  8.             TRACK_QUEST_ABBREV:SetText(TEXT("Track"))
  9.         else -- not watched, see if there's room to add, add if so
  10.             if GetNumQuestWatches() >= MAX_WATCHABLE_QUESTS then
  11.                 UIErrorsFrame:AddMessage(format(QUEST_WATCH_TOO_MANY,MAX_WATCHABLE_QUESTS),1,0.1,0.1,1)
  12.             else
  13.                 AddQuestWatch(index)
  14.                 TRACK_QUEST_ABBREV:SetText(TEXT("UnTrack"))
  15.             end
  16.         end
  17.     end
  18. end
What am I missing? The error that I get is: attempt to call method 'SetText' (a nil value) and SetFormattedText gets the very same error.
Thanks in advance for any help on this.
Cheers!
__________________
"There's no such thing as too many addons."
Lothaer

My Authored Addons
HOME OF THE FREE, BECAUSE OF THE BRAVE
  Reply With Quote