How to trigger "Tab" keyboard key click from the code

It depends on your components that need focus
if it’s TextBox and TextArea components you can call self.textbox.focus()

If it’s anything other than a TextBox or TextArea then i’d recommend

the code would look something like:

from AnvilAugment import augment

class Form1(Form1Template):
    def __init__(self, **properties):
        from itertools import cycle
        components = [self.componet1, self.component2, ..., ]
        for component in components:
            augment.add_event(component, 'focus')
        self.components = cycle(components)

    def button_click(self, **event_args):
        next(self.components).trigger('focus')
   

here’s a clone link:
I’ve added a bit more code just to make sure that the next element is always after the currently focused element but the premise is the same

1 Like