Delphi
EnTabFile is a tool to convert the spaces at the start of each line in a file to tabs. This allows them to work better in editors that support proper tabs. It is primarily designed to be used as a command line tool, but supports manual operation too.
How EnTab works
This tool is quite simple – it just removes spaces at the start of each line of an ANSI text file and replaces them with tab characters. It does not replace any spaces anywhere else in the line – it stops once it find anything that isn’t a space.
The number of spaces used for each tab is settable in the user interfaace, but the tool is really designed to be used from the command line as part of a bigger process – perhaps source code reformatting using something like DelForExp. Set DelForExp to output 4 spaces for each tab, and then use EnTabFile to convert every 4 spaces into a tab.
Note that if an incomplete set of spaces is found, a tab will still be output. Thus if there are 6 spaces and the tab setting is 4, then 2 tabs will be output. No spaces are ever left at the start of a line.
For safety, it will save an original copy with the extension “.pretab” that you can use to compare. If it already exists, no copy is made so that the entab can be done multiple times and the original is still there.
Manual use:
Run the application, and type in the name of the file you wish to entab. You can click the ‘…’ button to use a browser.
Select the number of spaces per tab.
Click “Entab” and it will be loaded, converted, and saved. A progress bar shows the activity.
Command line use:
Run the application with the filepath for the file you want converted. The full path should be specified for proper operation of the backup.
Only a single file can be specified on the command line.
You can specify the tab size using the command line switch /1, /2 /3 /4 /5 /6 /7 or /8.
With a command line, the app will convert the file (if it exists!) and then close immediately.
Delphi Integration:
For use within Delphi, you can add it to the Tools menu. The following are suggestions:
Title: EnTab this file
Program: [PATH TO FILE]\EnTabFile.exe
Working Directory: [PATH TO FILE]
Parameters: $SAVE $EDNAME
Note that if run after DelForExp, you will have to save before it can convert. After Entabbing, Delphi will say the file has changed and do you want to reload. The answer should always be yes or the tabs will not be loaded!
Download
A zip file with these basic instructions and the self-contained application are available via the link: EnTab for Windows. No installer is needed – just put the file in a suitable location, unzip it, and start using it.
One of the great things about Delphi is that there is a good supply of third-party components available. As a long term user of Delphi my palette has grown in size and I now have over 80 pages to choose from. So any component set has to have something special to get me excited about it, particularly in the general user interface category where there is a lot of competition. Raize Components 3 (RC3 from now on) has a lot that is special, and the main thing it provides is “polishâ€.
[This review was first published in The Borland User Group Newsletter.]
For me, polish is what distinguishes great apps from okay apps. It is the detail that is put into things that make life easier for the user, that extra time spent making sure things are ‘just right’. RC3 provides this on two levels. First, the components look great, and allow you to provide a good end-user experience with little effort. But most importantly, they make the developers life a great deal easier. This is not just a set of components to sit on the palette, but it includes a suite of property and component editors, and context sensitive menus all of which are well designed, and make life a lot easier.
To show a simple example, let’s take a panel. How often do you drop a panel on a form and then clear the caption property, followed by setting its alignment to top, or client? And then of course remove the border so it doesn’t stand out. With the basic Raize panel, the caption starts blank, and right clicking gives menu items to set the alignment, to remove the border, and also to edit the panel visually. This saves a lot of time playing hunt the property in the object inspector. And this is just the simple panel – things go up from here! Take the GroupBar component as another example. This is an outlook style bar that can display in either the classic style, a task list style, or as an XP category style. Menu items to set the image lists and alignment exist, but here you can edit the bar contents “live†which is more natural than a separate property editor, and allows you to see it exactly as it will appear. In design time, the component even says “Add groups by selecting ‘Add group’ from the context menu†so you don’t waste time working out how to use it. That is polish. So you add a group, and right clicking on the group gives more context-sensitive items. This is a nice component, and it has been made very easy to use.
The installation of RC3 gives you seven palette pages with 117 components, 22 of which are data aware and 9 of which are deprecated (components that are replaced by better components). The pages are labelled Panels, Edits, Lists, Buttons, Display, Shell, and Widgets but they contain more than they imply. The shell components are licensed from Plasmatech, so they have a good pedigree, and provide both the raw controls, and smart dialogs using them. The panels include the Panel and GroupBar mentioned previously, as well as a page control that can be used to replace the Win32 version, but which provides a wide variety of tab styles. These include XP themed versions, but allow for a lot of customisation of both the tabs and the border frames. XP theme support is provided using the now-standard Mike Lischke code, but RC3 components can automatically use XP themes, or emulate them if not on XP. Most of the components can use a “frame controller†that can set the framing options quickly for a set of components, or you can customise the components individually. All this really means that you can have your app look as you want it to, and add some polish yourself.
I shall skip over the splitters, status bars, group and radio boxes and mention the CheckGroup which is like a radio group but of checkboxes, so you get automatic alignment quickly and easily. All the groups have a variety of outline styles to choose from. Likewise I’ll do great injustice and skip the edits page – all of which provide the custom framing, and things like buttons in edit boxes so you can click to get a date-picker (or a custom edit with one or two custom buttons of your own if you want).
The Lists page is where more of the polish shows. Raize components 2 was the first component set I bought which had a list box with check boxes for each item, and a tabbed list box. RC3 improves these by allowing category titles in the check-list with a very smart faded background on each, along with an design-time editor to make it easy to fill. The tabbed list has a Cells property so that you can access the individual parts of the tabbed items – again making life easier for developers. Speaking of which, there are two variations provided – an EditList which allows the user to press F2 to edit an item in-situ, and a RankingList which allows the user to drag the items up and down. These are things that you can write yourself, but they are fiddly to get right, and here you just drop them on your form and move on. If I had one niggle about these, it is that there are derived from the basic List and not all available as a single mega-list with tabs, checkboxes, ranking, and editing. But I guess such a need would be rare. Other lists and combos include fonts, images (with indents and labels), MRU, treeviews, check-trees and listviews.
The buttons in RC3 include a wide variety of image compatible, shaped, toolbar and menu buttons. For those supporting glyphs, there is a nice image selector, with modern looking images that will do for many basic tasks. Of particular note is the DialogButtons component. Drop one of these on your form and you instantly have OK and Cancel buttons properly aligned on a panel at the bottom of your form. You can also show a Help button, and add other items there if you want. For a quick dialog, this has always been nice, but one of the most amazing facilities that RC3 gives is in the context menu for the standard Delphi form. Items added allow for adding a groupbar, toolbar, status bar, splitter, panel, image list, frame controller, and form state component. Additionally, there is ‘Create dialog’ and ‘Create options dialog’ which both put a dialog buttons component on the form, change the form settings to dialog borders, and for the options dialog creates a page control with two tabs ready and waiting. These all make the developer task easier, and save having to go find things on the palette. Of course it doesn’t eliminate all the work, but many of the things that you usually want to do are made a lot easier.
The Display page contains a variety of time-saving components as well as some nice implementations of the basics. The label allows rotation and different fonts, and the status pane is a label with border, but includes things like blinking. Derivations of this include scrolling, key status, and most interestingly a version info which makes it possible to show version information from your executable without any effort. This is why I buy components, and it all helps to meet user expectations of modern apps. There is also a background gradient/image component here, which along with the transparent option in virtually all the other components means that you can create great looking forms. Further display components include a URL label, border, arrowed-line and shaded separators, progress bars, scrolling LED panel, and a bitmap animator.
The Widgets page provides a miscellaneous set of items. Visually, there are comprehensive date, time and colour pickers each customisable with properties and events. You can set your form shape according to the outline of a bitmap, add a tray icon, make your tooltips into much friendlier balloons, save your forms state at runtime, send MAPI email and launch other apps.
I think I have shown that RC3 provides more than just a nice looking set of user interface components. The extras that are provided are what makes the Raize components the first I consider when building apps, and RC3 has added a great deal that will make my life easier. For existing users, an upgrade is an easy decision. For new users, it is well worth a good evaluation as a truly professional component set that will save you time and give your development and your apps “polishâ€.