library GetMainSelectedUnit initializer init_function
globals
private framehandle containerFrame
private framehandle array frames
endglobals
private function init_functionAt0s takes nothing returns nothing
local integer i = 0
local framehandle console = BlzGetFrameByName("ConsoleUI", 0)
local framehandle bottomUI = BlzFrameGetChild(console, 1)
local framehandle groupframe = BlzFrameGetChild(bottomUI, 5) // <---- bottomUI has only 4 children now
local framehandle buttonContainer
//globals
set containerFrame = BlzFrameGetChild(groupframe, 0) // <----- leads to crash
// give this frames a handleId
loop
exitwhen i >= BlzFrameGetChildrenCount(containerFrame) - 1
set buttonContainer = BlzFrameGetChild(containerFrame, i)
set frames[i] = BlzFrameGetChild(buttonContainer, 0)
set i = i + 1
endloop
endfunction
private function timerFunction_init_functionAt0s takes nothing returns nothing
call init_functionAt0s()
call DestroyTimer(GetExpiredTimer())
endfunction
private function init_function takes nothing returns nothing
call TimerStart(CreateTimer(), 0, false, function timerFunction_init_functionAt0s)
endfunction
endlibrary