Thread Tools Display Modes
04/02/14, 05:43 AM   #1
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
UI help - Without XML

I'm looking to add text to the ui without any backgrounds or anything, how do I add this without using xml.

Also I would like to know how to fire a set of code every time the reticle target changes.

I know there is tutorials about the events but they are a little unclear about where the code actually goes.

Thx in advanced.
  Reply With Quote
04/02/14, 08:07 AM   #2
zork
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 29
Lua Code:
  1. local wm = GetWindowManager()
  2.  
  3.   --frame
  4.   local frame = wm:CreateTopLevelWindow()
  5.   frame:SetDimensions(128,128)
  6.   frame:SetAnchor(CENTER,GuiRoot,CENTER,0,0)
  7.  
  8.   --text
  9.   local text = wm:CreateControl(nil, frame, CT_LABEL)
  10.   text:SetAnchorFill(frame)
  11.   text:SetText("Hello World")

Check out addons from Visur. They are Lua only atm and should include everything you need.
http://www.esoui.com/downloads/author-462.html

Last edited by zork : 04/02/14 at 08:11 AM.
  Reply With Quote
04/02/14, 08:30 AM   #3
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Thumbs up

Exactly what I was after, much appreciated. I might have a look at those addons but I got the basics of events now.
  Reply With Quote
04/02/14, 10:03 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
I'm pretty sure you have to give a name to your frame and not just nil. No?
  Reply With Quote
04/03/14, 01:50 AM   #5
zork
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 29
You do not have to give every control a global name, nil is just fine. No need to pollute the global namespace.
  Reply With Quote
04/03/14, 06:10 AM   #6
Halja
 
Halja's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 111
Originally Posted by zork View Post
You do not have to give every control a global name, nil is just fine. No need to pollute the global namespace.

If you don’t give the control a name, how do traverse/find the controls at runtime to make dynamic changes? I’m all for reducing global name space littering but I don’t want to make my coding more difficult.
--Halja

The Naming of Cats is a difficult matter,
It isn't just one of your holiday games; T.S. Eliot
  Reply With Quote
04/03/14, 01:23 PM   #7
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
just store the value of the create function into a variable and you have access to that frame.

eg:

local tlw = WindowMgr:CreateTopLevelWindow(nil)
tlw.BackGround = WindowMgr:CreateControl(nil,tlw,CT_BACKDROP)
etc
  Reply With Quote
04/03/14, 04:06 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
I tested it again last night before I said something.
Lua Code:
  1. znb.bg = wm:CreateControl(nil, znb, CT_TEXTURE)
  2. znb.bg:SetTexture("ZAM_Notebook\\NotebookBG.dds")
Replacing my bg texture name with nil caused the background to no longer be displayed. Though it didn't throw any errors for references to znb.bg.
  Reply With Quote
04/03/14, 08:07 PM   #9
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Originally Posted by zork View Post
Lua Code:
  1. local wm = GetWindowManager()
  2.  
  3.   --frame
  4.   local frame = wm:CreateTopLevelWindow()
  5.   frame:SetDimensions(128,128)
  6.   frame:SetAnchor(CENTER,GuiRoot,CENTER,0,0)
  7.  
  8.   --text
  9.   local text = wm:CreateControl(nil, frame, CT_LABEL)
  10.   text:SetAnchorFill(frame)
  11.   text:SetText("Hello World")

Check out addons from Visur. They are Lua only atm and should include everything you need.
http://www.esoui.com/downloads/author-462.html
Are you sure there isn't anything missing, I pasted this in a addon and it didnt display anything :S
  Reply With Quote
04/04/14, 06:53 PM   #10
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
Originally Posted by zork View Post
You do not have to give every control a global name, nil is just fine. No need to pollute the global namespace.
Although I think this breaks my Clarity add-on, preventing users from having the choice to only show specified addons with a keybind if they don't want to see them all the time.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » UI help - Without XML


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