Are these really Windows compiler unsupported Delphi Intrinsic Routines?

Odd, the [WayBack/Archive.is] Delphi Intrinsic Routines – RAD Studio indicates quite a few compiler intrinsics are not available on Windows. I wonder if this list is correct: Routine Description DCC32 DCC64 DCCOSX DCCAARM DCCIOSARM DCCIOSARM64 DCCIOS32 System.AtomicCmpExchange AtomicCmpExchange is used for comparing and exchanging memory values. System.AtomicDecrement AtomicDecrement is used for decrementing memory values. System.AtomicExchange […] … Read More

Read More

Adding the 3rd dimension to TMS WEB Core

Our team is working hard on the next major release of TMS WEB Core. This will be TMS WEB Core v1.2 Padua. Padua is the next city after Brescia (1.0) and Verona (1.1) on our Mille Miglia race track.

We have shown already a preview of the support for Electron based cross platform desktop apps that will come out of the box with TMS WEB Core v1.2. The new version 1.2 will also come with numerous Object Pascal to JavaScript transpiler enhancements (Pas2JS v1.4) with most importantly the support for anonymous methods. There is a lot more coming that we will unveil in the coming weeks!

With this blog, we wanted to take you to the 3rd dimension that will be added to TMS WEB Core in v1.2, that is the support for 3D graphics based on the amazing WebGL / ThreeJS technology. Thanks to this technology, rendering 3D scenes is fluid and fast right out of any modern browser. This means Chrome, FireFox, Opera, Safari on desktop and on mobile devices.

The WebGL / ThreeJS technology is powerful but it can be quite complex and daunting. Here comes the TMS WEB Core framework with easy usable classes for taking advantage of this technology.

In the upcoming TMS WEB Core this will be exposed via 3 UI controls:

  • TWebThreeJSPaintBox
  • TWebThreeJSChart
  • TWebThreeJSMathChart

Custom 3D scenes with TWebThreeJSPaintBox

The TWebThreeJSPaintBox is a simple 3D scene renderer. Where in a regular 2D PaintBox you do the drawing with lines, rectangles, … here you can add 3D objects like cube, sphere, cylinder, text, lines, shapes, 3D models …

Adding a red sphere becomes as simple as:

var
  anObject: TThreeJsObject3D;

begin
  anObject := threeJsPaintBox.addSphere(2, clRed, 10, 8, 4);
  anObject.name := 'sphere1';
  threeJsPaintBox.Invalidate;
end;

This sphere object can now be manipulated or removed again by accessing the object by its name.

As such, the TWebThreeJSPaintBox allows to create any custom 3D scene easily using the ObjectPascal language.

3D business charts with TWebThreeJSChart

The next 3D control is the TWebThreeJSChart. This is a 3D chart with 3 axes. It allows to add series with their 3D values, select the chart type (bar, cone, line, area, cylinder, scatter) and the TWebThreeJSChart will do all that is necessary to setup the 3D scene to render the chart.

We have created a small & quick demo to demonstrate the power. This 3D chart visualizes the virtual sales results of Germany’s leading car manufacturers: Audi, BMW, Mercedes, Porsche. To make the data editable to let users play with the chart, it is displayed in a TWebStringGrid. It shows 4 columns for the sales results for the 4 car manufacturers and 12 months of the year. To configure the 3D chart from the results in the TWebStringGrid, the following code is used:

procedure TForm2.LoadSampleSeries;
var
  aSeries: TThreeJsChartSeries;
  brands: TJSArray;
  months: TJSArray;
  values: TJSArray;
  i,j,v: integer;
