Two quick questions
How to set focus on TWebBrowser? This means that the mouse wheel scrolls the display without first clicking in the TWebBrwoser display area. It has a setfocus method that does nothing (or seems to do nothing).
Inside TWebBrowser, right-click the displayed link and select properties. The OK and Cancel buttons are disabled, and you cannot close the dialog box. You need to complete the task of your application in order to kill it.
Any ideas?
Thanks, Jason.
Answer question 1 after much searching on the Internet ....
with WebBrowser1 do if Document <> nil then with Application as IOleobject do DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser1, 0, Handle, GetClientRect);
, TWebBrowser .
, OnCommandStateChange:
OnCommandStateChange
procedure TWebBrowserFrame.CommandStateChange(Sender: TObject; Command: Integer; Enable: WordBool); var Doc: IHTMLDocument2; // document object Sel: IHTMLSelectionObject; // current selection begin // Check we have a valid web browser triggering this event if not Assigned(Sender) or not (Sender is TWebBrowser) then Exit; // Check we have required command if TOleEnum(Command) <> CSC_UPDATECOMMANDS then Exit; // Get ref to document object and check not nil Doc := Browser.Document as IHTMLDocument2; if not Assigned(Doc) then Exit; // Get ref to current selection Sel := Doc.selection as IHTMLSelectionObject; // If selection is of correct type then we have a mouse click if Assigned(Sel) and (Sel.type_ = 'Text') then begin // Make the web browser the form active control (Sender as TWebBrowser).SetFocus; Doc.parentWindow.focus; end; end;
, , .
Source: https://habr.com/ru/post/1709257/More articles:Как заставить Visual Studio автоматически добавлять ссылки, когда я добавляю проект в решение? - referenceIs there a better way than int (byte_buffer.encode ('hex'), 16) - pythonpackage for loop using brackets in command - for-loopRegex to extract movie name from file name - regexHow do you apply extension-based methods? - unit-testingPHP / JavaScript. The browser "downloads" forever, even after all resources are completed, as well as problems with Opera / Chrome - javascriptКак конкатенировать имена переменных в javascript? - javascriptEC2onRails + SSL + Apache: no response to port 443 - ruby-on-railsCreate RSS RSS feeds (MRSS) in ASP.NET 3.5 - asp.netKeep order in HTML list without updating every row in database? - javascriptAll Articles