View Single Post
04/12/14, 10:27 AM   #1
Blackstorm
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
API : Controls and Offset

Hello,

I am currently writting my own extension, i have done a small code part ^^ but i am blocked with the UI style

I am trying to add some controls headers and controls lines one above the other on a constant background but without knowing the exact offset (or height) of each element, and each element can have one or more lignes and never the same height.

so is it possible please ? if it's possible can you help me to know how ?


I have actualy something like that :

Lua Code:
  1. MMQTbg = WM:CreateControl("MMQT_Background", MMQTmain, CT_STATUSBAR)
  2. MMQTbg:SetSimpleAnchorParent(0,0)
  3. MMQTbg:SetResizeToFitDescendents(true)
  4.  
  5. function AddNewTitle(qindex, qlevel, qname)
  6.     if not MMQTlabel[qindex] then
  7.         MMQTlabel[qindex] = WM:CreateControl("MMQT_Label_"..qindex, MMQTbg , CT_LABEL)
  8.         if qindex == 1 then
  9.             local offsetTitle = 0
  10.             MMQTlabel[qindex]:SetSimpleAnchorParent(0,offsetTitle)
  11.         else
  12.             local offsetTitle = (qindex -1) * 25
  13.             MMQTlabel[qindex]:SetSimpleAnchorParent(0,offsetTitle)
  14.         end
  15.     end
  16.     MMQTlabel[qindex]:SetFont("ZoFontAnnounceMessage")
  17.     MMQTlabel[qindex]:SetText("["..qlevel.."] - "..qname)
  18. end
  19.  
  20. for i=1, 6 do
  21.     AddNewTitle(qindex, qlevel, qname)
  22. end


this code work fine, but i'm looking for a way to automatically place the object

Thanks in advance ^^
  Reply With Quote