begin
  brands := TJSArray.new;
  months := TJSArray.new;

  // create the X-axis for the series filled with the car brand names from the string row header
  for i := WebStringGrid1.ColCount - 1 downto 1 do
    brands.push(WebStringGrid1.Cells[i,0]);

  // create the Y-axis for the series filled with the month names
  for i := 1 to WebStringGrid1.RowCount - 1 do
    months.push(WebStringGrid1.Cells[0,i]);

  // create the series in the 3D chart
  aSeries := TThreeJsChartSeries.Create(brands, months);

  // loop through the normal grid cells to pick the sales values and add these to the series
  for i := WebStringGrid1.ColCount - 1 downto 1 do
  begin
    values := TJSArray.new;
    for j := 1 to WebStringGrid1.RowCount - 1 do
    begin
      v := StrToInt(WebStringGrid1.Cells[i,j]);
      values.push(v);
    end;
    aSeries.addLegendRow(WebStringGrid1.Cells[i,0], values);
  end;

  // set the general 3D chart properties  
  aSeries.AutoMarkValueAxis := true;
  aSeries.valueFormatFloat := '#,##0';
  aSeries.valueAxisFormatFloat := ''; //use the above
  aSeries.Title := 'Monthly unit sales per brand';
  aSeries.ValueAxisTitle := 'Monthly Sales';
  aSeries.LegendAxisTitle := 'Brands';
  aSeries.CategoryAxisTitle := 'Months';
  threeJsChart.Series := aSeries;
end;

It is really as simple as this. Note that you just need to create the data series and it figures out the range of values automatically. It has an Auto range mode that is smart enough to figure out the vertical value range scale and its scale marking automatically based on the minimum and maximum values in data. You can also switch off the Auto range mode and supply your own scale marking when needed.
The code results in the following 3D chart or you can play with it directly from your browser.

Mathematical surfaces with TWebThreeJsMathChart

Finally, the last 3D control is the TWebThreeJsMathChart that is specialized in mathematical surface rendering, both with wireframe and solid surfaces.

TWebThreeJsMathChart is based on a TThreeJsMathChartSeries that is set for the 3D chart and this TThreeJsMathChartSeries implements a callback function that will query the mathematical formula calculation. The setup for the math chart and the X and Y range wherein the result needs to be calculated is set via:

begin
  aSeries := TThreeJsMathChartSeries.Create;
  aSeries.addParametricSurface(-10, +10, -10, +10, resolution, @surfaceCallBack);

  aSeries.Title := '3D Surface';
  aSeries.ZAxisTitle := 'Values';
  aSeries.YAxisTitle := 'Y-axis';
  aSeries.XAxisTitle := 'X-axis';

  threeJSMathChart.Series := aSeries;
end;

As we demonstrate a number of different mathematical functions to visualize in the demo, the callback function is implemented as:

function TForm2.surfaceCallBack(x, y: double): double;
begin
  // the function is selected via the combobox cbSeries
  case cbSeries.ItemIndex of
    1: Result := abs(x-y);
    2: Result := -x*x - y*y + 6;
    3: Result := sin(x)*x+cos(y)*y;
    4: Result := 2 * sqrt(x*x/3 + y*y/8);
    5: Result := sqrt(abs(1.5 * (x*x/3 - y*y/4) - 6));
    6: Result := 8 * (sin(x) + cos(y));
  else
    Result := x*x + y*y;
  end;
end;

It’s really nothing more than this before you can start drooling over the wonderful world of 3D mathematical functions.

You can see it live from your own browser here.

Get started

Meanwhile, you can go ahead and explore the new & exciting territories of web client development that become available for Delphi developers with TMS WEB Core! You can download the trial version that is generally available, go ahead with the standalone version you purchased or with TMS WEB Core and additional tools that are all included in TMS ALL-ACCESS. Our team looks forward to all your comments, feedback, feature-requests to help steering the development of TMS WEB Core to the next stages!

Read More

Read More

Enjoy more REST with FNC in the cloud

