Rank: Newbie Groups: Member
Joined: 7/16/2024 Posts: 2
|
I have a .NET Windows Forms User Control with an EO web browser in one panel, and a list in an other panel, such that when I click on an item in the list it scrolls the html to the element that corresponds to the list item.
This all works nicely, I'm using: ScriptCall($"document.getElementsByClassName('someclass')[{index}].scrollIntoView();", donehandler);
I've also added searching with StartFindSession in the browser, which generally works fine, but I want to be able to search Next/Previous from the location I've scrolled to. If I manually click anywhere in the browser window then search continues from that point - but I don't want the user to have to click - I need a way of programatically setting the focal point of the search when I do the scroll.
I've tried: var x = document.getElementsByClassName('someclass')[{index}]; x.scrollIntoView(); x.focus()
Any help gratefully received, Cheers Des :-)
|
Rank: Newbie Groups: Member
Joined: 7/16/2024 Posts: 2
|
Well the cardboard cutout strikes again! Solved it with a bit more javascript research, specifically here: stackoverflowAdding
Code: JavaScript
var selecton = window.getSelection();
selection.setBaseAndExtent(x,0,x,1);
does the job. Cheers, Des :-)
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Great. Thanks for sharing!
|