Наши преимущества

Source Code Delphi Samples with Sources

emailx45

Турист
Команда форума
Credits
518
Последнее редактирование:
Webinar by Marcu Cantu, about High DPI crossing 2 display with distinct resolution
2 display with same app (High res 4K and Low res Windows default) on XE10.3 RIO
 
Последнее редактирование:
Последнее редактирование:
Firemonkey: How to crop a photo in Delphi (Video lessons) - in PortugueseBR
Easy method and didatic for crop a image, for example, to create your "profile photo" in your app Mobile or Windows.You can change to VCL!


NOTE: You can change the subtitles for your language (google option for all languages)

One feature that leaves your mobile app with a more professional face is to allow your user to change his or her profile picture. But do not just send the new photo to replace the old image. Ideally, it can resize and crop the photo the way you want.

This feature is used in applications such as Facebook and Twitter, and allows a very nice customization of the photos!

 
Последнее редактирование:
SHA Hash with C++Builder and Delphi
Posted by Как увидеть ссылки? | How to see hidden links?, 11 MAY 2018 (Embarcadero MVP)
Как увидеть ссылки? | How to see hidden links?

I've always been fascinated by encryption & compression, but my favorite is probably the Как увидеть ссылки? | How to see hidden links?. A hash function is a one-way algorithm that takes an input of any size and always produces the same size output. It is one-way in that there is information loss -- you can't easily go from the output to the input again. The cryptographic hash is a more secure version of the hash function. It is most often used in signing to validate that data hasn't been modified.
Per Как увидеть ссылки? | How to see hidden links?, the ideal cryptographic hash function has five main properties:
R7UNC3.png

The Message Digest family of cryptographic hashes used to be the main players in the area, but they were found to be insecure. Now SHA family rules as the main workhorse of modern cryptography.

The basis of hash support first appeared in the RTL around the 2009 release but in Как увидеть ссылки? | How to see hidden links? (2015) we got the Как увидеть ссылки? | How to see hidden links? unit, which brought the MD5, SHA-1, and Bob Jenkins hashes. Then in Как увидеть ссылки? | How to see hidden links? (2015) it was expanded with Как увидеть ссылки? | How to see hidden links? support. Most recently in Как увидеть ссылки? | How to see hidden links? (2017) the hash functions were expanded to accept either a string or stream in addition to the original bytes input.

The SHA Family includes SHA-0, SHA-1, SHA-2, & SHA-3 family of hashes. SHA-0 is obsolete, and SHA-3 is an improvement on SHA-2. In practice I see most hashes using either SHA-1 or SHA-2. SHA-1 always produces a 160-bit (20-byte) hash (digest), while SHA-2 includes 224, 256, 384, and 512-bit outputs, making it both more secure and more flexible. SHA 256 & 512 represent 32 and 64-bit word size hash algorithms. The 224, 256, & 384 size digests are truncated versions of the 256 & 512 algorithms.

So how do you use it in C++Builder and Delphi? I'm glad you asked. Once you have included the System.Hash unit then you can use the methods of the THashSHA2 class to create the digest. I'll show you how to use GetHashString, but know there are other variations you can use too. The GetHashString takes either a string or a stream and returns a hexadecimal string of the hash.

In C++Builder your code would look like:
Код:
Edit512->Text = THashSHA2::GetHashString(
    EditMessage->Text,
    THashSHA2::TSHA2Version::SHA512);
and in Delphi your code would look like:
Код:
Edit512.Text := THashSHA2.GetHashString(
    EditMessage.Text,
    THashSHA2.TSHA2Version.SHA512).ToUpper;
I made a little sample app that generates all the different hashes from the text you provide. It is a FireMonkey app, so will work on all the platforms, but the hash code will work in any type of app. There are both C++ and Delphi versions included.
TRB50R.png
 
Последнее редактирование:
3D Credits Scroll with Delphi (A little fun with Delphi for today’s Star Wars day!)
by Jim McKeeth, 04/May/2018
A little fun with Delphi for today’s Star Wars day!

This is a pretty simple 3D form with a 3D layout at an angle, and then a 2D layout with text and images is animated up the 3D layout. The only code is populating the labels as the animation kicks off automatically.

Как увидеть ссылки? | How to see hidden links?


Как увидеть ссылки? | How to see hidden links?

change the message to share with your friends. It is FireMonkey, and while I only tested it on Windows, it should work on Android, iOS, macOS, and even Linux if you are running Как увидеть ссылки? | How to see hidden links?.