Intro FNC is going to the cloud! We are currently working very hard to bring FNC to the cloud in the form of a TMS FNC Cloud Pack with a set of the most popular ready-to-use cloud service implementations, but before you can throw yourself into this new bag of FNC cloud service candies, we wanted to give you an insight on what is coming and also ask you a question on which cloud service(s) you wish to see being added in the future. Cross-Platform / Cross-Framework FNC (Framework Neutral Components) is not a new story, you can find all about it on this page. FNC supports the following frameworks and platforms: FMX Windows macOS iOS Android VCL Windows LCL Windows macOS Linux WEB Classic PWA (Progressive Web Application) Electron So with FNC for the cloud, you will be able to target all of the above Frameworks and Platforms! Asynchronous While working on the FNC cloud core, we wanted to make sure that each action, whether it's retrieving a list of files, or uploading/download a file, is running seamless and doesn't interfere with the main thread. This makes your application responsive at all times and allows you to perform other tasks while waiting for the download/upload to finish, or the list of files to be loaded. This also gives the advantage that you can start multiple requests at once, and not having to wait until a specific request has finished. Of course, some requests require additional data that has been retrieved via another request, but we have made the request execution and data retrieval as flexible as possible. Below is a sample that shows the way the request is being made, and how the result is captured. procedure TRequestForm.DoRequestExecute(const ARequestResult: TTMSFNCCloudBaseRequestResult); begin //File Download Finished end; procedure TRequestForm.DownloadFile; var c: TTMSFNCSimpleCloudBase; begin c := TTMSFNCSimpleCloudBase.Create; try c.Request.Clear; c.Request.Host := 'http://myhost.com'; c.Request.Path := '/download'; c.Request.Query := 'fileid=123'; c.Request.Name := 'Download File'; c.Request.Method := rmGET; c.ExecuteRequest(DoRequestExecute); finally c.Free; end; end; There is even a small bonus when targetting FMX or VCL. You can catch the result via anonymous methods as well! Anonymous methods are also coming to TMS WEB Core in a future update, so it will be possible to not only target FMX and VCL, but also have this code working for the web! procedure TRequestForm.DownloadFile; var c: TTMSFNCSimpleCloudBase; begin c := TTMSFNCSimpleCloudBase.Create; try c.Request.Clear; c.Request.Host := 'http://myhost.com'; c.Request.Path := '/download'; c.Request.Query := 'fileid=123'; c.Request.Name := 'Download File'; c.Request.Method := rmGET; c.ExecuteRequest( procedure(const ARequestResult: TTMSFNCCloudBaseRequestResult) begin //File Download Finished end ); finally c.Free; end; end; One code base With FNC you can write your code once, and deploy it to several Frameworks / Platforms. This is also the case with FNC for the cloud. It relies on the TMS FNC Core and uses every aspect of FNC. You can write an old school VCL application and use the same code to target the recently and brand new PWA (Progressive Web Application) support in TMS WEB Core. Let us know for which Frameworks / Platforms you are writing an application with FNC. Custom development The FNC cloud core has been designed to allow you, as a developer, write a component for a service not supported out of the box in the upcoming TMS FNC Cloud Pack. There is already a lot of functionality built-in and accessible. The list below shows what can be done when writing your own service. Make GET, POST, PUT, UPDATE, DELETE and PATCH requests Support for multi-part form data via a separate form data builder class Built-in OAuth 2.0 authentication flow Built-in URL encoding, JSON parsing, file to Base64 encoding and many more Let us ask you a question We want to make sure we are not only providing a solid base for future development, we also want to know which service you are going to use. We already added a list of the most popular services, but we want to make sure that for future developments, we can accomodate to your needs. For this purpose, we want to ask you a question and vote on the service of your choice, or add a new one, if it's not already in the list. The list can be viewed at the following survey: https://www.survio.com/survey/d/N4J9X1C8L4V7K1U7V. Additionally, if you have any feedback, please comment on this blog. More REST We already want to thank you for filling in the survey and/or comment on this blog. The data will provide us with knowledge on how to improve our current developments and make the TMS FNC Cloud Pack even better. After all, we want you, as a customer, to enjoy more of that hard-earned REST after a full day of development. Stay tuned for more "FNC in the cloud" content coming in the near future!
Read More

Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other?

Interesting thread still: [WayBack] Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other? – Kyle Miller – Google+ Tools mentioned there (not limited to Delphi): From Database to Web App through REST server with TMS XData and TMS Web Core [WayBack] GitHub – andrea-magni/MARS: MARS-Curiosity Delphi REST Library [WayBack] GitHub – jeffknupp/sandman2: Automatically generate a RESTful API service for your legacy database. No code required! [WayBack] mORMot/RESTserver.dpr at master · synopse/mORMot · GitHub –jeroen  
Read More

Support is a built-in feature of TMS products!

At TMS, we are a team of software developers, developing software for software developers.
We do exactly the same as our customers are doing, that is developing software. And so we know all too well that when we are stuck with something, a fast helping hand is much appreciated.

That is why giving good and fast support is high on our priority list. That is why all our products come with minimum one year free support and free updates included. Yes, it is standard included in the product price, no extra costs at all, no limit on the number of questions!

Our support is handled in two ways: via a support online forum and by direct email for those who prefer a direct and private conversation.
For reasons of efficiency and quality of the support there is a very short line to the experts of the specific product support is asked for. In many cases, a direct dialogue is possible with the product expert.

On a daily basis, our support is standby for answering your questions about:

  • your account, licensing conditions, purchasing products, renewing licenses
  • doubts about product features, supported operating systems, supported IDEs
  • issues with installing products
  • doubts about a specific behavior in the product
  • advice for achieving a high performance implementation with our products
  • a problem, bug, unexpected behavior in a component

From time to time, our support is also contacted to request new product features or even new products. We very much welcome such questions and these have over the years steered the development of products in a significant way. For such suggestions, we enter in dialogue and make a judgment whether there is an estimated wide interest for a specific feature or not. When there is a wide interest, in many cases we take up the requested feature in the planning for a new development cycle of a product. When the request is very specific or of use only to a very small group of customers, we propose to deliver it as a custom paid development project.

We strive for satisfactory answers and solutions within 24hrs on work days. We’re glad to report that our statistics show we achieve this goal for over 80% of the questions!

Thinking about the words of the painter and genius Salvador Dali “Have no fear of perfection, you will never reach it”, we reflect on how we can get this number of 80% even higher.

That for sure is a challenge, given the technology landscape certainly didn’t become easier. Where in the early days of our company, we had only a few Delphi or C++Builder versions to support and one operating system Windows XP, these days there is a myriad of technology to deal with. Ever changing and updating operating systems Windows, macOS, iOS, Android, Linux. Always evolving browsers Chrome, Firefox, Opera, Safari, Edge. Cloud services we interface with that changes APIs. A vast amount of different SQL and noSQL databases. And so on… The number of combinations, parameters, versions, … is mind boggling. In a follow-up blog, we’ll discuss how the process of delivering fast & quality support in a complex technology landscape can be achieved with your help.

Without a doubt, you also have ideas, suggestions, feedback or comments about support in general, so we look forward to hear about these.

Read More

Read More

Happy Birthday Delphi!

Time flies as today we already celebrate the 24th birthday of Delphi. The past 24 years have been an amazing, adventurous and always exciting voyage!

Looking back at 1995, Delphi was nothing short of a dramatic breakthrough in productivity for software development.

Before, I still remember that creating a Windows application created with Turbo Pascal for Windows also required having the Resource Workshop tool ready. We’d typically create dialogs and other resources via the Resource Workshop. And then came the tedious process of linking the UI control logic to the elements on the dialog via IDs. One mismatching ID and the dialog would be broken. Other than this, we merely had to use the Windows API to achieve even the smallest UI feature.

Then came Delphi. No more need for Resource Workshop. Direct usage of the Windows API could be dramatically decreased as Delphi introduced the integrated form designer and more importantly the UI control model mapping on existing Windows controls but also open to extend and create custom controls, seamless binding to a database and even live design-time data. In a nutshell, us, Pascal developers could create Windows applications 10 times faster with 10 times more features.

The next 24 years continued that quest for packing ever more programming productivity and reaching out to new targets. Soon Win32 support was added in Delphi 2. The world of web development opened with the inclusion of the breakthrough product IntraWeb from Atozed. Ever more out of the box support for all kinds of databases, multi-tier development and internet server development found a place in successive Delphi releases. It was waiting till 2009 for the breakthrough to add Unicode support and 2011 to bring the power of Delphi to the 4 major operating systems: Windows, macOS, iOS and Android. We conveniently skip the short passages of bringing Delphi to Linux with Kylix and to the .NET framework world with Delphi 8

