indigo Posted February 2, 2021 Posted February 2, 2021 Hi, Is there a way to jump between edit boxes / buttons on a page by pressing i.e. the tab key? I've tried via speed key and to look online but I could never find anything. Thanks in advance for your support! Quote
AzeoTech Posted February 4, 2021 Posted February 4, 2021 Yes, but it is not as easy as I would hope. You need to create a sequence called OnKeyDown and then add some script. For example, if you had a user/password popup: if (component.userNameEdit.GetFocus()) if (key == 9) component.userPasswordEdit.SetFocus() return endif if (key == 13) enteredName = component.userNameEdit.strContents enteredPass = component.UserPasswordEdit.strContents Login(EnteredName,EnteredPass) endif endif if (component.userPasswordEdit.GetFocus()) if (key == 9) component.UserNameEdit.SetFocus() return endif if (key == 13) enteredName = component.userNameEdit.strContents enteredPass = component.UserPasswordEdit.strContents Login(EnteredName,EnteredPass) endif endif Login() is just some function that performs the login. The key parts are the GetFocus() which returns if the specified component is focused, SetFocus() which sets a component to have focus, and the checks for "key" which is a parameter passed to OnKeyDown with the key code of the key pressed. 9 is tab, 13 is carriage return. Quote
indigo Posted May 7, 2021 Author Posted May 7, 2021 Thanks for the reply, I only now managed to get around to implementing this, so sorry for the delay. I found the sample code in the DAQFactory folder and I guess that code snippet you provided has to be added to a sequence called "OnKeyDown" for it to work. I tried to do the following (which tabs between multiple edit boxes): switch case(component.edit_box1.GetFocus()) component.edit_box2.SetFocus() case(component.edit_box2.GetFocus()) component.submit_button.SetFocus() endcase But, it doesn't seem to be able to put buttons into focus, is this correct? Or is my code snippet wrong? Thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.