이 피터 존슨, How to make a TWebBrowser become the active control when clicked에 의해 다음 문서에서 설명합니다.
기사에서 더 많은 세부 사항이
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's active control
(Sender as TWebBrowser).SetFocus;
Doc.parentWindow.focus;
end;
end;
, 당신이 모든 것을 읽을 수 있는지 확인 바랍니다 :
이 OnCommandStateChange
이벤트를 추가, 크게 요약합니다.
그래서 별도로 질문하는 것이 가장 좋습니다. 그래서 요점은 고품질 응답을 가진 질문 저장소를 만드는 것입니다. 당신이 당신의 질문에 대해 두 가지 대답을 얻으면, 당신은 동의 할 것인가? – Argalatyr
의미가 있습니다. 앞으로 별도의 질문을 드리겠습니다. Jason. –