Are there any good materials or examples on creating a custom Designer in the Delphi IDE - delphi

I am working on creating a custom form designer in the Delphi IDE. I'm trying to use the RegisterCustomModule, TBaseCustomModule, and ICustomModule functions, classes, and interfaces.
My first question on this pointed me to the Delphi Developer's Handbook and the idea that I could even create a custom form designer. However, that book seems to be all Delphi 3 information and things have really changed since then. I'm not finding any material in the Delphi Help file, and searches have not returned very much.
I did find the Accidental Programmer's page on the Open Tools, but that looks like it was last updated in 1998? It does at least have the correct unit names and uses the new interfaces.
I'm willing to track down and buy an older book if that is the best reference.

would be a good resource if only it were to point to documents which still exist. Sadly the BDN disappeared some time after Embarcadero purchased Borland's developer tool line. The OTA documentation disappeared from the product line some time after that. However searching Embarcadero's website turned up these 2 links which might help: http://gexperts.org/otafaq.html and http://mustangpeak.net/opentoolsape.htm

Related

migrate huge old Delphi application to newest Delphi version

I have an old Delphi application and i want to migrate it to the newest Delphi version. The problem is that the application is huge and migrating whole app at once would be too complex. I wonder what is the best approach to do this... Maybe form by form, placing a form into a dll and then using older forms in the new Delphi app and replacing them one by one (after clients confirm one form is working ok to continue with the next one). Not sure if this would be possible at all...Any other ideas?
I presume that based on your comments you do not have comprehensive test cases. In that case, you are simply in a world of pain, and there is nothing that will truly mitigate that. Without test cases, any approach you take will generate errors and bugs that will take you quite a while to catch them all. Build that into your expectations. In fact, with those as your expectations then you need to schedule a large testing phase and maybe that is a good approach. Upgrade all at once and test over the course of a few months.
You could first identify all 3rd party components that will eventually be needed and upgrade them to the latest version one at a time. That way you can at least identify bugs in a controlled manner per 3rd party component. Again, since you are relying on manual testing, this also will be error prone, but maybe you can focus on areas that use the upgraded component preferentially.
here my advice.
Before you start migrate, do a refactoring of your existing source-base.
1.) Remove un-used stuff.
2.) Try to move as much as possible to standard delphi components.
3.) Remove "un-used" units from your uses-statements.
4.) If needed, try to do some layering (App-UI,App-Logik,DB-Layer,Libraries)
5.) Look for 3rd-Party Components/Libraries, which might be not needed anymore in the latest Delphi Version, because the functionallity is now included in Delphi. If you spot such components/libraries, try to encapsulate them.
Now you have a new version of your software (still in the old delphi). Test it as exact as possible (Unit-Tests would be perfect).
If this is done, then you start to migrate to newer Delphi. I recommend to do it in one go (instead of dll and one by one).
I do not think there is enough information presented to give you specific advice.
My answer would be to bring in knowledgeable experts to look at your code, talk to your staff, look over your documentation and tests, and then present you with smart options. This can likely all be done via Zoom/Skype online. If you think about how much money you are going to end up spending on the conversion, and how much money you will spend on fixing problems because you went off in the wrong direction (and how many customers you could lose due to bugs/performance issues) this would be an extremely cheap investment.
There are a number of firms with Delphi experience that could help you. (I do not work for one and this is not an ad.) There are some well-known Delphi consultants that would likely have some free, or small flat-fee type, initial conversation.
If you are using a version before the Unicode switch in Delphi 2009, there are a number of online resources to assist. Delphi Conversion Unicode Issues
If you want some real-time advice and chatting about specific issues, check out a Telegram server dedicated to Delphi programming with nearly 800 members. There are nearly always some Delphi experts online answering questions. https://t.me/delphidevelopers You should be able to get some consultancy contacts from that server.

Overriding the paint events in Formula One (1) in Delphi 7?

My company has a Delphi 7 application that relies on Formula One spreadsheets (TF1Book) for a key part of the application.
Users are pretty happy with the functionality actually, but it looks very dated now, especially now we have a Microsoft 2010 style ribbon interface throughout the rest of the application.
My question is whether it's possible to override the paint events for the TF1Book? It doesn't seem to expose anything and the source code isn't provided.
Thanks!
Formula One for Delphi is delivered as an ActiveX component. It is an excellent component, but it is somewhat aged now. In any case, you don't get the code, so you cannot make modifications. You are out of luck. You cannot change the appearance of Formula One.
My company used to use Formula One. We moved away from it a few years ago because we felt vulnerable without source code. We also had problems with the licensing of later versions of Formula One because the vendor wanted royalties which naturally we did not like. We anticipated 64 bit Delphi and took a decision to make sure we had source for all our external libraries.
We ended up using DevExpress ExpressSpreadsheet. It certainly looks more modern. And you can customise it. We are happy enough with it although the standard of coding is very low. We had to implement many bug fixes and performance improvements because the design was so bad. But, it is still probably the best option.