In a fast moving and ever changing technology landscape, one could wonder why someone can have this passionate relationship with Delphi?

For a change, let’s try to find an analogy with real estate instead of with cars 🙂 The three most important things when looking for real estate are: “Location, Location, Location”.

So, the three most important things for a Delphi developer are:

  • Component model: abstracting technology and allowing to focus on business problems instead of technology
  • Component model: allowing code reuse among developers in the team, across applications and across platforms
  • Component model: providing an access to 3rd party code libraries in a consistent way

There are of course many more virtues to the Delphi language, IDE and ecosystem and things to be passionate about. Backwards compatibility is one such example and a natural, expressive non-cryptic language is another one. Very fast compile times to facilitate quick debug cycles. The list goes on. Let us know your most loved Delphi features!

In these 24 years, TMS software evolved along with Delphi also quite a bit. Where in 1995, it was just “me, myself and I” encapsulating code in components initialy mainly for reuse in my own consulting projects, TMS has grown into a unique and fantastic team I am truly proud of!

Nothing is more fun than brainstorming with like-minded enthusiast experts about how we could make the Delphi developers even more product or reach into new territories. With every new introduced technology in Delphi, we jumped on the wagon and created components for it. Yes, back in the days, we even had our grid working in Kylix and also for Delphi for .NET . More succesful projects were the creation of a suite of UI controls for IntraWeb, the first FireMonkey components on the market for cross platform development, the leading Delphi ORM Aurelius, the REST server technology via XData, … the list is endless. Last year we introduced a new framework for developing in a really RAD way from the Delphi IDE rich & modern web client applications using our beloved language with TMS WEB Core. This goes hand in hand with our FNC UI control developments enabling to use one set of UI controls not only in VCL, FMX, LCL applications but also for TMS WEB Core web applications. And for the backend of the web applications, this integrates nicely and smoothly with our TMS XData REST server technology.

But it is not all new technology all the time. We continue to take great care, enhance, extend, improve and polish very widely used flagship products like TMS Component Pack, our set of over 400 VCL UI components that saw its life back in 1998. Especially for the birthday of Delphi today, we released an update 9.0.4.0 with all latest improvements. Of course, active registered users get this update free, for users with an expired subscription we have discounts to renew and for new users we have this week a 20% discount! See our other blog post for details!

Have a great Delphi Birthday today!

Read More

Read More

Igniting the passion for Delphi for future generations


A local school in the town where the TMS office is located organized last week for the kids a project where they could experience an entire day in a working place they dream of for their future career.
We had the pleasure to welcome Obama in our office. Obama is an 11-year-old boy who would love to become a software developer. We at TMS Software offered him the opportunity to follow us for a day and see what it takes to be a software developer. To inspire Obama and raise the interest of the next generation, we wanted to show Obama what a great variety of platforms we could tackle with our beloved tool Delphi and our frameworks. And what better way to captivate the youth then to create a game?

We choose the code-breaking game Mastermind that was invented in 1970 by Mordecai Meirowitz.
For those who don’t know the game, the purpose is to guess the code created by your opponent, or in this case the computer, by using four colored pegs. There are six colors to choose from and after each guess the opponent gives feedback on how many colors are correct and how many colored pegs are in the right position. In our game we decided that the red mark would indicate that the peg was in the correct place and a white mark if the color was used in the code, but not on the position you’ve guessed. To make it a little easier, we’ve also made sure that the colors are only used once and no empty spots are in the pattern.

If you already want to play our game before we explain how everything works, you can do this at www.tmssoftware.com/MasterMind.

