Is there straight forward way (custom component for example) to trigger “Tab” click or any other keyboard key using code. (I don’t have HTML or JS knowledge)
What I am trying to accomplish is to have a button “for example”, when this button clicked; the Tab key click event triggered, so the focus move to the next component. I read some posts about mousetrap, however, it does the opsite.
That is smart, however, what if the visibility/existence of the components on my form are dependent on specific actions of previous components? I made one of the components invisible and the focus still going to the invisible component. The other thing; if I change the order of the components in the design, it still going through list order.
Is there any way, you can click “Tab” key using the code, so the focus goes to the next component currently on the screen?
The order of the list will determine the order of tabbing so if the component orders don’t change on screen then it should be work… or have I missed something.
You can add flags into the loop, using the visible attribute or add a tag to the component that can be used in the loop to know whether to skip it or not.
The problem with replicating a tab key press on a button click is that as soon as you click the button to tabNext that button now has focus and so literally hardwiring tabNext would not go to the expected component. You’d have to do something like the above anyway I think… Or some other hack.
Possibly, but it will be a lot of work, and every change I do in future, I will have to go back and change this code again.
The issue with that is; what if the component added at run time (it is not exist in the list)? I can added it to the list at the run time, but the order will be different and hard to control (unless I write a lot of code)…etc.
The main Idea is to have a method when a drop_down item selected, the method moves the focus to the next component on the screen.
I agree, but as you said “sometimes”. The method I am trying to create and call (to shift the focus to the next component) starts inside specific container and ends inside it, so it is somewhat controlled
As soon as your user interacts with the drop down that now has focus… so is the next element the one after the drop down? Or somewhere else on the screen? If it’s simply the next element then great. But if it’s not then how do we determine what the next element is?
it chooses the next available element from the flow_panel components so no hard coding of lists…
self.current = # component that last had focus in the flow panel
# it will lose focus as soon as we click next
def next_click(self, **event_args):
if self.current is None: