|
|
#1 |
|
Newbie
Join Date: Oct 2008
Posts: 5
|
Hello all,
I am in the process of writing my first addon and things in my opinion are going fairly well. I decided to use the Ace library as I have always loved Ace Addons and after doing my research it seemed to fit the bill. However with that being said I do have a question about AceGUI-3.0 and the SimpleHTML widget. I believe I have the widget defined correctly and it added to AceGUI correctly, but I cannot for the life of me figure out how to assign the html file to it. So this may be a SimpleHTML widget question as opposed to a AceGUI question, but either way any help would greatly be appreciated. Basically I have a folder that contains the various help files in html format. What I want to do is simply open a window using AceGUI, which works, and load in the appropriate html file. Below is the code I have so far. The SetText method of the SimpleHTML widget seems to work, but I saw examples online where you can do a file="Help\HelpFile.html" in the XML portion of a SimpleHTML and it pulls the file content. I want to do the same, but from the lua side of things. Again any help or direction that you could offer would be appreciated. Widget Code Code:
-----------------------------------------------------
-- HELP WIDGET
-----------------------------------------------------
do
local Type = "SimpleHTML"
local Version = 8
local function OnAcquire(self)
self:SetText("")
end
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
local function SetText(self, text)
self.frame:SetText(text or "")
end
local function SetWidth(self, w)
self.frame:SetWidth(w)
end
local function Constructor()
local frame = CreateFrame("SimpleHTML",nil,UIParent)
local self = {}
self.type = Type
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetText = SetText
self.SetWidth = SetWidth
self.frame = frame
frame.obj = self
frame:SetHeight(18)
frame:SetWidth(200)
frame:SetFontObject(GameFontHighlightSmall)
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
Create the help frame and assign the appropriate html file Code:
-- Create a container frame
local f = AceGUI:Create("Frame")
f:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end)
f:SetTitle("Personal Loot Help")
--f:SetStatusText("Status Bar")
f:SetLayout("Flow")
local html = AceGUI:Create("SimpleHTML")
html:SetWidth(170)
html.file = "Help\PersonalLoot.html"
-- Add the SimpleHTML to the container
f:AddChild(html)
|
|
|
|
|
|
#2 |
|
Legendary Member
Join Date: May 2006
Location: Arizona
Posts: 3,787
|
hehe... the simple html widget (being a blizzard thing) dosn't take straight .html files. In fact the UI dosn't know they exist.
http://www.wowwiki.com/Widget_API#SimpleHTML http://www.wowwiki.com/UIOBJECT_SimpleHTML for reference.
__________________
Author of GuildCraft, SickOfClickingDailies, CursorCooldown, Broken_LFD WoWAce Addon List WoWInterface Addon List "I was there in the beginning... and things were very different back then" --An Echo from a time before. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2008
Posts: 5
|
Orionshock thank you for your reply, but I do have a few questions then. I found a post out on WorldofWar.net, http://forums.worldofwar.net/showthread.php?t=372060, that shows them using XML to set the html file to display as such.
Code:
<SimpleHTML name="MyHTML" file="MyHtmlFile.html">
.. Anchors
.. Size
.. Layers
.. Frames
<FontString inherits="GameFontNormal"/>
<FontStringHeader1 inherits="GameFontNormalLarge"/>
</SimpleHTML>
If that is not possible then do you know of a way to read the html out of the html file and then use SetText to display it? I mean you have to be able to use html files somehow as that is how Blizzard displays certain elements in game as well. |
|
|
|
|
|
#4 |
|
Super Moderator
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,783
|
From the looks of it, its only possible through XML.
__________________
Author/Maintainer of Ace3, Bartender, Mapster, Quartz, HotCandy, and various small and helpful addons WoWAce Administrator and AddOn Moderator You can Donate if you want, any help is appreciated! |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Oct 2008
Posts: 5
|
Nevcairiel,
Thanks for your response. I am surprised that this would only be available in XML and not Lua as the two should be one and the same. If that is the case then any idea on how to pull the html into the SetText method? Or do you have any suggestions on how to implement a HTML based help system inside of an addon? Thanks! |
|
|
|
|
|
#6 |
|
Super Moderator
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,783
|
You can't read files, so you'll have to paste the HTML in a Lua file.
However, the SimpleHTML control is fail anyway, since the HTML syntax that it supports is limited to only like 4 tags, there isn't much of a point to use it, IMHO.
__________________
Author/Maintainer of Ace3, Bartender, Mapster, Quartz, HotCandy, and various small and helpful addons WoWAce Administrator and AddOn Moderator You can Donate if you want, any help is appreciated! |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Oct 2008
Posts: 5
|
Hmmm,
OK maybe I'll have to do some rethinking then. Yeah I saw the tags it supported and it seems to support enough that I would think it would be ideal for documentation such as release notes and in game help. I really would like a way to separate out help content from the delivery mechanism. I hate to think I would have to hard code the documentation directly in the lua code in order for this to work. Anyhow I appreciate the responses and if anything pops into mind please let me know! |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Nov 2009
Posts: 5
|
There is a way to seperate them a bit.
Make a Display Addon Make another addon containing the help content you want and make it pass the data to the display addon That way you would not have to recode the display addon if you need to have more help content addons This still means hardcoding of the documentation, but thats not much different from hardcoding it in a html file. |
|
|
|
|
|
#9 |
|
Seal Cub Clubbing Club
Join Date: May 2005
Location: California, US
Posts: 7,761
|
Don't bump 3-week-old threads with some vague generic post that doesn't add anything new to the thread. -_-
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge Troubleshoot an addon | Turn any code into an addon | More addon resources Need help with your code? Attach or paste your whole, real files. Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead! |
|
|
|
![]() |
| Tags |
| acegui-3.0, file, html, simplehtml |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT. The time now is 07:16 AM.
WowAce Forums