As we wanted to show the power of our components and use it on almost every platform on the planet, it was a logical choice to work with our FNC components. This way we can use the same codebase to create a VCL, FMX and web application. A progressive web application to be precise. The advantages for a PWA application are clear:
– The application has a responsive design, this means that it adapts automatically to the device screen so it looks good on mobile and desktop.
– It is aware of status, it continues to work also when you are offline.
– You can install the application on mobile devices and Chrome OS, without going to a censored application store.
– It looks like a native application running full-screen with access to the hardware.
The only remark here is that it should initially be accessed via HTTPS. As you can see on both pictures below an example where you can see the web application on the left and then the downloaded app on the right which is launched as installed app and is running full-screen and offline.


So, a TMS web progressive web application is the best way to let Obama show what he built to all of his friends and family. It is as easy as sharing the link to play the game in an internet browser and you can also download and install it on your phone or tablet to have it available even when you are offline or want to save some mobile data.

To put the icing on the cake, we didn’t just create the game as progressive web application. This served also as a proof of concept to create a TMS Electron project created in Delphi from the same source code! This technology is in development in our lab and this will be part of the TMS WEB Core 1.2 Padua release. It allowed us to have an out-of-the-box working and installable desktop application for Windows, macOS (macOS 64-bit app to be precise), and on Linux in a matter of minutes. Here are some screenshots of this cross platform TMS Electron desktop application on Windows, macOS and Ubuntu. As we guess that many of you are eager to work with this awesome technology, we are working hard to make a TMS WEB Core 1.2 Padua Beta release available as soon as possible to our TMS ALL-ACCESS users.








Now to get to the programming. We started with the idea to create a control for one entry containing the four colored pins, a check button and the four markers that evaluate your guess.

A quick look in the wide range of FNC UI components we’ve already available, learned us that the TTMSFNCBitmapSelector looks the most similar component to what we want to create. So we took the custom FNC component this TTMSFNCBitmapSelector was derived from and started with the TTMSFNCDefaultSelector. This would be the basis for our FNC UI component TTMSFNCMasterMindControl. We built the board by creating 12 of our UI controls and placed them underneath each other with the use of top align.

It took us no effort to evenly space everything horizontally or to scale everything when the window is resized, as this is already done in the class TTMSFNCDefaultSelector. We just had to draw our images and the first line was already visible on our screen.


To get a little more in detail. We’ve created one row with five columns, where we use images to draw the four pegs with one TTMSFNCBitmapContainer, which contains the images for all the colors. The public property DataInteger that exists for every TTMSFNCCustomSelectorItem in the TTMSFNCDefaultSelector is used to hold the value of the selected color. The “Check” is just text shown in the item and the four check markers are drawn via TTMSFNCGraphics, where we just calculate the optimal size to draw four circles and fill the color of the ellipsis according to the number of correct pegs.
Then we checked how the interaction with mouse, keyboard and touch could be realized to ensure the game can be played on a variety of devices. With mouse or touch, consecutive clicks on each of the 4 positions cycles through the colors. We’ve added navigation between positions with the left and right arrow keys and cycling through color per position with arrow up and down. This UI behavior was again fairly easy to implement due to the fact that most of the behavior was already in the superclass.
We use the left and right arrow keys to navigate within our own control and as you can see below, you have the prove that this is very simple as the GetPreviousSelectableItem and GetNextSelectableItem are both functions from the TTMSFNCCustomSelector.

procedure TTMSFNCMasterMindControl.HandleKeyDown(var Key: Word;
  Shift: TShiftState);
var
  dataInt: NativeInt;
begin
  case Key of
    KEY_LEFT: SelectedItemIndex := GetPreviousSelectableItem;
    KEY_RIGHT: SelectedItemIndex := GetNextSelectableItem;
    KEY_UP:
      begin
        if (SelectedItemIndex >= 0) and (Items.Items[SelectedItemIndex].DataString = 'image') then
        begin
          dataInt := 1 + Items[SelectedItemIndex].DataInteger;
          if (dataInt > 6)then
            dataInt := 1;
          Items[SelectedItemIndex].DataInteger := dataInt;
          Invalidate;
        end;
      end;
      ….

end;

The code to change the peg color from the mouse up handler override is:

