Keesver
Members-
Content Count
86 -
Joined
-
Last visited
-
Days Won
2
Keesver last won the day on February 10
Keesver had the most liked content!
Community Reputation
23 ExcellentRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Please check out a-dato/FMX-GRID: This library includes visual grid control, data models, binding system. Data models are extendible at runtime so that users can add/remove properties from objects. I can share a link to our demo application so that you can test it yourself.
-
Putting Delphi Application inside web page
Keesver replied to Robert Gilland's topic in Delphi Third-Party
We are also a satisfied user of Thinfinity. We have a 40 user license and run 2 VM's behind a gateway (also part of Thinfinity). Works pretty good. Support is good. Pricing is ok, especially since users are counted as 'concurrent' users (as opposed to named users). -
Serialize/Deserialize Enums with no RTTI
Keesver replied to Larry Hengen's topic in RTL and Delphi Object Pascal
Hello, I learned something new as I didn't know such types do not have RTTI. Any property of such type is hidden when you try to get the properties from a object. This makes it impossible to do automatic marshaling. Delphi does support custom marshalling using TJSONMarshal (Serializing User Objects - RAD Studio (embarcadero.com)) that allows registration of marshaling functions: procedure RegisterConverter(clazz: TClass; const func: TTypeObjectConverter); Another option would be to add attributes to your classes to identify these properties and then write your own marshaller that looks at these attributes: Something like this should work: TEnum1 = (Value1=20, Value2=40); TEnum1Helper = record helper for TEnum1 function ToString() : string; end; [TJsonEnumproperty('En', UnmarshalFunc, MarshalFunc)] TObjectWithhEnum = class private _id: Integer; _en: TEnum1; published property ID: Integer read _id write _id; property En: TEnum1 read _en write _en; end; Your marshal method then looks at the attributes defined for the class and then call the MarshalFunc/UnmarshalFunc. Alternatively you can use interfaces to achieve the same. ICustomMarshalling = interface ['{E799D069-66B8-464D-B718-78D5D4DB6747}'] procedure Marshal(M: TJsonMarshal); procedure UnMarshal(M: TJsonUnMarshal); end; TObjectWithhEnum = class(TObject, ICustomMarshalling) private _id: Integer; _en: TEnum1; proteced procedure Marshal(M: TJsonMarshal); procedure UnMarshal(M: TJsonUnMarshal); published property ID: Integer read _id write _id; property En: TEnum1 read _en write _en; end; In this scenario your custom marshaller checks if your class implements the ICustomMarshalling interface and calls the appropriate methods. Like to see what solution you come up with... -
Converting images to JSON and Send to Server
Keesver replied to JIMSMITH's topic in Network, Cloud and Web
You can encode the image using Base64 encoding. ChatGPT came up with this sample code. Calling TNetEncoding.Base64.EncodeBytesToString(Bytes) will do the actual conversion: uses System.JSON, System.SysUtils, System.Classes, System.NetEncoding; function ImageToBase64(const FilePath: string): string; var FileStream: TFileStream; Bytes: TBytes; begin FileStream := TFileStream.Create(FilePath, fmOpenRead); try SetLength(Bytes, FileStream.Size); FileStream.ReadBuffer(Pointer(Bytes)^, FileStream.Size); Result := TNetEncoding.Base64.EncodeBytesToString(Bytes); finally FileStream.Free; end; end; procedure SaveImageBase64ToJson; var JSONObject: TJSONObject; Base64String: string; JSONString: string; JSONFile: TStringList; begin Base64String := ImageToBase64('path/to/image.jpg'); JSONObject := TJSONObject.Create; try JSONObject.AddPair('name', 'Example Image'); JSONObject.AddPair('image_data', 'data:image/jpeg;base64,' + Base64String); JSONString := JSONObject.ToString; JSONFile := TStringList.Create; try JSONFile.Text := JSONString; JSONFile.SaveToFile('image_base64.json'); finally JSONFile.Free; end; finally JSONObject.Free; end; end; -
ApplyStyleLookup is repeatetly called after a DPI change when using TDateEdit
Keesver replied to Keesver's topic in FMX
This problem has more side effects than expected, after moving a form to a screen with different DPI, the whole form will be re-styled every time a drop down is opened. We filled a report for it: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-824?sda_source=notification-email Workaround, copy file FMX.Platform.Win to your project then update this method: function TWinWindowHandle.GetScale: Single; begin if not SameValue(FForcedScale, 0, TEpsilon.Scale) then Result := FForcedScale else if not SameValue(FCurrentScale, 0, TEpsilon.Scale) then Result := FCurrentScale // Add these lines, this will force the scale of the popup control to be the same as the scale of the parent else if (Form <> nil) and (Form.FormStyle = TFormStyle.Popup) and (Form.ParentForm <> nil) then Result := Form.ParentForm.Handle.Scale else Result := GetWndScale(FWnd); FCurrentScale := Result; end; -
Using TNetHttpClient should do the trick and provide HTTPS support without any dll's.
-
(Kastri) Receiver not registered: null exception when creating TLocalReceiver
Keesver replied to Keesver's topic in FMX
Fixed it by adding dw-kastri-base-3.0.0.jar to the project. -
I'm not using the demo app, I started a new project. I missed this step however, thanks for your info.
-
Hello, I'm using class TLocalReceiver from a Kastri sample application. When I create a new instance from this class I run into an exception: Project BroadCast.apk raised exception class EJNIFatal with message 'Java type com/delphiworlds/kastri/DWMultiBroadcastReceiverDelegate could not be found'. In the source code I find this: [JavaSignature('com/delphiworlds/kastri/DWMultiBroadcastReceiverDelegate')] JDWMultiBroadcastReceiverDelegate = interface(IJavaInstance) ['{1AD78992-D81F-48A4-B341-F82B43094B67}'] procedure onReceive(context: JContext; intent: JIntent); cdecl; end; which tells me the type should have been be registered (I have this file included in the uses of my test application). What am I missing here, do I have to add code to my application to register this class?
-
(Kastri) Receiver not registered: null exception when creating TLocalReceiver
Keesver posted a topic in FMX
Hello, I'm trying to get the Foreground service demo application to work in Delphi 12. Therefore I copied the files to a new project, checked the manifest files and I got everything set as it should. However when I start the service, an exception is raised inside the service create method: constructor TServiceModule.Create(AOwner: TComponent); begin inherited; TOSLog.d('TServiceModule.Create - 1'); FLocalReceiver := TLocalReceiver.Create(Self); <-- java.lang.IllegalArgumentException: Receiver not registered: null TOSLog.d('TServiceModule.Create - 2'); FService := TJService.Wrap(System.JavaContext); TOSLog.d('TServiceModule.Create - 3'); CreateNotificationChannel; TOSLog.d('TServiceModule.Create - 4'); end; I think I'm missing something, what should be done to 'Register' a receiver? Thanks -
## Free version A free version is available which is actually quite capable. The free version is named FMX-GRID. This version can be used by any number of developers and offers royalty free distribution of applications. The free version is published under the MIT license ## Commercial version FMX-GRID-MODEL is a commercial product. It adds model support and property binding for easy creation of user interfaces. A license is required per developer. Licenses are valid for 12 months, a subscription is required to keep licenses valid. Subscriptons must be renewed after the end date. If you are renewing your license before (or up to 30 days after) the current expiration date, the new expiration date will be calculated based on the original order date. Updates are only available to users with a valid license.
-
We are in a similar situation and support a desktop, mobile, web and MacOs application from a single code base. We use a grid control written by our company which is also publicly available at Git-hub (GitHub - a-dato/FMX-GRID). This is more than just a grid control, as it supports light weight data binding and custom collections, sorting and more. You are welcome to check it out.
-
Seeking help to make Geofencing on Android work in a Delphi app
Keesver replied to Dave Nottage's topic in Cross-platform
What is the current state of this project? I'm looking for something like this. Looks like it made it into Kastri. Will check there first.... -
Delphi 12 - 'Bind Visually' -> StringGrid connection works very slowly
Keesver replied to Rafal.B's topic in Databases
Delphi 12 Version 29.0.50491.5718: I just did a small test on a fast MSSql server with a similar query on a very large table and I do not see such a delay. The data is shown quickly. I'm just using FDConnection and FDQuery. Probably your setup is different or your table contains some (big) blob's that are fetched? Also tried ADOConnection/ADOQuery, this was actually a little bit faster. Please provide a sample.