Delphi code generation

I need to speed up my coding, too much work, so I need be able to generate code.
Any tools, any ideas?
Delphi includes Live Templates, a completely scriptable and configurable system for generating code constructs of any size or complexity.
Live Templates are, in my view, one of the more under-appreciated features in Delphi.
Find out how to use them at: http://delphi.wikia.com/wiki/Delphi_Live_Templates
and
http://delphi.wikia.com/wiki/Live_Templates_Technical_Info
Live templates are completely scriptable, meaning you can write Delphi code to do whatever you want with them.
An extendable example can be found here:
http://cc.codegear.com/Item/26420
Not a very good idea IMHO. If you need generator, then probably you have lots of code that looks very similar, so instead of generator, better thing would be to rethink and refactor code you have.
That should result in less code that is easier to maintain and less code in future for similar tasks.
If you are doing database application, then you could use some good visual SQL query builder to help you create queries. That is part that Delphi was not very good (I don't know if it improved in D2007 and D2009)
EDIT - Regarding SQL generation
There's lots of comments about query builder.
Well, I suppose I'm spoiled. As I remember, Delphi before version 6 (or maybe even 5?), had decent visual query builder. I had 0 (zero) bugs in SQL when I selected fields in query designer, opposed to writing SQL by myself.
SQL is just string in Delphi, there is no compiler checking, so this was the best way to ensure that SQL is correctly written.
If you mean something like a modeling tool, you could try out ModelMaker.
Rather than trying to code generate, you should probably just obtain code to do the bulk of what you want to do.
There are hundreds of free products at Sourceforge for Delphi.
And there are hundreds of thousands of code samples at Google Code Search that you can use.
Plus lots thousands of free or purchaseable components at repositories such as Torry's Delphi Pages or Embarcadero's Code Central for Delphi
Using components already made is the fastest way to speed up your coding, and to add capabilities that you would never have been able to.
For me best way is by creating custom components, and then create designer for this component.
I have find that i spent most of the time writing code that read/write values from controls. So i created control that can read, write, validate values, and automatically fill form or stored procedure or directly generate SQL and execute.
Custom designer allows you to setup all properties easy. Now i don't write code for such trivial task i just put control , open designer and set properties and rules that must be satisfied.
ModelMaker Code Explorer speed up my coding in times. It has a nice hotkeys for synchronising implementation and declaration, so if you changed one, you don't have to search for it pair. Also, very nice feature is, method editing dialog. And many more.
Have you tried GExpert? It is a set of tools built to increase the productivity of Delphi and C++Builder programmers by adding several features to the IDE. GExperts is developed as Open Source software.
Other alternative is using project template by saving a framework into the IDE Repository, create your own components and frames.
I wrote a code generator calle CodeTypo. I'm used it in many production environment. You can find it here: http://dade2000.altervista.org/index.php?page=CodeTypo
It's still in beta phase but is usable and reasonably stable.
I'll migrate all content of this old site in the new one (www.danieleteti.it) in english. And I'll add some other info about CodeTypo and code generators.
The thing that sped up my Delphi coding the most was getting CodeRush for Delphi (via a DevExpress VCL subscription for Delphi 5, 6, 7) and setting up a ton of templates.

Is It Time To Rethink The Delphi Help File System?

The majority of components available for Delphi do not have HTML Help files for Delphi 2009. Many components including some very popular commercial components only have HLP and CHM help files.
Many of the third-party components are no longer being actively developed but are used by many developers. As a result there is no IDE help for these components.
There were very few complaints about the old CHM help files but today there are a large number of complaints about the help file system. Maybe it is time for Codegear to rethink the type of help file system used.
One of the complaints that I have about it is even when you install components that provide HTML help files the Contents Tab becomes corrupted where by previously installed component contents are removed.
Are there possible alternatives for Codegear to consider?
I have the same feeling. The old help system helps me more quickly to find an answer.
One idea is to maybe to model it after the Delphi Wiki at: http://delphi.wikia.com/wiki/Delphi_Wiki
The wiki actually isn't set up that bad, especially with the VCL link in the left frame.
It's fairly pleasant to look at, has a decent search, includes issues, examples, cross references, and what I like the most: user comments and tips.
Actually regarding the user comments and tips, the thing I like most about the PHP documentation at www.php.net/docs.php (which I think is the best programming documentation I've seen) is the user comments and tips.
If they can integrate the great layout that you'll find at Delphi Basics into it, and allow 3rd party components to add their help files into it, then they'll have a complete reference. (But the 3rd parties will obviously have to restructure their help files to the new format - whatever it ends up as).
The wiki also has sections for Tutorials, Tips and Tricks, References and Popular Articles. And I think it could also become the all-encompassing code-repository we all would like.
An option to download the help wiki should be allowed so it can be accessed offline.
And they'll have to figure out how to get the F1 key to work to properly search the wiki/help file, whether online or offline, and give the most relevant results.
The trouble with the Wiki now is that it is not complete, and the full set of Delphi help files need to be incorporated into it.
This might be a pipedream, but something like this would be my ideal.
This is a pet hate of mine. The Delphi Help has just got worse, although with a recent slight improvement. I honestly believe that this is one of the things holding back its adoption.
Micosoft introduced Help3 for VS2010, so maybe we will see it in Delphi too:
here is a blog post which answers the question "Why A New Help System?"
http://thirdblogfromthesun.com/2010/10/the-story-of-help-in-visual-studio-2010/
It quotes an internal paper, which led to the new "Help3" project in
early 2008:
"The paper described the following
issues with the help experience in
Visual Studio:
Not being able to find the information you need is a common
problem. F1 Help and Search do not
work as well as they should.
The performance of the help system – primarily start-up, topic-load,
local search results – is one of the
biggest problems.
The offline MSDN library install is fragile due to the complexities of
the help system.
The proprietary nature of our help format offers little incentive for
partners to develop authoring tools
and cannot be easily adopted by
developers in their own products.
On the content production side, the help platform saddles us with
outdated tools and processes.
Finally, and most importantly, no single team at Microsoft owns solving
these problems."

How many people have abused your 'with source' purchase option?

I'm interested in finding something out. In Delphi the default since the begining when buying components has been to be able to purchase them with source (even if it might be a slightly more expensive option). This made sense in Delphi for a number of reasons, firstly Borland led the way by providing the full source of the VCL with every install of Delphi, but also having the source was considered essential since when you upgraded Delphi you had to recompile and sometimes Authors went out of business.
I'm interested in finding out whether any Delphi component writers out there have ever had reason to regret selling their component 'with source'? Has someone tried to release a competing product based on your code, or passed it off as their own?
The reason I ask is because it still seems to be the exception rather than the norm to provide a 'with source' option when purchasing an ActiveX control or a .NET assembly. Maybe a reassurance that people don't want the source for nefarious purposes might convince more component writers to allow source code to be purchased along with the component.
I have personal experience with this. I used to sell a component and function library for Delphi (Clipper Functions for Delphi, AKA CFD); we went from version 1 in '96 to version 5 in 2000 when I took a job that wouldn't allow moonlighting. We had 5000+ registered users at the end; I still provide quite a few of them with free updates and occasional bug fixes.
I never had any reason whatsoever for not making source available. In fact, there was no option to purchase CFD without source. I wouldn't buy any commercial Delphi component library that my app would depend on without source, for the very reasons you cite (recompiling with new Delphi releases and vendors going away).
Unless the component writer is using some form of obfuscation the source for any .Net assembly can be obtained by using reflector.
I've used this on assemblies from Microsoft as well as other vendors to track down problems in their code. In some cases I went ahead and patched the problem and recompiled it; but do that at your own peril.
For all Delphi components which I developed over the past 10 years, full source code was always included. It would however be a big advantage to have a compatible binary (DCU) format (similar to Java and .NET) in Delphi for trial versions, or for low cost 'personal editions' - versions which do not attract the real commercial developers, because of the missing source code. Compiling DCUs for Delphi 5,6,7,2006, 2007 and 2009 is possible (if the Delphi licenses are there), but managing so many different code versions requires a lot of work for automatic build and packaging systems ...
I have an issue especially with .Net skinning libraries. I have found none good enough that would include the code for a fairly economic price. I'm talking about prices that go over the $1000USD price line, which I think it´s astronomic for a freelance developer, for just a piece of software. But, those things that are harder to implement in each language are the most expensive as well, so there is a relation between those two factores in the difficulty of implementing something similar your self. I know this is no answer for your question, but my own view of things.
I don't have personal experience with this, but I do know that source code watermarking is available and some vendors have used it. Not sure how successful it would be.
I have never heard news of anyone releasing a competing product with source code from another commercial vendor. It does however happen frequently with open source ones though.

Resources