Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

chomiumwindow1 and listbox

Post Reply
reel.time
Posts: 3
Joined: Wed Mar 26, 2025 9:23 pm

chomiumwindow1 and listbox

Post by reel.time »

I've modified the 'uSimpleBrowser' demo but I loose the 'activecontrol' once the chomiumwindow1 loads the content.

I have a listbox containing 20,000 png file names referring to files on disk. When the item in the list is clicked on, the file is loaded into the browser. However, even though the activecontrol is set to the list box, the 'down arrow' and 'up arrow' are not operational to select the next or prior item in the list. The arrows keys operate against chomiumwindow. The listbox must be clicked and then the arrow keys become functional to load the item but then the chomiumwindows still regains control over the arrow keys.

I've even added a timer for 200 ms to always set the active control to the listbox.

Does anyone have a recommended solution to using the arrow keys?
Thanks
reel.time
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: chomiumwindow1 and listbox

Post by salvadordf »

Hi,

Try setting ChromiumWindow1.ChromiumBrowser.DefaultWindowInfoExStyle to WS_EX_NOACTIVATE before the ChromiumWindow1.CreateBrowser call.
reel.time
Posts: 3
Joined: Wed Mar 26, 2025 9:23 pm

Re: chomiumwindow1 and listbox

Post by reel.time »

Nope. Setting ChromiumWindow1.ChromiumBrowser.DefaultWindowInfoExStyle to WS_EX_NOACTIVATE before the ChromiumWindow1.CreateBrowser didn't work. :(
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: chomiumwindow1 and listbox

Post by salvadordf »

Use the TChromium.OnSetFocus event to cancel setting the focus to the browser.

Add this line in TForm1.FormCreate

Code: Select all

ChromiumWindow1.ChromiumBrowser.OnSetFocus   := ChromiumBrowser_OnSetFocus;
And implement the TChromium.OnSetFocus event like this :

Code: Select all

procedure TForm1.ChromiumBrowser_OnSetFocus(Sender: TObject; const browser: ICefBrowser; source: TCefFocusSource; out Result: Boolean);
begin
  Result := True;
end;
reel.time
Posts: 3
Joined: Wed Mar 26, 2025 9:23 pm

Re: chomiumwindow1 and listbox

Post by reel.time »

That worked beautifully.. Thank you SO very much!!!!!!! :D :D :D :D
Post Reply