Im not sure what your final outcome is for this, emulating a keypress to move focus to the next or a particular widget component is overkill.
What i suggest is look at a tutorial for processing say gamepad input for ui control. Then instead of processing the gamepad events, call the code to focus a widget component however you see fit. (Basically remove the gamepad event and attach the code to your event)
Look at this maybe to get an understanding how a gamepad moves around the widget focus then apply it to your needs.