-
Content Count
1608 -
Joined
-
Last visited
-
Days Won
36
Posts posted by Dave Nottage
-
-
1 hour ago, rvk said:No, unfortunately TWebBrowser.Document isn't available for FMX.
There is no Document property, however there is a way of accessing the underlying web view (ICoreWebView2 on Windows, JWebView on Android and WKWebView on macOS/iOS), e.g. on Android:
var LWebView: JWebView; begin if Supports(WebBrowser1, JWebView, LWebView) then // Do something with LWebView end;
That said, as time goes on the underlying web view (on all platforms) has had direct access to HTML removed, so it has become necessary to execute JavaScript to achieve the same thing. Unfortunately, TWebBrowser has only EvaluateJavascript, which does not support returning a result, so it's necessary to use the technique above to achieve this, as I've done in the WebBrowserExt feature in Kastri (demo here). Using TWebBrowserExt, ExecuteJavaScript could be called with cJavaScriptGetPageContents (from the DW.JavaScript unit), thus:
unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.WebBrowser, FMX.Controls.Presentation, FMX.StdCtrls, DW.WebBrowserExt; type TForm1 = class(TForm) WebBrowser1: TWebBrowser; Button1: TButton; procedure Button1Click(Sender: TObject); procedure WebBrowser1DidFinishLoad(ASender: TObject); private FWebBrowserExt: TWebBrowserExt; public constructor Create(AOwner: TComponent); override; end; var Form1: TForm1; implementation {$R *.fmx} uses DW.JavaScript; { TForm1 } constructor TForm1.Create(AOwner: TComponent); begin inherited; WebBrowser1.WindowsEngine := TWindowsEngine.EdgeOnly; // On Windows, unlikely to work with IE FWebBrowserExt := TWebBrowserExt.Create(WebBrowser1); end; procedure TForm1.WebBrowser1DidFinishLoad(ASender: TObject); begin FWebBrowserExt.ExecuteJavaScript(cJavaScriptGetPageContents, procedure(const AJavaScriptResult: string; const AErrorCode: Integer) begin // AJavaScriptResult should now contain the page contents end ); end; procedure TForm1.Button1Click(Sender: TObject); begin WebBrowser1.Navigate('http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm'); end; end.
2 hours ago, rvk said:Not sure whether that answer was wrong in 2017, but it's certainly incomplete now, given the above.
-
42 minutes ago, TTSander said:Then when I call
TJXcBarcodeScanner.JavaClass.startScan;
nothing happens.
Does this mean you've moved on from attempting to generate a custom classes.dex?
Going by their documentation, the init method needs to be called. (the one that takes a Context and a ScannerResult as parameters). This may present a problem because Delphi uses init as a method name for Java constructors, and XcBarcodeScanner has its own static method called init (which is not a constructor), so the JNI code may actually try and find a constructor method (and fail) rather than the actual method called init. I'm not sure if there's a solution for this yet, other than writing Java code of your own (that you would call from Delphi) that uses the XcBarcodeScanner class.
Incidentally, I've managed to acquire the .jar file myself using information from the Github link you gave.
-
2 hours ago, TTSander said:It's an SDK for connecting to the barcode scanner of MovFast-handhelds. I extracted the .jar-file from the supplied .aar file
I've tried searching for this with not much success. Do you have a link?
-
5 minutes ago, TTSander said:I'm trying to generate a custom classes.dex file for our android app because I need to include a specific .jar-file
What is the jar file, and is there some reason why just adding the jar to the project is not sufficient?
-
In your unit, is there a debug info directive? i.e. if you have {$D-} or {$DebugInfo Off}, it will not include debug info.
-
What kind of Mac do you have? i.e. is it an M1 or M2, or an Intel-based Mac?
-
2 hours ago, Fudley said:However it is never overwritten
Overwrite can be somewhat misleading. It refers to what happens when the file is deployed from the local file to the application package, not whether the file is overwritten when the app starts - this process occurs in the System.StartUpCopy unit (in the rtl\common folder of the Delphi source), and as evidenced by line 83 (at least in Delphi 12.1):
if not FileExists(DestFileName) then //do not overwrite files
..when the files are put in their final destination, if the file exists it is not overwritten. A couple of possible workarounds:
1. Patch the System.StartUpCopy unit so that it does overwrite
2. Use files with "versioned" filenames, e.g. fudley-1.0.0.db, and replace the entry in the deployment with the new version. In your apps startup code, look for files using pattern matching, e.g:uses System.IOUtils; procedure TForm1.FormCreate(Sender: TObject); var LDBFiles: TArray<string>; begin LDBFiles := TDirectory.GetFiles(TPath.GetDocumentsPath, 'fudley-*.db', TSearchOption.soTopDirectoryOnly); // If there's only ever one file, it should be the value in LDBFiles[0], so rename that to fudley.db end;
-
Does it work if starting a completely blank app, and putting a TEdit on the form? It works OK here
-
1
-
-
17 minutes ago, Lars Fosdal said:Took me a while to get past all the Ios island travel tips before finding this: https://developer.apple.com/design/human-interface-guidelines/live-activities
Same thing happened to me re Ios Island 🙂
Following the live activities link leads to: https://developer.apple.com/documentation/ActivityKit/displaying-live-data-with-live-activities
Which talks about using Widget Extensions, which are yet to be possible in Delphi, however there's a slim chance that the extension can "talk" to Delphi code: https://blog.grijjy.com/2018/11/15/ios-and-macos-app-extensions-with-delphi/
I have very little optimism about the possibility
-
2
-
1
-
-
35 minutes ago, Peter J. said:can we define this anywhere? i looked through Project Options but there is nothing to override.
Correct - I have reported this nearly 2 years ago: https://quality.embarcadero.com/browse/RSP-38976
-
1
-
-
6 hours ago, Peter J. said:I don't even have sdk 32 installed!
targetSdkVersion refers to the highest API level that your app can target, not which API level in your SDK that you built against. If Play Store says your app targets API level 32, check AndroidManifest.xml in the project output folder for which you built the app for Play Store. You may just need to do a clean and rebuild to ensure that AndroidManifest.xml is updated.
-
21 minutes ago, Peter J. said:It's clearly stated that Delphi 11.3 supports Android 13 (sdk 33.0).
This says otherwise: https://blogs.embarcadero.com/delphi-supports-android-api-33-via-yukon-beta/
Please see also:
-
On 3/21/2024 at 5:44 AM, Rollo62 said:The ExoPlayer in its old form is deprecated, does this Alcinoe library also works in the new Media3-Version?
No - the Alcinoe implementation is based on the old ExoPlayer (in the com.google.android.exoplayer2 namespace). I am working on an implementation that uses Media3, but only just today have experimental code working that plays a video from a nominated URI.
-
2
-
-
On 3/19/2024 at 6:10 PM, TurboMagic said:Can I create a dynamic or static library some other iOS programming environment can consume?
-
1
-
-
2 minutes ago, Fudley said:How to browse for image files on the users android phone.
Is this possible without using intents?
Browsing outside of the application itself requires intents.
2 minutes ago, Fudley said:If not, is there a library which can be used for this?
You could use Kastri, which has this Files Selector demo.
-
2
-
-
6 hours ago, InfoHills said:Refactoring a legacy application to reduce the usage of global variables is a good step towards improving its maintainability and readability.
Straight Outta ChatGPT
-
9
-
-
1 hour ago, xorpas said:how reolve it ?
Which version of Delphi are you using, and which target? i.e. Android 32-bit, or Android 64-bit? If you're using Delphi 11.3 and are compiling for Android 64-bit, please see this link.
-
1
-
-
-
On 3/10/2024 at 10:58 PM, Juande said:I create a blank app in Android with only a button and the splash screen disabled
I'm curious as to what settings you changed to disable the splash screen. I can't work it out - I unchecked "Include Splash Images" but it still shows the splash. I guess there's more to it than that?
-
I'm looking at extracting compiler options from .dproj files, and looked for an existing "map" of options to PropertyGroup entries, but came up blank, so I figured I'd create one. I'm hoping that others could help verify what I've come up with as well as fill in some blanks. The following was created from the output of the help from dcc32, and from looking through the DCCStrs unit for what appears to match. The value from DCCStrs is on the line following each option. The numbers after some of the DCCStrs value are what also appear in the DCCStrs source. Those I couldn't match are signified with: ???
Compiler Options: -A<unit>=<alias> = Set unit alias DCC_UnitAlias -B = Build all units DCC_BuildAllUnits -CC = Console target DCC_ConsoleTarget -CG = GUI target ??? -D<syms> = Define conditionals DCC_Define -E<path> = EXE/DLL output directory DCC_ExeOutput -F<offset> = Find error DCC_FindError -GD = Detailed map file DCC_MapFile -GP = Map file with publics DCC_MapFile -GS = Map file with segments DCC_MapFile -H = Output hint messages DCC_Hints -I<paths> = Include directories DCC_IncludePath -J = Generate .obj file DCC_ObjOutput -JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all ??? -JL = Generate package .lib, .bpi, and all .hpp files for C++ ??? -K<addr> = Set image base addr DCC_ImageBase -LE<path> = package .bpl output directory DCC_BplOutput -LN<path> = package .dcp output directory DCC_DcpOutput -LU<package> = Use package DCC_UsePackage -M = Make modified units DCC_MakeModifiedUnits -NU<path> = unit .dcu output directory DCC_DcuOutput -NH<path> = unit .hpp output directory DCC_HppOutput -NO<path> = unit .obj output directory DCC_ObjOutput -NB<path> = unit .bpi output directory DCC_BpiOutput -NX<path> = unit .xml output directory DCC_XmlOutput -NS<namespaces> = Namespace search path DCC_Namespace -O<paths> = Object directories DCC_ObjPath -P = look for 8.3 file names also DCC_OldDosFileNames -Q = Quiet compile DCC_Quiet -R<paths> = Resource directories DCC_ResourcePath -TX<ext> = Output name extension DCC_OutputExt -U<paths> = Unit directories DCC_UnitSearchPath -V = Debug information in EXE DCC_DebugInfoInExe -VR = Generate remote debug (RSM) DCC_RemoteDebug -VT = Debug information in TDS DCC_DebugInfoInTDS -VN = TDS symbols in namespace ?? -W[+|-|^][warn_id] = Output warning messages DCC_Warnings -Z = Output 'never build' DCPs DCC_OutputNeverBuildDcps -$<dir> = Compiler directive DCC_Define Compiler Toggles: A8 Aligned record fields DCC_Alignment (0, 1, 2, 4, 8) B- Full boolean Evaluation DCC_FullBooleanEvaluations C+ Evaluate assertions at runtime DCC_AssertionsAtRuntime D+ Debug information DCC_DebugInformation (0, 1, 2) [Depending on platform?] G+ Use imported data references DCC_ImportedDataReferences H+ Use long strings by default DCC_LongStrings I+ I/O checking DCC_IOChecking J- Writeable structured consts DCC_WriteableConstants L+ Local debug symbols DCC_LocalDebugSymbols M- Runtime type info DCC_RunTimeTypeInfo O+ Optimization DCC_Optimize P+ Open string params DCC_OpenStringParams Q- Integer overflow checking DCC_IntegerOverflowCheck R- Range checking DCC_RangeChecking T- Typed @ operator DCC_TypedAtParameter U- Pentium(tm)-safe divide DCC_PentiumSafeDivide V+ Strict var-strings DCC_StrictVarStrings W- Generate stack frames DCC_GenerateStackFrames X+ Extended syntax DCC_ExtendedSyntax Y+ Symbol reference info DCC_SymbolReferenceInfo (0, 1, 2) [Depending on platform?] Z1 Minimum size of enum types DCC_MinimumEnumSize (1, 2, 4)
-
1
-
-
1 hour ago, Stano said:Is TFrame problem free?
The biggest problem is when you create descendant forms (i.e. at design-time) where the ancestor contains frames. Otherwise, for me they're totally fine.
-
1
-
-
18 minutes ago, bcvs said:When I read the documentation and different tutorials and forum posts this seems to be easyly done:
Which forum posts, and which tutorials?
19 minutes ago, bcvs said:Notification.SoundName:= MySoundfile;
Sounds on Android are no longer associated with the notification itself, rather they are now associated with the channel via the SoundName property.
Note that you need to add the mp3 file to the deployment using a RemotePath of res\raw, and use the filename without the extension for the SoundName on the channel, e.g. for mysound.mp3, use a value of mysound for SoundName.
On iOS, you need to deploy the sound file with a RemotePath of .\, and use the actual filename for SoundName on the notification (i.e. not the channel)
-
1 hour ago, AlanScottAgain said:I was looking at the Grijjy CloudLogger as an option.
Is using the Console app to view log statements not an option?
-
1
-
1
-
-
Just now, Robert Gilland said:I want to rearrage the order of the projects contained within, how do I do that?
Select a project in Project Manager, use Ctrl-Up or Ctrl-Down to move it up/down the list
-
3
-
Delphi Android Intent while App is active creates black screen
in FMX
Posted
Are you using the latest released version? i.e. Codex 2.2.0? If so, I'll revisit this since I haven't looked at it since upgrading to 12.1.