View Single Post
05/12/14, 12:31 PM   #7
deathangel1479
 
deathangel1479's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 6
Originally Posted by Roupine View Post
Have you redefined WINDOW_MANAGER somewhere? If WINDOW_MANAGER:GetControlByName() doesn't work, neither should WINDOW_MANAGER:CreateControl()

It's weird that this wouldn't work for you-- I use this all the time:
Lua Code:
  1. tlw = WINDOW_MANAGER:GetControlByName("MODUI_TLW")
  2. if(not tlw) then -- GetControlByName() returns nil if Control does not exist
  3.   tlw = WINDOW_MANAGER:CreateControl("MODUI_TLW", GuiRoot, CT_TOPLEVEL)
  4. end
Dont think so.

Code:
function RMM.CreateUI()

	--main
	RMM.c = WINDOW_MANAGER:CreateTopLevelWindow("RMM_root")
    RMM.c:SetDimensions(256,256)
    RMM.c:SetAnchor(TOPLEFT,GuiRoot,TOPLEFT,100,100)
    RMM.c:SetHidden(false)
    RMM.c:SetMovable(true)
    RMM.c:SetMouseEnabled(true)
    RMM.c:SetClampedToScreen(true)

--overlay
    RMM.c.overlay = WINDOW_MANAGER:CreateControl("RMM_overlay", RMM.c, CT_TEXTURE)
	RMM.c.overlay:SetTexture("RadarMiniMap/textures/rad.dds")
    RMM.c.overlay:SetAnchorFill(RMM.c)	
	RMM.c.overlay:SetDrawLayer(3)
	
	--nord
	RMM.c.nord = WINDOW_MANAGER:CreateControl("RMM_nord", RMM.c, CT_TEXTURE)
	RMM.c.nord:SetTexture("RadarMiniMap/textures/nor.dds")
    RMM.c.nord:SetAnchorFill(RMM.c)	
	RMM.c.nord:SetDrawLayer(4)
	
    --scroll
    RMM.c.sc = WINDOW_MANAGER:CreateControl("RMM_scroll", RMM.c, CT_SCROLL)
    RMM.c.sc:SetAnchorFill(RMM.c)

    --map
	RMM.c.map = WINDOW_MANAGER:CreateControl("RMM_map", RMM.c, CT_CONTROL)
	RMM.c.map:SetAnchor(TOPLEFT, RMM.c, TOPLEFT, 0,0)
	
end
There is a opposit between our code:
Code:
WINDOW_MANAGER:CreateControl("MODUI_TLW", GuiRoot, CT_TOPLEVEL)

WINDOW_MANAGER:CreateTopLevelWindow("RMM_root")
Is that the problem?

Last edited by deathangel1479 : 05/12/14 at 12:39 PM.
  Reply With Quote