procedure TTMSFNCMasterMindControl.HandleMouseUp(Button: TTMSFNCMouseButton;
  Shift: TShiftState; X, Y: Single);
var
  dataInt: NativeInt;
begin
  if Enabled then
  begin
    inherited;
    if (SelectedItemIndex >= 0) and (Items.Items[SelectedItemIndex].DataString = 'image') then
    begin
      dataInt := 1 + Items[SelectedItemIndex].DataInteger;
      if (dataInt > 6)then
        dataInt := 1;
      Items[SelectedItemIndex].DataInteger := dataInt;
      Invalidate;
  end;
end;

We use the up and down keys to change the public DataInteger property of the selected item of type TTMSFNCCustomSelectorItem which changes the bitmap image of the selected peg in our DrawItemContent function.
The code is:

procedure TTMSFNCMasterMindControl.DrawItemContent(AGraphics: TTMSFNCGraphics;
  ADisplayItem: TTMSFNCCustomSelectorDisplayItem);
var
  di: TTMSFNCCustomSelectorItem;
  idx: Integer;
  bmp: TTMSFNCBitmap;
  pt1: TPointF;
  checkPinsRect: TRectF;
  side: Single;
  i: Integer;
  tempPCorrect: Integer;
  tempCCorrect: Integer;
  w, h: Single;
  s: string;
begin
  inherited;
  di := ADisplayItem.Item;
  // draw the peg using a bitmapcontainer image
  if Assigned(di) and (di.DataString = 'image') then
  begin
    idx := di.DataInteger;
    AGraphics.BitmapContainer := BitmapContainer;
      case idx of
        1: s := 'red';
        2: s := 'blue';
        3: s := 'yellow';
        4: s := 'orange';
        5: s := 'green';
        6: s := 'purple';
        else s := 'empty';
      end;
    AGraphics.DrawBitmapWithName(ADisplayItem.Rect, s);
  end;
  // draw the score
  if Assigned(di) and (di.DataString = 'check') then
  begin
    w := ADisplayItem.Rect.Right - ADisplayItem.Rect.Left;
    h := ADisplayItem.Rect.Bottom - ADisplayItem.Rect.Top;
     if(w  0) then
       begin
         FTColors[i]:= gcRed;
         Dec(tempPCorrect);
       end
       else if (tempCCorrect > 0) then
       begin
         FTColors[i] := gcWhite;
         Dec(tempCCorrect);
       end
       else
         FTColors[i] := gcNull;
     end;
     // Mastermind row is active, so use active color
     if (Enabled = true) or (FPosCorrect = 4) then
     begin
       AGraphics.Fill.Color := activeColor;
       AGraphics.Stroke.Color := activeColor;
     end
     else
     begin
       AGraphics.Fill.Color := boardcolor;
       AGraphics.Stroke.Color := boardcolor;
     end;
     // draw 4 score circles in correct score color
     AGraphics.DrawRectangle(ADisplayItem.Rect);
     AGraphics.Stroke.Color := gcBlack;
     checkPinsRect := RectF(ADisplayItem.Rect.Left + 2, ADisplayItem.Rect.Top + 2, ADisplayItem.Rect.Left + side - 2, ADisplayItem.Rect.Top + side - 2);
     AGraphics.Fill.Color := FTColors[0];
     AGraphics.DrawEllipse(checkPinsRect);
     checkPinsRect := RectF(ADisplayItem.Rect.Left + 2, ADisplayItem.Rect.Top + side + 2, ADisplayItem.Rect.Left + side - 2, ADisplayItem.Rect.Top + (side * 2) - 2);
     AGraphics.Fill.Color := FTColors[1];
     AGraphics.DrawEllipse(checkPinsRect);
     checkPinsRect := RectF(ADisplayItem.Rect.Left + side + 2, ADisplayItem.Rect.Top + 2,  ADisplayItem.Rect.Left + (side*2) - 2, ADisplayItem.Rect.Top + side - 2);
     AGraphics.Fill.Color := FTColors[2];
     AGraphics.DrawEllipse(checkPinsRect);
     checkPinsRect := RectF(ADisplayItem.Rect.Left + side + 2, ADisplayItem.Rect.Top + side + 2, ADisplayItem.Rect.Left + (side*2) - 2, ADisplayItem.Rect.Top + (side * 2) - 2);
     AGraphics.Fill.Color := FTColors[3];
     AGraphics.DrawEllipse(checkPinsRect);
  end;
