Hello,
I am looking for an example how to set the zoom-controls in TTMSFMXWebbrowser.
In the source I found in the create constructor ( for Android):
FWebBrowser.getSettings.setBuiltInZoomControls(True);
FWebBrowser.getSettings.setDisplayZoomControls(False);
But I do not know how to set the controls visible by program.
Very interesting would be also how to set the zoom size by program.
Thanks
Pieter
(Pieter)
2
In the constructor of the form you can use the following code:
if TMSFMXWebGMaps1.NativeBrowser <> NIL then
begin
CallInUIThread(procedure
begin
try
TJWebBrowser.Wrap(TMSFMXWebGMaps1.NativeBrowser).getSettings.setDisplayZoomControls(True);
except
end;
end);
end;
Hy Pieter,
thats also interesting!
But my problem now is in TTMSFMXWebbrowser not in the GMap component.
If I use TTMSFMXWebbrowser in windows simple text is in readable size.
With Android the text is very small.
By swiping, the user can zoom the text bigger.
But I do not know how to save that zoom level and how to restore it when the next text is loaded.
greetings
Klaus
Pieter
(Pieter)
4
Hi,
You can use the following code, the base webbrowser is identical
if TMSFMXWebBrowser1.NativeBrowser <> NIL then
begin
CallInUIThread(procedure
begin
try
TJWebBrowser.Wrap(TMSFMXWebBrowser1.NativeBrowser).getSettings.setDisplayZoomControls(True);
except
end;
end);
end;
Ok thank you!
interesting link, I will look if I can use it.
greetings
Klaus
For all, who want to change the Textsize in the webbrowser by program, here is what works fine for me:
dropped spinedit and TMSFMXWebbrowser on a form.
added
USES
...
{$IFDEF ANDROID}
Androidapi.IOUtils,
Androidapi.JNI.Provider,
Androidapi.JNI.Embarcadero,
Androidapi.JNI.Webkit,
FMX.WebBrowser.Android,
FMX.Helpers.Android,
{$ENDIF}
and in the implementation:
procedure TForm2.FormCreate(Sender: TObject);
begin
if TMSFMXWebBrowser1.NativeBrowser <> NIL then
begin
CallInUIThread(procedure
begin
try
if TJWebBrowser.Wrap(TMSFMXWebBrowser1.NativeBrowser).getSettings.supportZoom then begin
spinbox1.Max := 10000;
spinbox1.RepeatClick := TRUE;
spinbox1.Value := TJWebBrowser.Wrap(TMSFMXWebBrowser1.NativeBrowser).getSettings.getTextZoom;
end;
except
end;
end);
end;
TMSFMXWebBrowser1.LoadHTML('<tr><td><b>mein kleiner Text</b> wird mit setTextZoom gr??er </td></tr>');
end;
procedure TForm2.SpinBox1Change(Sender: TObject);
begin
if TMSFMXWebBrowser1.NativeBrowser <> NIL then begin
CallInUIThread(procedure
begin
try
TJWebBrowser.Wrap(TMSFMXWebBrowser1.NativeBrowser).getSettings.setTextZoom( round(spinbox1.Value) );
except
end;
end);
end;
end;