Framework that customizes a series of everyday processes.
RICK4D is intended to ease data transition in your system, assigning styles to components, performing connection checking, loading screen, custom message and more.
- ShowForm it was inspired by RICKShowForm where you can open a form as well as perform procedures before and after the opening.
- Loading It was inspired by RICKLoading, which features a loading screen that can be customized.
- Librarys It was inspired by RICKLibrarys, which generates validations with return.
- CheckConnection It was inspired by RICKCheckConnection, where it allows you to check the internet status and the type (mobile only) of the connection.
- Format It was inspired by RICKFormat, where a mask is formatted in the Edit as it is typed.
- Dialog It was inspired by RICKDialog, where a customized dialog screen is presented.
- Encrypt It was inspired by BCrypt, to help you hash passwords.
- Rest It was inspired by RESTRequest4Delphi, to help you API to consume REST services written in any programming language.
- Delphi FMX
- Framework: RICKShowForm, RICKLoading, RICKLibrarys, RICKCheckConnection, RickFormat, RICKDialog, BCrypt, RESTRequest4Delphi
- If you choose to use BOOS
https://github.com/ricksolucoes/boss or https://github.com/HashLoad/boss
the dependency manager, you will have the facility to install all frameworks that are Pre-requisites for the project.
- By using BOOS
boss install https://github.com/ricksolucoes/RICK4D
- Manual Installation
- Download the frameworks:
- RICK4D
https://github.com/ricksolucoes/RICK4D
- RICKShowForm
https://github.com/ricksolucoes/RICKShowForm
- RICKLoading
https://github.com/ricksolucoes/RICKLoading
- RICKLibrarys
https://github.com/ricksolucoes/RICKLibrarys
- RICKCheckConnection
https://github.com/ricksolucoes/RICKCheckConnection
- RICKFormat
https://github.com/ricksolucoes/RickFormat
- RICKDialog
https://github.com/ricksolucoes/RICKDialog
- BCrypt
https://github.com/ricksolucoes/bcrypt
- RESTRequest4Delphi
https://github.com/ricksolucoes/RESTRequest4Delphi
- RICK4D
- Add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path
../RICK4D/src
../RICKShowForm/src
../RICKLoading/src
../RICKLibrarys/src
../RICKCheckConnection/src
../RICKFormat/src
../RICKDialog/src
../bcrypt/src
../restrequest4delphi/src
- Download the frameworks:
Example of using the RICK4D framework
- How to use show a form
uses
RICK4D;
begin
TRICK4D
.New
.ShowForm //Enable the Middleware
.Formulary(TPageView2) //Inform the form's class
.ExecuteBefore(BeforeShow) //Procedure to be performed before show form
.ExecuteAfter(AfterShowClose) //Procedure to be performed after show form
.ChangeDefaultMainForm //Set the specified form as the main form
.Show; //Open the formulary
end;
- How to use show two or more forms
uses
RICK4D;
begin
TRICK4D
.New
.ShowForm //Enable the Middleware
.Formulary(TPageView2) //Inform the form's class
.ExecuteBefore(BeforeShow) //Procedure to be performed before show form
.ExecuteAfter(AfterShow) //Procedure to be performed after show form
.Show //Open the formulary
.ShowOther //Prepare new form to show
.Formulary(TPageView3) //Inform the form's class
.Show; //Open the formulary}
end;
- How to use Loading
uses
RICK4D;
begin
TRICK4D
.New
.Loading
.Execute("Create Procedure");
end;
- Another way to perform Loading
uses
RICK4D;
begin
TRICK4D
.New
.Loading
.Execute(
procedure
begin
// Delayed Command
Sleep(500);
TThread.Synchronize(TThread.Current,
procedure
begin
// Command to refresh the screen
ShowMessage('Command to refresh the screen here...');
end);
end);
end;
- Modify the Loading message
uses
RICK4D;
begin
TRICK4D
.New
.Loading
.Execute(
procedure
begin
// Delayed Command
Sleep(500);
TThread.Synchronize(TThread.Current,
procedure
begin
TRICK4D.New.Loading.ChangeMessage('Changing message');
// Change the message to the user
end);
// Another command if there is one
TThread.Sleep(1500);
TThread.Synchronize(TThread.Current,
procedure
begin
// Command to refresh the screen
ShowMessage('Command to refresh the screen here...');
end);
end);
end;
- Customize the Loading screen using the interface
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
LRICK4D:= TRICK4D.New;
LRICK4D.Loading.DoMessage('Loading Modified'); //Changes the initial loading message
LRICK4D.Loading.SourceSize(32); //Change the font size
LRICK4D.Loading.SourceName('Segoe UI'); //Change the font type
LRICK4D.Loading.SourceColor($FFF52121); //Change the font color
LRICK4D.Loading.AnimationColor($FFF52121); //Changes the color of the animation
LRICK4D.Loading.BackgroundColor($FF24CCC6); //Changes the color of the loading background
LRICK4D.Loading.OpacityBackground(0.9); //Changes the opacity of the background;
LRICK4D.Loading.OpacityAnimationText(0.6); //Change the opacity of text
LRICK4D.Loading.Execute(
procedure
begin
TThread.Sleep(500);
TThread.Synchronize(TThread.Current,
procedure
begin
LRICK4D.Loading.ChangeMessage('Changing message'); //Change the message to the user
end);
TThread.Sleep(1500);
TThread.Synchronize(TThread.Current,
procedure
begin
ShowMessage('Command to refresh the screen here...');
end);
end);
end;
- How to use the library to Show Keyboard
uses
RICK.Librarys;
begin
TRICKLibrarys.New.ShowKeyboard(edtData);
end;
- How to use the library to Hide Keyboard
uses
RICK.Librarys;
begin
TRICKLibrarys.New.HideKeyboard(edtData);
end;
- How to use the library to Other actions
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
inherited;
LRICK4D := TRICK4D.New;
case ListView.Tag of
0:
if LRICK4D.Librarys.StringInSet(edtData.Text.ToLower, ['ok', 'cancel']) then
begin
lblResult.Text:= Format('There is %s', [edtData.Text]);
end
else
begin
lblResult.Text:= Format('Does Not Exist %s', [edtData.Text]);
end;
1:
lblResult.Text:= LRICK4D.Librarys.OnlyNumber(edtData.Text);
2:
lblResult.Text:= LRICK4D.Librarys.Mask('###-###', edtData.Text);
3:
lblResult.Text:= LRICK4D.Librarys.IEFormat(edtData.Text, 'RJ');
4:
lblResult.Text:= LRICK4D.Librarys.FormatValue(edtData.Text);
5:
lblResult.Text:= LRICK4D.Librarys.FormatDate(edtData.Text);
6:
lblResult.Text:= LRICK4D.Librarys.FormatPeso(edtData.Text);
end;
end;
- How to Check Connection
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
lblConn.Text:= 'Wait....';
lblConn.TextSettings.FontColor:= $FF65A6D5;
LRICK4D:= TRICK4D.New;
//Returns if the connection is active (true) and if not, returns (false)
if not LRICK4D.CheckConnection.ConnectionState then
Self.Fill.Color:= TAlphaColorRec.Red;
lblConn.Text:= LRICK4D.CheckConnection.ConnectionType;
end;
- How to Connection Type
uses
RICK4D;
begin
lblConn.Text:= TRICK4D.New.CheckConnection.ConnectionType;
end;
- How to check url
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
inherited;
lblConn.Text:= 'Wait....';
lblConn.TextSettings.FontColor:= $FF65A6D5;
LRICK4D:= TRICK4D.New;
LRICK4D.CheckConnection.ClearURL.URL(edtTestLink.Text);
LRICK4D.CheckConnection.ClearStausCode.StatusCode(200); //Status Code Defualt 400
//Returns if the url is active (true) and if not, returns (false)
if not LRICK4D.CheckConnection.URLState then
lblConn.TextSettings.FontColor:= TAlphaColorRec.Red;
lblConn.Text:= LRICK4D.CheckConnection.ConnectionType;
end;
- How to use the format. Use Edit's "EditDataTyping" property
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
LRICK4D:= TRICK4D.New;
inherited;
case ListView.ItemIndex of
0 : LRICK4D.Format.LandlinePhone(Sender); //Brazil's Telephone mask
1 : LRICK4D.Format.Mobile(Sender); //Brazil's Mobile mask
2 : LRICK4D.Format.CNPJ(Sender); //Brazil's CNPJ mask
3 : LRICK4D.Format.CPF(Sender); //Brazil's CPF mask
4 : LRICK4D.Format.CNPJorCPF(Sender); //Brazil's CPF or CNPJ mask
5 : LRICK4D.Format.FormatExtra('rj').StateRegistration(Sender); // Brazil's State Registration mask
6 : LRICK4D.Format.CurrencyValue(Sender); //Brazil's Currency Value
7 : LRICK4D.Format.FormatExtra('R$').CurrencyValue(Sender); //Brazil's Currency value with acronym mask
8 : LRICK4D.Format.ZipCode(Sender); // Brazil's ZIP CODE mask
9 : LRICK4D.Format.DateValue(Sender); //Brazil's Date mask
10: LRICK4D.Format.Weight(Sender); // Brazil's Weight mask
11: LRICK4D.Format.FormatExtra('##.###-###-####>###').Customized(Sender); //custom mask
end;
end;
-
How to use Info Dialog
- One Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Execute .Info .&End .&End .&End end;
- Two Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Button .First .Text('Yes') .Process(FirstResponseProcedure) .&End .Second .Text('No') .Process(SecondResponseProcedure) .&End .&End .Execute .Info .&End .&End .&End end;
-
How to use Success Dialog
- One Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Execute .Success .&End .&End .&End end;
- Two Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Button .First .Text('Yes') .Process(FirstResponseProcedure) .&End .Second .Text('No') .Process(SecondResponseProcedure) .&End .&End .Execute .Success .&End .&End .&End end;
-
How to use Success Dialog
- One Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Execute .Success .&End .&End .&End end;
- Two Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Button .First .Text('Yes') .Process(FirstResponseProcedure) .&End .Second .Text('No') .Process(SecondResponseProcedure) .&End .&End .Execute .Success .&End .&End .&End end;
-
How to use Warnig Dialog
- One Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Execute .Warnig .&End .&End .&End end;
- Two Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Button .First .Text('Yes') .Process(FirstResponseProcedure) .&End .Second .Text('No') .Process(SecondResponseProcedure) .&End .&End .Execute .Warnig .&End .&End .&End end;
-
How to use Error Dialog
- One Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Execute .Error .&End .&End .&End end;
- Two Button
uses RICK4D; begin TRICK4D .New .Dialog .CustomDialog .Info .Text('Your message here') .&End .Button .First .Text('Yes') .Process(FirstResponseProcedure) .&End .Second .Text('No') .Process(SecondResponseProcedure) .&End .&End .Execute .Error .&End .&End .&End end;
-
How to use Question Dialog
uses
RICK4D;
begin
TRICK4D
.New
.Dialog
.CustomDialog
.Info
.Text('Your message here')
.&End
.Button
.First
.Process(FirstResponseProcedure)
.&End
.Second
.Process(SecondResponseProcedure)
.&End
.&End
.Execute
.Question
.&End
.&End
.&End;
end;
- How to use Custom Dialog
uses
RICK4D;
begin
TRICK4D
.New
.Dialog
.CustomMain
.Background
.Opacity(0.7)
.Color(TAlphaColorRec.Blue)
.&End
.&End
.CustomDialog
.Background
.Color(TAlphaColorRec.White)
.&End
.Rectangle
.Width(Self.Width - 60)
.Height(Self.Height - 120)
.&End
.Icon
.Color(TAlphaColorRec.Coral)
.&End
.Title
.Text('Question')
.FontSize(24)
.FontColor(TAlphaColorRec.Black)
.&End
.Info
.Text('The policy of the War on Terror, undertaken by the United States at the beginning of the 21st century, culminated in one of the most important recent geopolitical conflicts. This conflict has become known as the')
.FontSize(12)
.FontColor(TAlphaColorRec.Darkcyan)
.&End
.Button
.First
.Color(TAlphaColorRec.Darkgray)
.Text('Afghan War')
.FontSize(14)
.FontColor(TAlphaColorRec.White)
.Process(FirstResponseProcedure)
.&End
.Second
.Color(TAlphaColorRec.Darkgray)
.Text('Syria''s War')
.FontSize(14)
.FontColor(TAlphaColorRec.White)
.Process(SecondResponseProcedure)
.&End
.&End
.Execute
.Question
.&End
.&End
.&End;
end;
- How to use Interface
uses
RICK4D,
RICK4D.Interfaces;
var
LRICK4D: iRICK4D;
begin
LRICK4D:= TRICK4D.New;
//Customizing Background
LRICK4D.Dialog
.CustomMain
.Background
.Opacity(0.7)
.Color(TAlphaColorRec.Blue)
.&End
.&End;
//Customizing the Message Window Background
LRICK4D.Dialog
.CustomDialog
.Background
.Color(TAlphaColorRec.White)
.&End
.&End;
//Customizing the Message Window
LRICK4D.Dialog
.CustomDialog
.Rectangle
.Width(Self.Width - 60)
.Height(Self.Height - 120)
.&End
.&End;
//Customizing Icon
LRICK4D.Dialog
.CustomDialog
.Icon
.Color(TAlphaColorRec.Coral)
.&End
.&End;
//Customizing Title
LRICK4D.Dialog
.CustomDialog
.Title
.Text('Question')
.FontSize(24)
.FontColor(TAlphaColorRec.Black)
.&End
.&End;
//Customizing message
LRICK4D.Dialog
.CustomDialog
.Info
.Text('The policy of the War on Terror, undertaken by the United States at the beginning of the 21st century, culminated in one of the most important recent geopolitical conflicts. This conflict has become known as the')
.FontSize(12)
.FontColor(TAlphaColorRec.Darkcyan)
.&End
.&End;
//Customizing the First Button
LRICK4D.Dialog
.CustomDialog
.Button
.First
.Color(TAlphaColorRec.Darkgray)
.Text('Afghan War')
.FontSize(14)
.FontColor(TAlphaColorRec.White)
.Process(FirstResponseProcedure)
.&End
.&End;
//Customizing the Second Button
LRICK4D.Dialog
.CustomDialog
.Button
.Second
.Color(TAlphaColorRec.Darkgray)
.Text('Syria''s War')
.FontSize(14)
.FontColor(TAlphaColorRec.White)
.Process(SecondResponseProcedure)
.&End
.&End
.&End;
//Display screen
LRICK4D.Dialog
.CustomDialog
.Execute
.Question
.&End
.&End;
end;
- How to use Generate hash
uses
RICK4D;
var
LHash: string;
begin
LHash := TRICK4D.New.Encrypt.GenerateHash(password, cost, type);
end;
- How to use Compare hash
uses
RICK4D;
var
LVerify : Boolean;
begin
LVerify := TRICK4D.New.Encrypt.CompareHash(password, hash);
end;
- How to use Rest Method
- Get
uses RICK4D, RICK4D.Contract; var LResponse: IResponse; begin LResponse:= TRICK4D.New .Rest .BaseURL('http://localhost:8888/people') .AddHeader('HeaderName', 'HeaderValue') .AddParam('ParameterName', 'ParameterValue') .Accept('application/json') .Get; end;
- Post
uses RICK4D, RICK4D.Contract; var LResponse: IResponse; begin LResponse:= TRICK4D.New .Rest .BaseURL('http://localhost:8888/people') .Accept('application/json') .AddBody('{"name":"Rick","lastName":"Soluções"}') .Post; end;
- Put
uses RICK4D, RICK4D.Contract; var LResponse: IResponse; begin LResponse:= TRICK4D.New .Rest .BaseURL('http://localhost:8888/people/1') .Accept('application/json') .AddBody('{"name":"Rick","lastName":"Soluções"}') .Put; end;
- Patch
uses RICK4D, RICK4D.Contract; var LResponse: IResponse; begin LResponse:= TRICK4D.New .Rest .BaseURL('http://localhost:8888/people/1') .Accept('application/json') .AddBody('{"name":"Rick","lastName":"Soluções"}') .Patch; end;
- Patch
uses RICK4D, RICK4D.Contract; var LResponse: IResponse; begin LResponse:= TRICK4D.New .Rest .BaseURL('http://localhost:8888/people/1') .Accept('application/json') .Delete; end;
- You can set credentials using the BasicAuthentication, Token or TokenBearer method before making the first request:
begin
TRICK4D.New.Rest.BasicAuthentication('username', 'password');
TRICK4D.New.Rest.Token('token-type ' + token);
TRICK4D.New.Rest.TokenBearer(token);
end;