May the Fourth be with You!
Как увидеть ссылки? | How to see hidden links?
 
Последнее редактирование:
Последнее редактирование:
Did you know is possible use VCL and FMX (FireMonkey) togheter in your app?
Here my test about use of "VCL" and "FMX" objects togheter, to create one app to MS Windows!

Many want to use DLLs written in C / C ++ or another language along with their project in RAD Studio (Delphi or CBuilder), but they forget or do not know that a BPL is actually a binary library, such as a DLL, with due exceptions and differences in your call.

However, since a BPL is actually a binary Delphi / CBuilder code container, then this means you can create your own repository of objects (classes) and codes to use in your projects, in order to re-use their codes. (Remember one of the pillars of object-oriented language - Inheritance)

To use one framework within the other, in the case it may be: VCL within FMX, or FMX within VCL - you have to take a few basic steps.

You must create the objects that will be used by the other framework with a package (BPL / DCP), as RAD Studio does.
In your application project, VCL or FMX, you must inform that you will use a custom "RUNTIME PACKAGE", which is your newly created package.
Add the DCP file - not BPL file ok!
IT's NOT NECESSARY INSTALL THE PACKAGE IN YOUR IDE, JUST HAVE IT TO USE!
By default, RAD Studio saves the BPL and DCP files in your "Documents Public \ Embarcadero \ .... DCP and BPL sub-folders" - if you want, you can "copy it" for you project folder or any other place!
Just DONT FORGET where is it, ok!
After that, you simply inform in your application project, in the "USES" clause, which unit you intend to use, and which is inside your "package" that you created before.
Then you can use the objects and classes as you normally do when using the RAD Studio default packages.
Код:
My project VCL that will use my TForm FMX (FireMonkey)
-------------------------------------------------------------------------------

unit uVCLFormMain;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  Vcl.StdCtrls,
  Vcl.Menus,
  //
  uFMXForm_inVCLproject  // in my package with my objects FMX
  //
    ;

