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,685 other followers

Archive for the ‘Delphi’ Category

Delphi Ensuring Left/alLeft or Top/alTop controls are positioned in the right order…

Posted by jpluimers on 2019/08/22

The post [WayBack] Why is my buttons not created in logical order? If I run this, my buttons area created ACB rather than ABC as I expected… – Johan Swart – Google+ reminded me the trouble of Delphi VCL and FMX have with alignment.

Basically you have to position your control away from your intended alignment position in order for it to work. So this fails:

procedure TForm1.FormCreate(Sender: TObject);
var
  myToolBar: TToolBar;
  myCornerButton: TCornerButton;
  i: Integer;
begin
  myToolBar := TToolbar.Create(Self);
  myToolBar.Parent := Self;

  for i := 0 to 2 do
  begin
    myCornerButton := TCornerButton.Create(tbarGrid);
    myCornerButton.Parent := myToolBar;
    myCornerButton.Align := TAlignLayout.Left;
    myCornerButton.Text := Chr(65 + I);
  end;
end;

Basically you have to set myCornerButton.Left to 1 before setting the Align property.

Similar for the Top property and TAlignLayout.Top value.

The same holds for VCL Align values alLeft with setting the Left property and alTop with setting the Top property before setting Align.

See these for the actual properties and types:

See also this question: [WayBack] Delphi: How to programmatically adjust visual ordering of components with align = alTop

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

Delphi built-in data types and their memory sizes

Posted by jpluimers on 2019/08/21

Though 64-bit support was released back in 2011 with Delphi XE2, sometimes I forget which data type are native size and which keep their size no matter the compiler bitness (wiktionary/wikipedia).

This post was motivated by via [WayBack] Having started with Delphi before the Cardinal type was available (Or has it always? I can’t remember.) I routinely declare 32 bit unsigned variables as… – Thomas Mueller (dummzeuch) – Google+

The most simple distinction is between Win32 and Win64, but there are more non-32 bit platforms, so these do not suffice any more:

The easiest for me are the below tables that only got introduced with Delphi 10.2 Tokyo: [WayBack] Delphi Data Types for API Integration – RAD Studio.

I have bolded the ones that change size.

Read the rest of this entry »

Posted in Delphi, Development, Software Development | 4 Comments »

Delphi generic nested classes

Posted by jpluimers on 2019/08/21

Reminder to Self: do not nest T generic types as you’re in for a surprise.

Source: [WayBackDelphi generic nested classes

Via: [WayBack] An interesting question over on SO relating to nested generic classes… – David Heffernan – Google+

The surprise:

what type would you expect obj.x to be? Integer or string?

The compiler hint:

[dcc32 Hint]: H2509 Identifier 'T' conflicts with type parameters of container type

–jeroen

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

TestInsight provides a local JSON web-server from the IDE for the test-runner to communicate from

Posted by jpluimers on 2019/08/15

Stefan Glienke shared the TestInsight default JSON web-server location with me through chat; I like it!

Some endpoints:

The mechanism for accessing this JSON server are implemented in the TestInsight.Client.pas

You can find the endpoint base URL in TestInsightSettings.ini which by default looks like this:

[Config]
BaseUrl=http://WIN10-DELPHI:8102

–jeroen

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

Delphi, SHA-3 and streaming

Posted by jpluimers on 2019/08/15

If I ever need to use SHA-3 in Delphi: [WayBack] Does anyone know of any implementations of SHA-3, that can support TStream? – Nicholas Ring – Google+

The comments have a nice list of libraries supporting SHA-3, and how to do streaming hashing.

–jeroen

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

 
%d bloggers like this: