Page 2 of 2

Re: set focus issue.

Posted: Fri Apr 23, 2021 11:45 am
by Scott Klement
It looks like scrolling the scrollbar is placing focus into the textbox. I imagine if you click in the textbox, that'd work, too.

I noticed that you have it doing this while you type. What event are you doing this on?

I don't exactly know what's happening or why... but, I'm sure I could figure it out if I could "play" with the code. You can do Ctrl-F9 and post the json.txt here, that would make it possible for me to "play" with it. (Make sure there's nothing confidential on the screen -- remember, this is a public discussion forum.)

Re: set focus issue.

Posted: Fri Apr 23, 2021 1:14 pm
by mwalter
It's on the onChange event in the Item Number field.

Weird thing is if I do Ctl-F9 when the highlighted field is gray, it doesn't work. However, I could do it once I clicked on the scroll bar, and the highlight turned blue.

Re: set focus issue.

Posted: Mon Apr 26, 2021 9:07 am
by mwalter
I got this working. Here's what I had to do. Not sure why though.

Thanks for your help, Scott.

Code: Select all

                    setTimeout (function() {
                        this.focus();                        
                        var count = getObj("txtCount." + x)
                        var myGrid = getObj("Grid1");
                        count.focus();
                        count.select();
                        myGrid.grid.scrollToRow(x);
                    },200);


Re: set focus issue.

Posted: Wed Nov 10, 2021 10:36 am
by JohnAkers
You didn't include mobile apps, however it's worth noting that mobile platforms (iOS, Android, etc.) frequently hinder the ability to programmatically get focus. Setting focus causes the touch keyboard to pop-up on the mobile display, which covers a large portion of the display and can make the page 'ugly,' therefore it blocks it under specific conditions.... if this is a mobile app, you'll want to read up on when you can and can't set focus. iOS app development specially is quite complexed and don't support these programs easily.