Tuesday, 20 August 2019
What are the Delphi alternatives to RAD Server for REST?
I am looking at the best solution for a REST service in Delphi (Berlin or Rio) and all the tutorials and examples I have come across use RAD Server, which is part of the Enterprise version and not in the Professional version, which is the version I am using. One possible alternative to RAD Server is to use 3rd party components like Habari. Does anyone have any advice on alternatives or is RAD Server the best option for RESTful services in Delphi?
Monday, 22 July 2019
ClientDataSet SaveToFile writes the field values in reverse order
I have noticed that when I have a TClientDataSet with a single record and I use 'SaveToFile' to save the values to an XML files the order of the fields in the XML is in reverse order. For example if you have the following in the TClientDataSet:
TableID
Name
Address
When this is saved to an XML file the meta data is in the correct order, but the values for the fields in the XML is in reverse order.
Address
Name
TableID
I wonder if this is done by design.
The version of Delphi I am using is Tokyo.
TableID
Name
Address
When this is saved to an XML file the meta data is in the correct order, but the values for the fields in the XML is in reverse order.
Address
Name
TableID
I wonder if this is done by design.
The version of Delphi I am using is Tokyo.
Friday, 14 September 2018
Does Delphi have a future?
I've been using Delphi for almost 20 years now, I have worked in various industries and have also used other languages and IDEs like C#, Xcode, VB.Net, but while developing in other languages I have always been doing something with Delphi and I am a big fan of it. There are many reasons why I enjoy and have a preference to develop some applications in Delphi, but recently I have one problem with it.
The problem I have with Delphi is its future and the question that gets raised 'how easy is it to employ new developers?'. In the UK it is almost impossible to employ a good Delphi developer and can take years to find one. The other option is to employ a developer with good OOP skills and knowledge of a similar language like C# and for them to learn the language (currently no Pluralsight courses). The problem with employing a developer who does not know Delphi is they do not want to learn Delphi, it is not a big enough carrot on the stick and salaries in the UK are less than other languages.
What I would like to know are the selling points of Delphi to a young person who knows OOP and has some experience in software development. I asked myself the question, 'if I was young and needed to choose a language and development environment, would I invest my future in Delphi?' The short and current answer is 'No'.
The problem I have with Delphi is its future and the question that gets raised 'how easy is it to employ new developers?'. In the UK it is almost impossible to employ a good Delphi developer and can take years to find one. The other option is to employ a developer with good OOP skills and knowledge of a similar language like C# and for them to learn the language (currently no Pluralsight courses). The problem with employing a developer who does not know Delphi is they do not want to learn Delphi, it is not a big enough carrot on the stick and salaries in the UK are less than other languages.
What I would like to know are the selling points of Delphi to a young person who knows OOP and has some experience in software development. I asked myself the question, 'if I was young and needed to choose a language and development environment, would I invest my future in Delphi?' The short and current answer is 'No'.
Thursday, 28 June 2018
Delphi features that I was not aware of
The other day I came across a feature of Delphi that in my 18+ years of using Delphi have never used, it is the 'Hide Non-Visual Components' (Ctrl+H) when design a form. I came across this because another Developer pointed out to me that he could not see the menu controls on a form. I thought there might be an option somewhere and on the right click menu was the option.
I have never used this feature and it got me thinking what other features are there that I am not aware of (Delphi Berlin) and are there any that I might use. Here are 2 lists of features I have since discovered, one list is for ones that I think are pointless and I would never use and the other for features that I believe are useful.
Features I've found that I think I will never use:
Features I've found that could be useful:
I have never used this feature and it got me thinking what other features are there that I am not aware of (Delphi Berlin) and are there any that I might use. Here are 2 lists of features I have since discovered, one list is for ones that I think are pointless and I would never use and the other for features that I believe are useful.
Features I've found that I think I will never use:
- Quick Icon - right click menu option in the form designer.
- Quick Edit - right click menu option in the form designer.
- Flip Children - right click menu option in the form designer. I think I'v seen this before, but have never used it and cannot think of when I would.
- Lock Controls - main menu > edit. This feature locks some controls on forms from resizing and moving. This feature has strange behaviour as it sometimes locks the resize, but not the ability to move the control, try locking the controls, closing the form and opening it again and the size of the controls cannot be changed but the positions can. Clearly never been through QA.
- Scale - main menu option > edit. This gives the developer the feature to scale a form and it's controls be a percentage.
Features I've found that could be useful:
- Surround > Region - right click menu option in the code editor.
- Search for Usages - right click menu option in the code editor.
Tuesday, 19 June 2018
Why does TSpinEdit not enforce the MaxValue property?
With a TSpinEdit there is a property called 'MaxValue', from the name it implies that the maximum value for the control is what value you set for the property, but this is not the case. The property sets the maximum value for using the spin edit buttons, a user can enter a value exceeding the maximum value by using the keyboard up to the value of an Int64 (9,223,372,036,854,775,807).
This seems to have been done by design, but I cannot see a valid reason for this and it could be a little dangerous when being used to control the valid values entered.
By putting the following in the OnChange event I've managed to get around the problem. Not sure if there is a better solution.
if (Sender is TSpinEdit) then
begin
if (Sender as TSpinEdit).Value > (Sender as TSpinEdit).MaxValue then
begin
(Sender as TSpinEdit).Value := (Sender as TSpinEdit).MaxValue;
end;
end;
Tuesday, 6 March 2018
Why is there no Delphi error provider?
Recently I've been looking at the best solution for displaying a data entry validation error, for example when a user needs to enter a description that is not a duplicate and they enter a duplicate the user is informed of the error. Many web sites will display an error below the text box highlighting an error, or displaying an error icon next to the text box. In C# (Visual Studio 2017) when developing a forms application there is a 'ErrorProvider' component that is easy to use and displays an icon on the right (exclamation mark by default) with a hint that can contain the error text.
What I am looking for is something similar in Delphi (I am currently using Berlin), and I am surprised there is no 'out of the box' standard component that ships with Delphi that can do this.
I have looked at using a TButtonedEdit control with a right button visible with an exclamation mark as the icon when there is an error, but this does not work well.
I imagine that how software informs a user of a data entry validation error is subjective and some developers will have different ideas, but I am interested in what other developers think and are there any decent 3rd party products that have a single error component.
What I am looking for is something similar in Delphi (I am currently using Berlin), and I am surprised there is no 'out of the box' standard component that ships with Delphi that can do this.
I have looked at using a TButtonedEdit control with a right button visible with an exclamation mark as the icon when there is an error, but this does not work well.
I imagine that how software informs a user of a data entry validation error is subjective and some developers will have different ideas, but I am interested in what other developers think and are there any decent 3rd party products that have a single error component.
Wednesday, 21 February 2018
Animate opening and closing a panel
Thought I would share an example of how I animate the opening and closing of a panel that can contain various controls and how each control can also be animated.
Here is the example code:
unit AnimatePanelFrm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Panel1 : TPanel;
Shape1 : TShape;
Label1 : TLabel;
BitBtn1 : TBitBtn;
BitBtn2 : TBitBtn;
BitBtn3 : TBitBtn;
BitBtn4 : TBitBtn;
procedure Label1Click(Sender : TObject);
private
{Private declarations}
public
{Public declarations}
end;
var
Form1 : TForm1;
implementation
{$R *.dfm}
procedure TForm1.Label1Click(Sender : TObject);
const
Expanded_Height = 106;
Collapse_Height = 44;
Speed = 100;
Speed2 = 200;
begin
AnimateWindow(BitBtn1.Handle, Speed, AW_HOR_NEGATIVE OR AW_SLIDE OR AW_HIDE);
AnimateWindow(BitBtn2.Handle, Speed, AW_HOR_NEGATIVE OR AW_SLIDE OR AW_HIDE);
AnimateWindow(BitBtn3.Handle, Speed, AW_HOR_NEGATIVE OR AW_SLIDE OR AW_HIDE);
AnimateWindow(BitBtn4.Handle, Speed, AW_HOR_NEGATIVE OR AW_SLIDE OR AW_HIDE);
AnimateWindow(Panel1.Handle, Speed2, AW_VER_NEGATIVE OR AW_SLIDE OR AW_HIDE);
if Panel1.Height = Expanded_Height then
Panel1.Height := Collapse_Height
else
Panel1.Height := Expanded_Height;
AnimateWindow(Panel1.Handle, Speed2, AW_VER_POSITIVE OR AW_SLIDE OR AW_ACTIVATE);
AnimateWindow(BitBtn4.Handle, Speed, AW_VER_POSITIVE OR AW_SLIDE OR AW_ACTIVATE);
AnimateWindow(BitBtn3.Handle, Speed, AW_HOR_POSITIVE OR AW_SLIDE OR AW_ACTIVATE);
AnimateWindow(BitBtn2.Handle, Speed, AW_HOR_POSITIVE OR AW_SLIDE OR AW_ACTIVATE);
AnimateWindow(BitBtn1.Handle, Speed, AW_HOR_POSITIVE OR AW_SLIDE OR AW_ACTIVATE);
end;
end.
Subscribe to:
Posts (Atom)