gre.set_focus

gre.set_focus(
    fqn
)
            

Set the focus to a control as described by its fully qualified name. This function returns true if the control could be found and was focusable and focus could be set to it. If the control can be found but is not focusable then false will be returned. If the control can't be found then nil will be returned.

When the fully qualified name indicates the row and column of a table, then this function will set the active table cell rather than adjusting the control focus.


Parameters:

        fqn         The fully qualified name of the control to receive focus

Returns:

        true for success, false for failure or nil if an error occurs during processing 
        
Example:
            

-- Set the focus to MyControl
local didApply = gre.set_focus("MyLayer.MyControl")
if(not didApply) then
    print("Failed to set focus")
end

-- Set to focus to the second row item in a table
local didApply = gre.set_focus("MyLayer.MyTable.2.1")
if(not didApply) then
    print("Failed to set table cell focus")
end