The “NoDrives” Registry entry allows to hide a drive (/drives) you do not want to get displayed by Windows Explorer and/or from the standard Open Dialog box. Here’s how to programmatically check if a drive is hidden using Delphi.
Category Archives: delphi
Quick Tip: Implement Zoom In Virtual TreeView Using CTRL + / CTRL –
Most Windows applications I use in my daily work (email clients, browsers, text editors) have a handy feature allowing to make the text larger by increasing (or smaller by decreasing) the font size. Increasing the text size in a web browser is something I got accustomed to doing frequently – to make the web page easier to read if the default text size was set too small for my eyes.
Even though all applications have some visual way (track bars mainly) to zoom in/out their display – all also support zooming by using (standard?) keyboard shortcuts. CTRL+Plus to increase the font size, CTRL+Minus to decrease. Am not sure if you know, but Delphi IDE unit editor also has this feature.
Continue reading
Speed Up Your Delphi Database Apps Using Remote SQL
I recently came across a new product in the Delphi world called RemoteSQL. I use and see a lot of Delphi components in my day to day work, but this one caught my eye because it deals with one of my (/everyone’s) pet peeves – speed. RemoteSQL is an additional client-server application tier that significantly speeds up the connection of a client application to its database, when they are not in the same network. According to GoFast, the creators of RemoteSQL, in a typical environment using their system can speeds up your connection by a factor of between 5 and 40, and in extreme cases up to a factor of 80 which, if true, are rather impressive numbers.
Continue reading
64-bit Delphi Applications Using TWebBrowser to Display PDF Documents – Go or No-Go?
I have an application using TWebBrowser component to allow viewing of Adobe PDF documents within the application. This approach is really pretty simple: when a user of the application has Adobe Reader (/Acrobat) installed, by default any PDF documents will get open inside Internet Explorer (and therefore inside TWebBrowser) – neat and simple way to provide easy PDF preview in a Delphi application (until you go 64-bit…).
Continue reading
Fun: Refactoring a Complex Delphi Boolean Function
Refactoring your own code is, what I guess, something that you do frequently – at least I am. Maybe a better description of the process I went through would be rewriting, but let’s stick with refactoring. Either the routines get too complex, or there’s an extra parameter needed or there’s some new special case to be handled, never mind the reason, refactoring of your own code is what we all do and should do.
Continue reading
TToolBar’s TToolButton AutoSize Width Issues (Empty Captions)
If you are using the TToolBar control with TToolButtons in your Delphi application (are you not?, in at least one :\) with “Enable runtime themes” enabled for your project, you might have noticed you cannot easily alter the width of an individual button. What’s worst, if you are using button images and for some of the buttons you want the Caption to be displayed and for some not – the empty-caption tool bar buttons will have a too long width.
Is there a way to fix the width of the no-caption buttons so they “match” the width of the bitmap/glyph/image? For a long time I thought there’s no way to fix this, as whatever property I would change, the display, at run time, simply did not look right. Until I’ve found (as you will see: a very) simple solution.
Continue reading
TLiveIni – Custom Delphi INI Implementation
Text and code by Ron Maupin.
I had to build my enhanced INI class that replaces the database. My Modula-2 version used a doubly-linked list (section) of doubly-linked lists (key/value pairs) for the INI. Delphi’s generics made this much easier, and I now use the TDictionary, although it could be done with TStringList. I used the Delphi ability to have an array property (IniFile[Section,Value]) to simplify assignments and set it as the default property of the INI object. I also didn’t want to get lost in the weeds of having different properties or methods for different data types, so I built some record helpers in the application for different data types that simplify assignment (IntVar := IniFile[Section,Value].ToInt or IniFile[Section,Value] := BoolVar.ToStr).
Continue reading
Preserving Set Type Values in INI Files (/Databases)
A quick look at the todo list revealed: today is the day to add the following new functionality to my Delphi application: allow the user to change the visibility of some user interface elements on a one-could-say very complex form. There are several controls on the form some users could find to be “too advanced” and they basically will never need em. Naturally, users would prefer such elements to be made invisible to make their final user interface experience less complex (messy) – so that they can better focus on those elements that are important to them.
The first idea is simple: let’s provide an enumeration listing those controls that can be hidden by the user. Let’s group those in a set type variable and expose as a property. Add (inside the configuration screen) a list of checkboxes allowing the user to specify what elements he/she wants to see and what should be hidden. All set, let’s do some coding…
In this application I’m saving all application / user specific configuration settings in an INI file. The TIniFile exposes various WriteSomeValueType procedures. There’s no WriteSet. Oh, so the question to solve before we do any coding: “how to preserve (save/load) set type property value in an INI (or in a database) ”
Continue reading