Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 46 to 60 of 886, page 4 of 60
<< previous next >>
TMS VCL WebGMaps
Creating moving markers on WebGMaps
Creating moving markers on WebGMaps
After a marker has been added with the method WebGMaps.Markers.Add(), it can be moved at a later time on the map by simply changing its longitude and/or latitude properties.
Example:
Button1 adds a marker on the center of the map.
procedure TForm3.Button1Click(Sender: TObject); begin webgmaps1.Markers.Add(webgmaps1.MapOptions.DefaultLatitude,webgmaps1.MapOptions.DefaultLongitude); end;
From button2, you can make the marker move in latitude direction with following code:
procedure TForm3.Button2Click(Sender: TObject); begin webgmaps1.Markers.BeginUpdate; webgmaps1.Markers[0].Latitude := webgmaps1.Markers[0].Latitude +0.01; webgmaps1.Markers.EndUpdate; end;
TAdvStringGrid
Property FilterType
Property FilterType
The grid has a new property FilterType that can be set to ftHide (default setting) or ftSuppress. With the default setting, during a filter operation the filtered rows are effectively hidden/removed from the grid, affecting the row indexes of all rows.
When the FilterType is set to ftSuppress, the filtered rows are just made invisible and are not affecting the row indexes. So, if you want to keep accessing grid cells with row indexes independent of filtering, the new option FilterType = ftSuppress can be used.
TMS RemoteDB
Setting SQL Server ApplicationName from client
Setting SQL Server ApplicationName from client
When using SQL Server at RemoteDB server side, you might want to make client to set ApplicationName parameter of server connection. You can achieve that by sending the parameter through a HTTP header “db-app-name", and using a middleware at server side to grab that value and set in connection. This approach can be used to set other server-side database connections from client side.
On server side:
threadvar ThreadApplicationName: string; procedure StartServer; var Server: THttpSysServer; Module: TRemoteDBModule; begin Server := THttpSysServer.Create; try Module := TRemoteDBModule.Create(''http://localhost:2001/tms/remotedb'', TDBConnectionFactory.Create( function: IDBConnection var Module: TConnectionModule; begin Module := TConnectionModule.Create(nil); // Use ThreadApplicationName to configure your connection if ThreadApplicationName <> '''' then Module.FDConnection.Params.Values[‘ApplicationName’] := ThreadApplicationName; Result := TFireDacConnectionAdapter.Create(Module.FDConnection1, Module); end ) ); Module.AddMiddleware(TAnonymousMiddleware.Create( procedure(C: THttpServerContext; Next: THttpServerProc) begin ThreadApplicationName := C.Request.Headers.Get(''db-app-name''); Next(C); ThreadApplicationName := ''''; end )); Server.AddModule(Module); Server.Start; WriteLn(''RemoteDB server running...''); ReadLn; finally Server.Free; end; end;
RemoteDBDatabase1.OnRequestSending := RequestSending; procedure TfmThreeTierAureliusRemoteDB.RequestSending(Sender: TObject; Req: THttpRequest); begin Req.Headers.SetValue(''db-app-name'', ''My Application''); end;
TMS FMX Cloud Pack
Enable external browser support for Google services
Enable external browser support for Google services
Note that the OAuth requests to Google API services from embedded browsers are no longer allowed. More info can be found here: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html?m=1
From now on authentication for Google API services will happen via an external browser window.
A new property ExternalBrowser was added to activate this feature. On Windows and Mac platforms this will work automatically. On Android and iOS some extra configuration is required.
Android
- In the Android Libraries section of the Target Platforms list of a project
- Disable the file “android-support-v4.dex.jar”
- Add the files “android-support-v13.jar” and “CustomTabs.jar” Both these files are located in the “Android-CustomTabs-Support” subfolder of the installation folder.
iOS
- Add the SafariServices framework to the SDK Manager by right-clicking the iOSDevice 64 target and clicking "Edit SDK". Click in the frameworks section and add a new framework based on the information below:
TMS FMX UI Pack
TTMSFMXRichEditor: Load RTF via a stream in TTMSFMXRichEditor
TTMSFMXRichEditor: Load RTF via a stream in TTMSFMXRichEditor
The TTMSFMXRichEditorRTFIO allows to load RTF from a file. It is also possible to directly load RTF from a stream though in the following way:
var ss: TStringStream; s: string; begin ss := TStringStream.Create; try ss.LoadFromStream(yourstream); s := ss.DataString; TMSFMXRichEditor.InsertAsRTF(s); finally ss.Free; end; end;
TMS FlexCel for VCL & FMX
Finding out which FlexCel version you are using
Finding out which FlexCel version you are using
Sometimes you want to know the exact FlexCel version you are using from inside your app, and you might also want to make sure you aren''t using a trial. You can use the following code to find out:
//The FlexCelIsTrial constant in FlexCel.Core is true if this version is a trial if FlexCelIsTrial then WriteLn(''ERROR: This is a trial version of FlexCel!''); //The FlexCelVersion constant in FlexCel.Core contains the current version. WriteLn(FlexCelVersion);
TMS FlexCel for VCL & FMX
Using strict xlsx files
Using strict xlsx files
TMS FlexCel v6.17 introduced full support for reading and saving strict xlsx files. Strict xlsx files are a different file format from normal xlsx files, and you can select them when doing a "File Save As..." in Excel:
Now the question is: Should I use normal or strict xlsx files? And the short answer is: Use normal xlsx files unless you have a non negotiable requirement from your customers to use strict xlsx.
The long answer can be found here.
TFormSize
Set the name of the registry for TFormSize programmatically
Set the name of the registry for TFormSize programmatically
TFormSize will normally automatically load the persisted settings before the form‘s OnCreate event is triggered, so there is no chance to programmatically change the FormSize properties in code before the settings are loaded.
So, to achieve what you want to do, set FormSize.SavePosition = false & FormSize.SaveSize = false end then, in the form’s OnCreate event, first set FormSize.SaveName and after that, set FormSize.SavePosition = true & FormSize.SaveSize = true and then call FormSize.LoadFormSettings.
TAdvSpreadGrid
Using the expression parser / evaluator
Using the expression parser / evaluator
The expression parser / evaluator of TAdvSpreadGrid, our spreadsheet component , can also be separately used. This expression evaluator is in the unit AdvFormula.
To use it, create an instance of the class TAdvFormula and it can be used in the following way:
var Fm : TAdvFormula; R: double; begin Fm := TAdvFormula.Create(self); try Fm.Expression := ''1+2''; if Fm.Calc(r) then showmessage(floattostr(r)); finally Fm.Free; end;
var Fm : TAdvFormula; R: double; begin Fm := TAdvFormula.Create(self); try fm.v[0] := 12; fm.v[1] := 25; Fm.Expression := ''V0+V1''; if Fm.Calc(r) then showmessage(floattostr(r)); finally Fm.Free; end; end;
TMS FMX WebGMaps
Detecting an action that will navigate away from the map on Android or iOS
Detecting an action that will navigate away from the map on Android or iOS
By using the OnBeforeNavigate event it''s possible to detect an action that will navigate away from the map on Android or iOS. If required the action can also be cancelled. Example:
procedure TForm1.TMSFMXWebGMaps1BeforeNavigate(Sender: TObject; var Params: TTMSFMXWebGMapsCustomWebBrowserBeforeNavigateParams); begin if Params.URL = ''https://www.google.com'' then Params.Cancel := true; end;
TMS MQTT
OnLog event
OnLog event
The OnLog event is triggered whenever the logger has a message to log. You can use this event to redirect the logging to where you want.
A simple example:
procedure TForm3.TMSMQTTLogger1Log(Sender: TObject; ALevel: TTMSMQTTLogLevel; AMessage: string); begin memo1.Lines.Add(AMessage); end;
TAdvStringGrid
RowSelectCount and SelectedRowCount
RowSelectCount and SelectedRowCount
RowSelectCount returns the nr. of disjunct selected rows.
SelectedRowCount returns the nr. of selected rows, irrespective of disjunct selection or normal selection or just cell selection.
TMS Cryptography Pack
How to run an application with TMS Cryptography Pack in iOSsimulator
How to run an application with TMS Cryptography Pack in iOSsimulator
To run an application with TMS Cryptography Pack in iOSsimulator, you have to add the path of the libCrypto.a, i.e. FullTMSCryptographyPackInstallationPath/libiOSDevice64 in the Search Path in Project/Options/Delphi Compiler.
TMS VCL WebGMaps
Make sure *.google.com is added to your trusted domains
Make sure *.google.com is added to your trusted domains
When you have configured your Internet Explorer in such way that the domains *.google.com do not belong to the trusted domains, TWebGMaps will not work. (TWebGMaps internally uses the IE ActiveX WebBrowser). So, in case nothing shows up in WebGMaps upon start, make sure to add *.google.com to your trusted domains via the Internet Explorer config.
TMS IntraWeb WebGMaps
TTIWWebGMaps authentication
TTIWWebGMaps authentication
It is recommended to use an API Key to authenticate your application with the Google Maps JavaScript API service. Retrieving an API Key is free and can be obtained at the Google Developers Console. Instructions can be found on this page: https://developers.google.com/maps/documentation/javascript/get-api-key
Make sure to enable the following APIs in Google’s Console:
- Google Maps JavaScript API
- Google Maps Directions API
- Google Maps Geocoding API
- Google Maps Geolocation API
The API Key should be assigned to the APIKey property, one time before the map is loaded, in the Form’s OnCreate event of an application.
Example:
procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin TIWWebGMaps1.APIKey := ''myAPIKey''; end;