0

Does anyone know, how to disable scrolling possibility of TWebBrowser control in a Firemonkey iOS / Android application? My goal is to get absolutely static element that will not react on touches and so on.

7
  • Have you tried Enabled? Sounds like what you want. Commented Mar 16, 2018 at 9:43
  • WebBrowser don't have Enabled in his properties Commented Mar 16, 2018 at 9:46
  • It is the FMX.Webbrowser.TWebbrowser, right? Documentation lists that property in TWebBrowser_Properties Commented Mar 16, 2018 at 9:49
  • yes it is FMX.Webbrowser but i tried enabled and it don't work Commented Mar 16, 2018 at 9:54
  • Have you tried WebBrowser1.Locked := true;? Commented Mar 17, 2018 at 9:04

1 Answer 1

1

There is no single setting or action that disables all user actions of the Fmx.TWebBrowser. But there is a feature you can use for your purpose.

The feature I refer to, is Fmx.WebBrowser.TCustomWebBrowser.CaptureBitmap documented here

Description

Captures the currently visible Web page as a bitmap.

This method returns a TBitmap object, which allows you to create, manipulate and store images in memory or as files on a disk. The scenario of the use of this method could be as follows: 1. Call this method to capture a visible Web page as a bitmap. 2. Hide a TWebBrowser control. 3. Display the bitmap and overlay other components (such as buttons or popups) on top of the bitmap.

In your case you would just hide the WB and display the bitmap.

Tested with the following code:

type TForm25 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; Edit1: TEdit; Image1: TImage; Timer1: TTimer; procedure Button1Click(Sender: TObject); procedure WebBrowser1DidFinishLoad(ASender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } bmp: TBitmap; public { Public declarations } end; implementation procedure TForm25.Button1Click(Sender: TObject); begin WebBrowser1.URL := Edit1.Text; end; procedure TForm25.Timer1Timer(Sender: TObject); begin bmp := WebBrowser1.CaptureBitmap; Image1.Bitmap := bmp; end; procedure TForm25.WebBrowser1DidFinishLoad(ASender: TObject); begin Timer1.Enabled := True; end; 

enter image description here

With the WB hidden, it cannot be operated on.

The timer (1000 ms) I added because my attempts to capture the image already in the OnDidFinishLoad() event did nöt succeed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.