[Solved] Issues with moving the unit selected frames

Level 24
Joined
Jun 26, 2020
Messages
1,928
Hello, I wanna move the unit group selected buttons to some place, I did this:
vJASS:
library myLib initializer init
   
    private function onSelect takes nothing returns nothing
        local framehandle unitFrame = BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0)
        local framehandle bottomCenterUI = BlzFrameGetParent(unitFrame)
        local framehandle groupFrame = BlzFrameGetChild(bottomCenterUI, 5)
        local framehandle buttonContainerFrame = BlzFrameGetChild(groupFrame, 0)
        local framehandle buttonFrame
        local integer i = 0
        loop
            exitwhen i > 11
           
            set buttonFrame = BlzFrameGetChild(buttonContainerFrame, i)
            call BlzFrameSetAbsPoint(buttonFrame, FRAMEPOINT_TOPLEFT, 0.30 + 0.03*i, 0.19)
           
            set i = i + 1
        endloop
        call BlzFrameSetVisible(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), true)
    endfunction

    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerSelectionEventBJ(t, Player(0), true)
        call TriggerAddAction(t, function onSelect)
        call BlzFrameSetVisible(BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), false)
    endfunction

endlibrary
It worked, but I have 2 issues, I only can move them if I select a group for the first time, that's why I did the trigger, but the selection event happens after a delay, so I tried to hide it in the map init and then show it when the event fires, but that only works sometimes.

My second issue is I wanna hide the health and mana bars of the selected units, I thought that I could hide some childs of the buttonFrame, but didn't work.
 
The game changes the visibility of the bars, quite often. Fighting over the values the games changes is to much effort and you cant win -> hide them with something else then the visiblity feature.

A: set alpha of the bars to 0 to hide them.
or B: change parent to some custom hidden simpleframe.
C: Move out of screen.
 
Top