The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,854 other subscribers

Archive for the ‘Delphi’ Category

IDE Fix pack for Rio development snapshot – via Delphi-PRAXiS [en]

Posted by jpluimers on 2019/01/17

If you dare using Delphi 10.3 Rio instead of waiting for Update 1 to stabalise (and hopefully speed up things), you might want to try the development snapshot of [WayBackIDE Fix pack for Rio – Page 2 – Delphi Third-Party – Delphi-PRAXiS [en] that got released last week (thanks Andy!):

A new development snapshot of IDE Fix Pack for 10.3 Rio is available.

The Win64 (DCC64) and Android (DCCAARM) compiler patches should now work as excepted.

Changes:

  • Added: Support for Delphi 10.3 Rio
  • Added: Fix for TStringList.IndexOfName bug (RSP-21633)
  • Added: Fix for access violoation in the Welcomepage JScript9.dll binding
  • Added: TCustomListBox.ResetContent is skipped if the handle isn’t created yet
  • Added: DFM Streaming optimizations
  • Added: FillChar uses Enhanced REP MOVSB/STOSB cpu feature if available for large sizes.
  • Added: Enabled CPU LOCK string assignment optimization for local variables
  • Added: -Oe (experimental optimizations) and -x-cgo compiler option extension (Remove of some unneccessary push/pop operations)
  • Added: Expression Evaluator allows array access to pointers even if the type wasn’t declared with {$POINTERMATH ON}
  • Added: New compiler option extensions: -x–compileonly, -x–reslist, -x–depfile, -x–unitstats
  • Added: More performance optimization for the DCC64 compiler
  • Added: TStringBuilder.SetLength optimization [RSP-19178]
  • Added: TStrings.GetDelimitedText optimization
  • Fixed: Packages with duplicate units may not have caused a fatal compiler error.

IDEFixPackD103Reg64.7z

fastdccD103vDev.7z

Related:

–jeroen

Posted in Delphi, Delphi 10.3 Rio (Carnival), Development, Software Development | 4 Comments »

Getting the class from an TRttiProperty by using MetaclassType

Posted by jpluimers on 2019/01/09

Basically I learned that I should not only look for ClassType, but also for MetaclassType: [WayBack] Not a major problem, but given that xProp is a TRttiProperty instance is there a better way to get the ClassType of a property that is tkClass? – Chad Hower – Google+:

Chris Rolliston

The System.Rtti way is this –

x := xProp.PropertyType.AsInstance.MetaclassType;

Been in since TRttiContext was first added, IIRC.

It indeed has been documented since Delphi 2010: [Archive.is] Rtti.TRttiClassRefType.MetaclassType – RAD Studio VCL Reference

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Delphi sorcery: Loop wars – measuring performance

Posted by jpluimers on 2019/01/08

[WayBack] Delphi sorcery: Loop wars – measuring performance – already showing some nice optimisations that should have been in the RTL into the first place, – sprouted into a nice discussion at [WayBack] Since there was this offtopic argument going on about performance of for-in versus for-to. – Stefan Glienke – Google+ with some relatively straightforward forand for ... in loop compiler optimizations that could be done, but we have dreamt of for like the last decade or two.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

The IOTAComponent.SetPropByName, when used for an integer property, always sets that property to 0 instead of the desired value.

Posted by jpluimers on 2019/01/03

Reminder to self: [WayBack…The IOTAComponent method SetPropByName, when used for an integer property, always sets that property to 0 instead of the desired value…. – Thomas Mueller (dummzeuch) – Google+

Fix in GExperts for the Rename Component functionality in [WayBack] GExperts / Code / Commit [r2318]: Workaround for an apparent OTA-bug: IOTAComponent.SetPropByName for integers always sets the property to 0 instead of the given value. Now we compare the values and if they don’t match use RTTY on the NativeObject to set it. This seems to work. (The bug exists on Delphi 2007 and 10.2, I haven’t tested other versions. The bugfix also works on these versions.):

         VInteger := StrToInt(Value);
         Result := AComponent.SetPropByName(PropertyName, VInteger);
+        if AComponent.GetPropValueByName(PropertyName, TempInt) then begin
+          // Setting an integer property often (always?) fails, so we check the value here and if
+          // it is different, we use the native object to set the value. This works.
+          // (Example: Try to set the Interval property of a TTimer. It always gets set to 0.)
+          // This happens in Delphi 2007 and 10.2, I haven't tested other versions.)
+          // -- 2018-07-16 twm
+          if TempInt <> VInteger then
+            SetPropValue(NativeObject, PropertyName, VInteger);
+        end;

Only the IOTAComponent interface is mentioned (only once!) in the documentation at [Archive.is] Using Editor Interfaces – RAD Studio, so I have ambivalent feelings on how important this is for Embarcadero to fix IOTAComponent.SetPropByName.

It has been broken since at least Delphi 2007 as per GExperts fix and XE3 as per [RSP-20895] IOTAComponent.SetPropByName always sets an integer to zero – Embarcadero Technologies.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

android – How to release a Firemonkey control properly, in this case a child form with a parent? – Stack Overflow

Posted by jpluimers on 2019/01/02

For my archive as [Archive.is] TFmxObject.Release is deprecated since Delphi 10.2 Tokyo, and – worse – broken on some platforms: [WayBack] android – How to release a Firemonkey control properly, in this case a child form with a parent? – Stack Overflow

TFmxObject.Release uses TThread.ForceQueue internally, and that’s currently broken under Android (see discussion above).

As a workaround, a working cross-platform version for releasing an object from its event handler would be

procedure TForm.CloseBtnClick(Sender: TObject);
begin
  Parent := nil;
  TThread.CreateAnonymousThread(
  procedure
  begin
    TThread.Synchronize(nil,
    procedure
    begin
      Self.DisposeOf;
    end);
  end).Start;
end;

Instead of Synchronize you can also use Queue in above method.

What is important to keep in mind is that you should not keep any other references to the control you are releasing or you may hit the trouble down the road.

Via:

[WayBack] What are the solutions for a wizard like application (a single form with content changed depending on some action) in Firemonkey?

I’ve been using TFormStand to have a single form and load frames dynamically, but have some AV in the stept when changing frames…. –

R Gosp – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Google Search string for either docwiki, Delphi 2007 or Delphi 2009 docs

Posted by jpluimers on 2019/01/02

These search the Delphi 2007 docs:

Similar for Delphi 2009 docs

The second ones search just English, and the first searches all languages.

Given the Google search indexing, the first might give a lot of Japanese search results:

https://www.google.com/#q=site:docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4+TPanel

I made shortcuts for the English one in Chrome:

Search engine definition
Search engine Delphi 2007 docs
Keyword d2007
URL with %s in place of query https://www.google.com/#q=site:docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4/EN+%s

 

Search engine definition
Search engine Delphi 20079 docs
Keyword d2009
URL with %s in place of query https://www.google.com/#q=site:docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN+%s

 

I did the same for the docwiki (where you cannot distinguish between languages in a generic way for all Delphi versions, as the language comes after the Delphi version and the kind of documentation (CodeExamples, Libraries, etc.)):

Search engine definition
Search engine Docwiki (all EN/DE/FR/JP)
Keyword docwiki
URL with %s in place of query https://www.google.com/#q=site:docwiki.embarcadero.com+%s

Reasoning:

  • It’s the earliest Delphi version having documentation on-line in HTML format.
  • The foundations of the RTL/VCL structure has not changed since then
  • The links can be archived in the WayBack machine and still look nice after archiving (no CSS fuzz that makes archived pages hard to read)

–jeroen

Posted in Delphi, Delphi 2007, Development, Software Development | 2 Comments »

EKON 22 Slides and Code – Synopse

Posted by jpluimers on 2018/12/29

For my link archive: [WayBackEKON 22 Slides and Code – Synopse by Arnaud Bouchez.

I’ve uploaded two sets of slides from my presentations at EKON 22 : Object Pascal Clean Code Guidelines Proposal High Performance Object Pascal Code on Servers with the associated

Via: [WayBack] http://blog.synopse.info/post/2018/11/12/EKON-22-Slides-and-Code – A. Bouchez – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Delphi and C++ builder Platform Status

Posted by jpluimers on 2018/12/28

Almost all pages at the Embarcadero DocWiki have an embedded product version in the URL or get redirected to one.

One of the notable exceptions is the [WayBackPlatform Status:

The following table shows supported platforms and operating systems for different RAD Studio versions.

* (star) sign next to an operating system indicates that there is a known issue with that operating system and a corresponding RAD Studio version.

To see the workaround for that particular issue, click on the name of the operating system or scroll down to the appropriate section.

It got introduced in 2015 ([WayBackNew DocWiki RAD Studio, Delphi and C++Builder Platform Status Page – Community Blogs – Embarcadero Community) and is maintained at irregular intervals.

For some history: https://web.archive.org/web/*/http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page

–jeroen

via: [WayBack] Summary page showing supported platforms and OS versions for XE4 and upwards, as well as links to known issues for specific versions… – Lars Fosdal – Google+

Posted in C++, C++ Builder, Delphi, Development, Software Development | Leave a Comment »

Delphi: AutoSize property resizes a container (panel, scrollbox, form, frame…) to grow it to fit all controls

Posted by jpluimers on 2018/12/26

A while back I needed a design-time way to automatically resize a Delphi container control (descendants from the, [WayBackTWinControl Class like [WayBack] TPanel, [WayBack] TScrollbox, [WayBack] TForm, [WayBack] TFrame) to grow/shrink so it just fits around it’s contained controls.

Back then I needed it for VCL design time, if possible taking into account non-visual components.

The [WayBackTControl.AutoSize Property does just that for visual controls and works way better than suggestions on doing this manually.

Manually adjusting many controls at design time is a tedious job, especially when trying to prevent mouse usage (I’ve had RSI in the early 1990s, so I’m extra careful).

Thanks Uwe Raabe for helping me out on this.

I’ve not had the need for non-visual components or FMX yet, but if I ever need it, then this piece of code by Stefan Glienke might work:

[Archive.is[Delphi] ResizeControlEditor – Pastebin.com

–jeroen

Source: [WayBack] Is there an expert that can resize a container (panel, scrollbox, form, frame, etc) to be just large enough so it fits all it components?So: grow when… – Jeroen Wiert Pluimers – Google+

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Do not put IFDEF with relative paths in your .dpr as the Delphi IDE cannot match them in the .dproj

Posted by jpluimers on 2018/12/20

The Delphi IDE manages the .dpr and .dproj files for, trying to keep them in sync.

Some information is duplicated between the two, especially files referenced by relative paths: those files are contained in your project.

This means you cannot do something like this in your .dpr file:

  {$IFDEF DEBUG}
  Debug in '..\..\..\..\Shared\Debug.pas';
  {$ELSE}
  Debug in '..\Debug.pas'
  {$ENDIF}

There is no equivalent for this in the .dproj and it will confuse the IDE which file now actually is or is not inside your project.

Better to leave the file outside of your project, then modify the RELEASE/DEBUG search paths to have the correct one.

Even better is to have just one Debug.pas file containing the changes.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »