setText or setFormattedText or ? - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-03-16, 07:51 PM   #1
An Aku'mai Servant
Lazare's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 33
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.
"There's no such thing as too many addons."

My Authored Addons
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » setText or setFormattedText or ?

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