end;

As a last part we just had to implement some code to check the pattern and return an event if we did a guess. We then disable the FNC UI control for the active row on the board and enable the next row so we can move to the next step.
And that’s all for the component used in the game. Now we just have to create the form of the progressive web and Electron application and everyone can play the game anywhere, anytime.
Just to show the power and the time we gained by using one of our custom FNC components, we’ve also created a VCL and FireMonkey application with the same code.

To conclude, Obama was very proud of the game he helped creating and named ‘oBama mind’ and he showed it to all of his classmates. We hope that this way, he could transmit the passion for software development to his classmates and inspire a future generation of Delphi developers. To
illustrate the scope of this type of development with TMS WEB Core, Obama even showed it to his friends on his PlayStation 4, where you can play it on the built-in web browser. He said that now he is even more certain he wants to become a software developer!

We are one step closer to a future where Pascal programming is guaranteed.

The full source code for the Mastermind game that you can compile as VCL, FMX or Web core application is available for download.
As soon as TMS WEB Core v1.2 Padua will be released, you will also be able to compile it as an Electron Windows, macOS or Linux desktop application.

Read More

Read More

TMS specials for Delphi’s 24th birthday on Valentines day

Delphi 1.0 was released on Feb 14, 1995 and celebrates its 24th birthday this year.

Also for TMS software, these 24 years were extremely exciting. Where we were developing VCL UI controls for 16bit Windows applications in 1995, we meanwhile have per monitor high-DPI enabled VCL UI controls for Win64, cross-platform FMX controls for Windows, macOS, iOS, Android, web UI controls for IntraWeb, an ORM TMS Aurelius and REST server products like TMS XData or our TMS WEB Core web client framework!

Delphi was, is and remains a language, IDE and development community we are passionate about. To share the love and passion and celebrate, we have this week discounts for you!

On top of our regular low prices you receive an extra 20% discount on new licenses! Enjoy these super discounts all week long!

To take advantage of these super deals, just use the following coupon code: Valentine 2019

Special 20% discount

  • TMS WEB Core

    TMS WEB Core enables to build modern web client applications following the single-page architecture that also other modern frameworks like Angular, vue.js, React employ..
    TMS WEB Core is offered at 395 EUR. But this week you get 20% extra discount, so for 316 EUR only.

  • TMS FNC Component Studio

    With this bundle you have the freedom to create powerful apps of your choice. Separate purchase of the products will cost you 460 EUR. This bundle is offered at 295 EUR, but this week you can get this for discount price 236 EUR.

  • TMS Component Pack

    Create modern-looking & feature-rich Windows applications faster with over 600 components in one money and time saving bundle for Delphi & C++Builder.
    Regular bundle price is 295 EUR, but only this week you get extra 20% discount on this bundle, so this is 236 EUR only!

  • TMS Business Subscription

    TMS Business Subscription is our bundle framework that includes: TMS Aurelius, TMS XData, TMS Scripter, TMS Data Modeler, TMS RemoteDB, TMS Echo, TMS Diagram Studio and TMS Workflow Studio. You can purchase your license for regular price 395 EUR. But this week you can get your license for 316 EUR only!

  • TMS ALL-ACCESS

    TMS ALL-ACCESS is our no-nonsense bundle, where you get all our components for just 1695 EUR, instead of 5870 EUR. And yes on top of that you get 20% extra discount this week! So you can get all our components for 1356 EUR.

Plaese note: discounts are valid on new licenses only!

Our team looks forward to your suggestions, feedback and likes to be challenged by things you want to see realized with TMS products!

And also do not forget to like and follow us on Facebook and Twitter for more discounts.

Read More

Read More