Category: Firemonkey

What is the best general way to pre-set username and password INPUT fields inside a Website loaded at TWebBrowser FMX

What is the best method and general solution to get input fields username and password pre-set from inside an application for an loaded Website inside Delphi TWebBrowser FMX? For example: Var iuser,ipassword: String; ... WebBrowser.URL := www.facebook.com; WebBrowser.Navigate; WebBrowser.EvaluateJavaScript( '<script>' + 'var e = document.getElementById("email");' + 'e.value = "' +iuser+'";}' + 'var s = document.getElementById("pass");' + 's.value = "' +ipassword+'";}' + '</script>' ); The above way seems not to work (fields are empty and after calling code a second time causing error) and this way is even not general, because the ID for username and password will be different on most websites.
Read More

TMS RADical WEB, connecting to data

As Delphi developers we are used to frameworks and components to take the chore out of using databases. Ever since Delphi 1, database handling was abstracted by the TDataSet & TDataSource. Wouldn’t it be nice (and mainly productive as this is what is important after all) if this exact abstraction model allowed us to create web applications consuming data? Exactly that goal is what we wanted to achieve with TMS WEB Core, only technically under the hood things are RADically different from the implementation of Delphi 1 like datasets and datasources. So, with TMS WEB Core, you have your DB-aware edit, label, combobox, datepicker etc… and these can be hooked up to a datasource and a datafield can be specified. The dataset though is in this case a wrapper component that will under the hood do its work getting data or updating data via the use of REST HTTP calls to microservices exposed on a data server. As our TMS XData product already provided exactly that: exposing your databases via REST HTTP calls, we extended it to have a web XData client component so you can from Delphi, create a web application against an XData client and hook up your DB-aware components to an XData dataset, pretty much the same way as you can for VCL or FMX native client applications.

For the sake of demo purposes, we have created a first sample app with a web client dataset. This web client dataset gets its data in JSON format from a server via a HTTP REST call. This allows to view and edit the data in the web client dataset but won’t do updates server side so that it isn’t possible to ‘fiddle’ with the data and break the sample this way.

Here you can see a form editing contact info with several DB-aware controls, including a DB-navigator.

When the dataset is connected to the server, the DB-aware controls display and can edit the data.

Connecting to an XData based server is one possible way to hook up to databases. You can implement your own interfaces to a database server via REST HTTP calls and over-time we plan to create and offer connectors to such server as Embarcadero RAD server, Google Cloud datastore and several others…

Get started today: Technical previews of TMS WEB Core, TMS FNC UI web-enabled controls, web-enabled TMS XData, the first parts under the TMS RADical WEB umbrella are exclusively available now for all active TMS-ALL-ACCESS customers.

Read More

Read More

Delphi: How to include resources into a component relativ to this component

I'm trying to create a Delphi component. This component needs some images which are included with {$R *.res *.rc} in this unit. Additional I have a Delphi BPL project which contains this component. I can compile, build and install this project without problems. The problem comes when I try to use this component in other projects which are not in the same directory. There I get the error that he could not find the .res-file. Only when I include the .rc-file in these other projects or when I change {$R *.res *.rc} to absolute paths it works. But both solutions I don't like. What I want is to include only the .pas-file and then the compiler should find the corresponding resources based on {$R *.res *.rc}. Is this possible and if yes how? NOTE: The path to the .pas- and rc-file is inside of the searchpath. I'm using Delphi 10 Seattle and it is a FMX-component.
Read More

TMS RADical WEB, proud to announce a revolutionary & innovative UI control set that is TMS FNC for web

Over two years ago, we did deep research at TMS to create a UI control abstraction layer that would allow to create UI controls that can be used to create VCL Windows applications, FMX cross platform applications for Windows, iOS, Android, macOS and al… … Read More

Read More

RAD Studio 10.2.2 Tokyo February 2018 Patch Re-Released

Last week, Embarcadero released a patch for Tokyo 10.2.2, focused on Android and RTL improvements. What happened is that Windows would not always ask for execution with admin account (on systems with active User Account Control) and could end up copying the replacement files in a wrong location. It did affect a few of the developers who tried it, so we pulled it, fixed the installer and now re-issued the patch. If you are a registered user of Tokyo (or have a license for it), you can find it at https://cc.embarcadero.com/item/30819. There is no change in the content on the patch, so if you already installed it successfully, there is no need to repeat the process. On the other hand, if your installation got broken, we have provided an alternative ZIP-based option (in the same download page). We have already sent it to developers who had got in trouble, but might not have reached everyone. As for the content, the main fix is the Android animations and tab animation issue. These have been addressed. There are still cases in code where the combination of called to Application.ProcessMessages and timers might get you in trouble. I'll blog more information ASAP, but the general recommendation is to use threads rather than timers for background processing -- an all platforms, although in Windows that coding style can be used.   Updated Notice: Ony for 10.2.2 Build 2004  We had a notice in the download page, but better repeat it here. The patch is only for the second build of 10.2.2 we released, build 2004. If you have the previous build (which had compatibility problems with third party packages) don't install the patch. Either wait for a future update (if you don't specifically need the fixes the patch provides) or install build 2004 first. The link to 2004 installer is in the patch download page.
Read More

Firemonkey TListBox.OnClick – which item is clicked?

Delphi 10.2.2 mobile Starting with a blank mobile project, I drop a TListBox on the form. I add two TListBoxItems. procedure TForm1.ListBox1Click(Sender: TObject); begin ShowMessage('ListBoxItem.itemindex = ' + ListBox1.ItemIndex.ToString); end; When I click on the first item in Windows and Macintosh, the OnClick() correctly reports that item index 0 has been clicked. When I click on the first item in mobile (iOS and Android) the OnClick() reports the item index as -1 (not 0 as it should). Then it goes on to highlight the first item. If I then click on the second item in mobile, the OnClick() reports the item index as 0 (not 1 as it should). Then it goes on to highlight the second item. How can I get the correct item in OnClick() when clicking in a TListBox on mobile?
Read More

TMS RADical WEB, RAD web development from the Delphi IDE

It cannot be denied that RAD component-based application development is the very foundation of Delphi software development. It is the foundation that got us all so excited since Delphi 1 in 1995. It got us not only excited but most of all very productive.

Encapsulation of UI controls and other functionality in components with easy access to properties, method and events is what lets developers focus on business logic and their problem domain rather than underlying technical tricks used to render the UI or access operating system functionality.
It is in this respect that our team went to great lengths to offer this RAD experience in the Delphi IDE that does not really have a web target.
With TMS WEB Core, all that is offered. Via File, New, Other, select a new TMS Web application and a new project is created with a first form ready to start building your application.

While the developer cannot really see this, technically, this is a VCL form but our IDE integration ensures that for this web form, only TMS web controls can be picked from the tool palette. This is the tool palette with the set of UI controls & components that is currently already available.

You can build your UI together this way like you did the past 23 years for VCL applications or the past 7 years for FMX applications. When you compile the application, a HTML file and Javascript file is produced. By default, the TMS WEB Core IDE integration launches a small TMS Web server for debugging purposes allowing the developer to see the application running in the browser. As such, the so familiar development cycle of designing forms, setting properties, adding event handlers, writing code and press F9 and see within a fraction of time the result running and working or have the capability to debug the application, is achieved.

Compared to VCL or FMX application form designing, there is an optional but very fundamental difference between VCL/FMX application forms and web forms. While it is perfectly possible to have the WYSIWYG model, i.e. what you see in the Delphi IDE form designer is what you get when running the web application, TMS WEB Core facilitates alternative ways. The web page design and layout can be fully created with HTML/CSS. It can be easily created by people with different talents than us software developers, i.e. graphic designers. TMS WEB Core allows for easily hooking up our forms with UI controls to pages designed with HTML & CSS. More about this technique will be covered in a separate blog.

My colleague dr. Holger Flick, Embarcadero MVP, brings it all together here:

Get started today: Technical previews of TMS WEB Core, TMS FNC UI web-enabled controls, web-enabled TMS XData, the first parts under the TMS RADical WEB umbrella are exclusively available now for all active TMS-ALL-ACCESS customers.

Read More

Read More