type
  TVCLFormMain = class(TForm)
    Label1: TLabel;
    MainMenu1: TMainMenu;
    Files1: TMenuItem;
    About1: TMenuItem;
    CallFMXform1: TMenuItem;
    N1: TMenuItem;
    Exit1: TMenuItem;
    procedure CallFMXform1Click(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  VCLFormMain: TVCLFormMain;

implementation

{$R *.dfm}

procedure TVCLFormMain.CallFMXform1Click(Sender: TObject);
var
  lFMXForm_inVCLprj: TfrmFMXForm_inVCLproject;
begin
  lFMXForm_inVCLprj := TfrmFMXForm_inVCLproject.Create(nil);
  try
    lFMXForm_inVCLprj.ShowModal;
  finally
    Self.SetFocus;
    //
    lFMXForm_inVCLprj.DisposeOf;
    lFMXForm_inVCLprj := nil;
  end;
end;

procedure TVCLFormMain.Exit1Click(Sender: TObject);
begin
  Close;
end;

end.


my TForm FireMonkey (FMX) used in my VCL project
-------------------------------------------------------------------------------

unit uFMXForm_inVCLproject;

interface

uses
  System.SysUtils,
  System.Types,
  System.UITypes,
  System.Classes,
  System.Variants,
  FMX.Types,
  FMX.Controls,
  FMX.Forms,
  FMX.Graphics,
  FMX.Dialogs,
  FMX.Layouts,
  FMX.StdCtrls,
  FMX.Controls.Presentation;

type
  TfrmFMXForm_inVCLproject = class(TForm)
    AniIndicator1: TAniIndicator;
    Layout1: TLayout;
    Label1: TLabel;
    StyleBook1: TStyleBook;
    ToolBar1: TToolBar;
    sbtnClickMe: TSpeedButton;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure sbtnClickMeClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmFMXForm_inVCLproject: TfrmFMXForm_inVCLproject;

implementation

{$R *.fmx}

procedure TfrmFMXForm_inVCLproject.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  AniIndicator1.Enabled := False;
end;

procedure TfrmFMXForm_inVCLproject.FormCreate(Sender: TObject);
begin
  Position := TFormPosition.ScreenCenter;
end;

procedure TfrmFMXForm_inVCLproject.FormShow(Sender: TObject);
begin
  AniIndicator1.Enabled := False;
  AniIndicator1.Enabled := True;
end;

procedure TfrmFMXForm_inVCLproject.sbtnClickMeClick(Sender: TObject);
begin
  ShowMessage('Hello FMX project');
end;

end.


my project FireMonkey (FMX) that will use my TForm VCL
-------------------------------------------------------------------------------

unit uFMXFormMain;

interface

uses
  System.SysUtils,
  System.Types,
  System.UITypes,
  System.Classes,
  System.Variants,
  FMX.Types,
  FMX.Controls,
  FMX.Forms,
  FMX.Graphics,
  FMX.Dialogs,
  FMX.Controls.Presentation,
  FMX.StdCtrls,
  FMX.Layouts,
  //
  uVCLForm_inFMXproject  // in my package with my objects VCL
  //
    ;

type
  TFMXFormMain = class(TForm)
    Layout1: TLayout;
    ToolBar1: TToolBar;
    sbtnCallVCLForm: TSpeedButton;
    sbtnCloseApp: TSpeedButton;
    Label1: TLabel;
    StyleBook1: TStyleBook;
    procedure FormCreate(Sender: TObject);
    procedure sbtnCallVCLFormClick(Sender: TObject);
    procedure sbtnCloseAppClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FMXFormMain: TFMXFormMain;

implementation

{$R *.fmx}

procedure TFMXFormMain.FormCreate(Sender: TObject);
begin
  Position := TFormPosition.ScreenCenter;
end;

procedure TFMXFormMain.sbtnCallVCLFormClick(Sender: TObject);
var
  lVCLForm_inFMXprj: TfrmVCLForm_inFMXproject; // my TForm VCL
begin
  lVCLForm_inFMXprj := TfrmVCLForm_inFMXproject.Create(nil);
  try
    lVCLForm_inFMXprj.ShowModal;
  finally
    Self.Active := True;
    //
    lVCLForm_inFMXprj.DisposeOf;
    lVCLForm_inFMXprj := nil;
  end;
end;

procedure TFMXFormMain.sbtnCloseAppClick(Sender: TObject);
begin
  Close;
end;

end.
-------------------------------------------------------------------------------

my TForm VCL used in my project FireMonkey (FMX)
-------------------------------------------------------------------------------

unit uVCLForm_inFMXproject;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  Vcl.StdCtrls,
  Vcl.ExtCtrls,
  Vcl.ComCtrls,
  Vcl.ToolWin,
  Vcl.Menus,
  System.ImageList,
  Vcl.ImgList,
  System.Actions,
  Vcl.ActnList,
  Vcl.StdActns,
  Vcl.Themes;

type
  TfrmVCLForm_inFMXproject = class(TForm)
    Label1: TLabel;
    Panel1: TPanel;
    Animate1: TAnimate;
    ToolBar1: TToolBar;
    Button1: TButton;
    Button2: TButton;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ComboBox1: TComboBox;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmVCLForm_inFMXproject: TfrmVCLForm_inFMXproject;

implementation

{$R *.dfm}

const
  lPathStyles = 'C:\Users\Public\Documents\Embarcadero\Studio\20.0\Styles';

procedure TfrmVCLForm_inFMXproject.Button1Click(Sender: TObject);
begin
  ShowMessage('Hello VCL project');
end;

procedure TfrmVCLForm_inFMXproject.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmVCLForm_inFMXproject.ComboBox1Change(Sender: TObject);
begin
  if (ComboBox1.Items.Count > 0) then
    TStyleManager.SetStyle(ComboBox1.Text);
end;

procedure TfrmVCLForm_inFMXproject.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Animate1.Active := False;
end;

procedure TfrmVCLForm_inFMXproject.FormCreate(Sender: TObject);
var
  lStyleName: string;
begin
  Position := TPosition.poScreenCenter;
  //
  for lStyleName in TStyleManager.StyleNames do
    ComboBox1.Items.Add(lStyleName);
  //
  if (ComboBox1.Items.Count > 0) then
    ComboBox1.ItemIndex := 0;
end;

procedure TfrmVCLForm_inFMXproject.FormShow(Sender: TObject);
begin
  Animate1.Active := False;
  Animate1.Active := True;
end;

initialization

finalization

end.
 
Последнее редактирование:
Последнее редактирование:
my example for add Tag in TreeNode from TreeView and delete any item indicated by Tag
  • Like imitating a TAG property from components, using a OBJECT (in true, a Type RECORD with a field) - so easy!
  • Then, stay more easy find any TreeNode with a specific value on new "Tag" attribute
 
Последнее редактирование:
Верх