UI Black Frame takes focus preventing keyinput


#1

library UIMod initializer init

private function UIButtonPress takes nothing returns nothing
    call BlzFrameSetEnable(BlzGetTriggerFrame(),false)    
    call BlzFrameSetEnable(BlzGetTriggerFrame(),true)
endfunction



private function setupUI takes nothing returns nothing
    local framehandle fh
    local trigger trig = CreateTrigger()
    local real screenWidth

    local integer i = 0

    call TriggerAddAction(trig, function UIButtonPress)
    
    call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME,0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0))  
    
    set fh = BlzCreateFrameByType("BACKDROP", "BlackBackground", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME,0), "ButtonBackdropTemplate",  0)
    call BlzFrameSetSize(fh, 0.8, 0.12)
    call BlzFrameSetPoint(fh,FRAMEPOINT_BOTTOM,BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0),FRAMEPOINT_BOTTOM,0,0)
    call BlzFrameSetTexture(fh, "textures\\black32.blp", 0, true)
    
    set fh = BlzCreateFrameByType("TEXTBUTTON", "antiClickThrough", fh, "StandardButtonTemplate",  0)
    call BlzFrameSetSize(fh, 0.8, 0.12)        
    call BlzFrameSetPoint(fh, FRAMEPOINT_BOTTOM, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), FRAMEPOINT_BOTTOM, 0, 0)
    call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CONTROL_CLICK)        
    
endfunction


private function init takes nothing returns nothing
    call TimerStart(CreateTimer(),0.1,false, function setupUI)
endfunction

endlibrary

this is more or less what you guys are doing

however you forgot to remove focus from the frame when you click at the black box

this means the user loses input ability until they click on the world frame

you can easly solve this by adding an event that disables and then re enables that frame. //Best of luck CanFight


(Torelef) #2

Thanks so much for all this info CanFight! Ill be investigating this :slight_smile: