Go Back   WowAce Forums > Addon Chat > Frameworks > Ace3
Ace3 Ace3 framework discussion

Reply
 
Thread Tools
Old 11-30-2009   #1
docseuss
Newbie
 
Join Date: Oct 2008
Posts: 5
Question ACEGUI-3.0 and SimpleHTML Widget

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)
docseuss is offline   Reply With Quote
Old 11-30-2009   #2
OrionShock
Legendary Member
 
OrionShock's Avatar
 
Join Date: May 2006
Location: Arizona
Posts: 3,787
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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.
OrionShock is offline   Reply With Quote
Old 11-30-2009   #3
docseuss
Newbie
 
Join Date: Oct 2008
Posts: 5
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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>
and they state this works so basically I was wanting to do this in lua instead.

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.
docseuss is offline   Reply With Quote
Old 11-30-2009   #4
Nevcairiel
Super Moderator
 
Nevcairiel's Avatar
 
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,797
Default Re: ACEGUI-3.0 and SimpleHTML Widget

From the looks of it, its only possible through XML.
__________________
Author/Maintainer of Ace3, Bartender4, Mapster, Quartz, HotCandy, and various small and helpful addons.
You can Donate if you want, any help is appreciated!
Nevcairiel is offline   Reply With Quote
Old 11-30-2009   #5
docseuss
Newbie
 
Join Date: Oct 2008
Posts: 5
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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!
docseuss is offline   Reply With Quote
Old 11-30-2009   #6
Nevcairiel
Super Moderator
 
Nevcairiel's Avatar
 
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,797
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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, Bartender4, Mapster, Quartz, HotCandy, and various small and helpful addons.
You can Donate if you want, any help is appreciated!
Nevcairiel is offline   Reply With Quote
Old 11-30-2009   #7
docseuss
Newbie
 
Join Date: Oct 2008
Posts: 5
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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!
docseuss is offline   Reply With Quote
Old 12-23-2009   #8
MichaelLundRasmussen
Newbie
 
Join Date: Nov 2009
Posts: 5
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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.
MichaelLundRasmussen is offline   Reply With Quote
Old 12-23-2009   #9
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,100
Default Re: ACEGUI-3.0 and SimpleHTML Widget

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!
Phanx is offline   Reply With Quote
Reply

Tags
acegui-3.0, file, html, simplehtml


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:32 AM.