Frequently Asked Questions (FAQS)

Kevan Booker's Arrow Example Project (click on the Demo button multiple times) In Chapter 13 of Mastering Delphi 5 (pp. ), Marco Cantù shows how to create a TMdArrow component to draw arrows up, right, down or left.

ClassName ; Casting an object Sometimes, it's necessary to help Delphi by casting an object: Improved Code Editor gutter. Simulation of an odometer. Reading from a tab-delimited file Here's how to read each line of a tab-delimited text file, and save this into an SQLite database: Assembler object object orientated file Turbo Assembler.

Webopedia's List of Data File Formats and File Extensions

Programming in Delphi Introduction. The Delphi language was formerly known as Object Pascal, and is an object-oriented version of the venerable Pascal language, combined by Borland with a Visual Basic-like RAD tool that lets you write fast GUI applications with no run-time, a very rich set of components (VCLs) that can be statically compiled.

To create a tabbed control that uses only a single body portion page , use TTabControl instead. Microsoft Inductive User Interface Guidelines. Must be provided with a BPL for design-time packages. Unit in compiled format.

Net version of Bold which was already available in Delphi 7. ECO lets you build a. Net application from an Object model, regardless of whether the persistent layer is object or relational. To create UML class diagrams and generate code. If you need to show different sets of controls, you can do this either through MDI child windows the main form being the MDI parent , stand-alone frames, or frames displayed in a pagecontrol tab widget.

A frame doesn't show flickers when it is displayed. Doesn't display anything GExpert 's Class Browser. ExeName to ParamStr 0. Considering you can build tight, dependency-free code with Delphi, what's the point of wasting time with a lower-level language that was originally just meant for system development back in ?

GExperts offers a Class Browser to see the list of methods, properties, and events provided by an object. Net, unless you're more familiar with Delphi and would rather use the same language to work with. Make sure Unit2 is referenced in Unit1's Implementation through "Uses Unit2", and that all exported routines in Unit2 are declared in Unit2's Interface section. An array created in a routine procedure or function , even if its size is statically defined, is considered an "open array", and thus, starts at Here's how to extract tokens from a text file using TRegExpr:.

You can combine the Object Inspector and Object TreeView windows through drag and drop,and dock them to the text editor with further drag and drop.

You can write programs using just the Object Pascal, a. Delphi, language and make direct calls to the Windows API so as to builder smaller programs. First, it looks like it's not enough for the second form to be part of the project: It must also be listed in the Uses section of the first form ie.

Uses Unit2 , along with the var section of its interface var Form2: TForm2; , before being called with this kind of code:. From "Delphi in a nutshell" A package has the extension. You must first save the. PAS file and the.

Yes, because unlike internal data types like String or Integer, objects must be created manually through Create and freed with Free any object, it's a good habit to check a projet with the FullDebugMode option of FastMM, especially during the initial construction phase of the project.

Some utilities such as this one use RTTI to read this from an object which requires upgrading to Delphi for full information more basic information available through RTTI on previous versions of Delphi.

Uncheck "Automatically poll network". Can I indent a block of code in one go? Can I comment a whole block in one go? Recommended components and packages Some are open-source, some are just freeware, and yet others are commercial: DevExpress Bunch of component packs , a bit on the expensive side; includes the free but documentation-free Express ForumLibrary with components such as dxfOutlookBar, dxfClock, dxfTimer, etc.

Memory Sleuth NuMega, etc. Delphi in a nutshell Components and packages Note: DCU that you add to your project via the Uses section and will be compiled statically into the EXE, a bunch of source files referenced by a.

DPK master list file, to be compiled into a single package file. BPL , a bunch of compiled files. BPL already compiled for you. Packages come in three different forms: Those that are design-time-only ie. From what I understand, a typical situation is thus: When using a design-time package, I am provided with a BPL that will be added to the palette. In addition, DCU files are required to allow for static linking.

On the other hand, when using a run-time package, the package designer must provide a DCP since it is required to let the compiler know how to link to the BPL file for dynamic loading.

When creating a package that is both a design- and run-time package, are there two different BPL files, or is there some kind of switch in the file that lets the compiler use the same file in two different contexts? How can I tell if a BPL is design-time or run-time? Because the IDE will complain if I try to a run-time package to the list of design-time packages? PAS files; Similar to. Project master file when developing a package; equivalent to.

Project Manager to list all the units that make up a project , Object Inspector to view parameters of a unit , Object Tree View To list widgets contained in a form , Desktops to save, and apply a desktop definition, so that windows are displayed in a way you like , Toggle Form Unit also accessible through F12 Project: To create or install components.

PAS files , and install packages. Into existing package Unit file name. Here's a skeleton of a unit: GUI In the empty form that shows up when starting Delphi, add a label and a pushbutton, double-click on the button, and add the following code to the Button1Click routine: You'll have to use Win32's MessageBox instead: The important point is freeing the object from memory, or your application will leak memory.

There are three ways to handle this: A third way is to use the With structure with Nil as the parent, but in this case, Free must be called explicitely: Initialize; Here's an example to trigger an error: Create; end; Reading from a text file Here, we'll read the file line by line: Reading from a tab-delimited file Here's how to read each line of a tab-delimited text file, and save this into an SQLite database: Free; Playing with radio buttons At design-time, the best way to add radio buttons to a form is by first adding a radiogroup object, and modify its Items property to add radio buttons.

Here's how to display the radio button currently selected, if any: ItemIndex] ; A more complicated way: Here are some examples: Add 'Hello' ; Adding an item at a specific location in the list ListBox1. Insert 3,'Hello' ; Reading the item that was double-clicked procedure TForm1. Items[index] ; end; Selecting a directory Here's how to display a dialog box so the user can choose a directory: Terminate , but the latter doesn't trigger the onClose or onCloseQuer events: The one that ships with Delphi 7: Moved to Internet Development with Indy components Checking the class of an object If you need to display the class of an object: ClassName ; Casting an object Sometimes, it's necessary to help Delphi by casting an object: How do I use Caller ID in my own applications?

For example, function CheckStrings A: Boolean; This indicates that the function operates on all arrays of the specified base type, regardless of their size, how they are indexed, or whether they are allocated statically or dynamically.

Instead, you must either create a type Open array parameters allow arrays of different sizes to be passed to the same procedure or function: Open array parameters and array of const "Usually, you can pass open arrays as const parameters. Open array parameters that are not passed as const will entirely be copied into local storage of the routine.

The array is simply passed by reference, but if it is not declared const, the hidden start code of the routine will allocate room on the stack and copy the entire array to that local storage, using the reference as source address.

For large arrays, this can be very inefficient. So if you don't need to modify items in the array locally, make the open array parameter const. Notice that all the data-aware components are unrelated to the data-access technology, provided the data-access component inherits from TDataSet.

Create 'Insert the name' ; Datamodule There are two ways to refer to a record in a dataset: Here's how to fill a regular combobox with stuff from a dataset: Open; while not cds. Text] ; Other stuff http: You should choose a solution depending on how big the database is, and whether you have the luxury of choosing a specific database engine or the application must be database-agnostic: Despite a few problems, the BDE is one of the reasons for Delphi's success in the database arena and, having reached version 5, it is a mature technology.

So why move away from the BDE? Deploying it on rented Internet servers is often impossible because of ISPs' concerns about running system-level services on their servers.

Although the BDE has been updated to support features like the Oracle 8 object-relational model, some of its features are still bound to its Paradox roots.

The BDE also does local caching but won't allow you to interact with it. However, a few Delphi programmers have learned to use the ClientDataSet component to operate on cached data. As Delphi became one of the leading application development tools for the Windows platform, individuals and companies proposed alternative interfaces to the BDE.

The common denominator for database access in Delphi is no longer the BDE. Instead, it's the TDataset class. What TDataset isn't - TDataset has no: For information on the advantages of using client datasets to cache updates, see Using a client dataset to cache updates Client datasets can apply edits directly to a database server when the dataset is read-only.

It provides a simplified framework for data access based on OLE DB, the real power horse behind the scene. Just as the BDE includes some Paradox-related features, ADO includes several features which are more Access-oriented than a universal data access solution should provide.

This interface was designed to broker access between Delphi and virtually any relational database through 3rd party drivers. Borland significantly improved the performance of dbExpress with respect to the BDE, but the implementation was buggy and supported only a limited subset of SQL that hampered functionality.

DataSnap Direct - is Borland's new cross-platform data access layer. Unlike the BDE, dbExpress returns only unidirectional cursors and therefore does no caching.

This component, which can be used in place of other DataSet components, permits for the reading and writing of single user flat files. Generic client-to-database layers like the BDE, ODBC, dbExpress and ADO hide most of the capabilities of transactional database engines, flattening connectivity to a generic "lowest common denominator". It takes heavy layering of client and middleware driver code between the user and the database to accomplish this flattening, while disabling essential capabilities of the server databases' engines.

From the start IBO freed itself from the restrictions of TDataset and its limiting, local database oriented memory model. One of IBO's significant benefits is that its native data access architecture is built from TComponent up. The data is provided by an application server, which you also write using Delphi. While the application server does make use of the BDE, the client application does not. Client applications created using MIDAS are often referred to as thin clients, since they require less configuration and fewer files specifically, no BDE.

As explained above, since dbExpress datasets are always read-only and unidirectional, you can only navigate by iterating through the records in order, and you can't use the dataset methods that support editing. A virtual dataset for accessing a database. Conceptually data is handled in table form - each row required is buffered internally.

Columns are represtented using Fields. A dataset is the fundamental unit for accessing data is the dataset family of objects. Your application uses datasets for all database access.

A dataset object represents a set of records from a database organized into a logical table. These records may be the records from a single database table, or they may represent the results of executing a query or stored procedure. The state - or mode - of a dataset determines what can be done to its data. At runtime, you can examine a dataset's read-only State property to determine its current state.

To read or write data in a dataset, an application must first open it. You can open a dataset in two ways: Either set the Active property of the dataset to True, at design time in the Object Inspector or in code at runtime CustTable.

There are three basic classes of datasets: Table type datasets represent a single table from the database server. As such, it can represent a table, query, or stored procedure.

TClientDataSet behaves most like a table type dataset, but it also has some of the features of queries and stored procedures: Property and method names are like TClientDataSet, including parameter support, indexes, and the ability to execute without retrieving a result set. TIBDataSet can represent both queries and stored procedures. In fact, it can represent multiple queries and stored procedures simultaneously, with separate properties for each. Each type of dataset connects to the database server using its own, TCustomConnection-derived type of connection component, which is designed to work with a single data access mechanism: Useful methods to retrieve metadata from the database server: Here's how to have a dataset run an SQL query programmatically: Here's to modify a record in a dataset: Display a single record vertically, ie.

Managing data with SQLite More information here. Debugging Techniques in Delphi Run Sysinternals' Dbgview , and call OutputDebugString 'Some string' ; An exception is an alternative way for a function to report the outcome of its operation.

If you just want to run some code that could trigger an exception, use the following: Message, mtWarning, [mbOK], 0 ; end; You might wonder why a resource is allocated before instead of inside a try block. In case the object couldn't be created in the first place, Delphi will jump to the nearest exception handler, and the Finally section is ignored entirely: You can do this as follows: PAS , a compiled source file.

DCU , a source package that you must compile yourself. DPK , or a compiled binary file. BPL, which requires its corresponding.

DCP if you want to use it in design mode instead of just at run-time Most grids are inherited from TDatasets, which isn't available in the Personal version of Delphi. If using the Personal version, get a so-called unbound grid A grid is just that; a spreadsheet also includes some computing capability, ie. Excel in your app If you get the error "Could not create output file myfile. The PageControl component has [TTabSheet] tabs on one side and multiple pages similar to panels covering the rest of its surface.

There is one page per tab, so you can simply place components on each page to obtain the proper effect both at design time and at run time. The TabControl has only the tab portion but offers no pages to hold the information. In this case, you'll want to use one or more components to mimic the page change operation, or you can place different forms within the tabs to simulate the pages.

Page stores a list of TabSheet objects. TTabControl is used when displaying the same controls on multiple tabs, eg. It is useful for developers who want to add scripting abilities to their projects FastQueryBuilder: Visual SQL query builder. It allows complex query creation based on several data tables without having to learn the SQL language User's Manual to work within the Designer application , Programmer's Manual to work from the Delphi application , and Developer's Manual to create custom objects and function libraries for FastReport are available here the developers manual as to how to create custom objets and function libs for fr.

If you don't have the installer, here's how to install FastReport 4 manually: Compiling this project will fail otherwise Several demo projects in Here's how to build a basic, one-page report at design-time to show a barcode, fill it with data at run-time, display a preview version, and let the user send it to the printer: By default, the report will be saved in the form's DFM file.

Close the Designer Back in Delphi, add a push button, and add the following code to fill variables with data, display the Preview dialog to let the user check that it looks OK and then send the job to the printer: This is the connection between your application and the the report that we will produce below optional You can add a TRvSystem and link it to the RvProject control through its Engine property.

RvSystem is responsible for the general configuration of the reports which printer to use, the margins, etc. ProjectFile property to point to this Rave project file Add a pushbutton on the form to call RvProject1. Open the Rave Designer application Select the report in the treelist on the right Open the Parameters item Add "Name" as a parameter, and close From the Report tab, add a DataText control, change its DataField property Project Parameters to link it to the Name variable that we just created.

Close; Post-Initialize Variables are those, like number of pages, that are only available after a report has been pre-processed and is ready to be printed. Elements common to multiple pages or reports can be put in a Global page. Rave also supports conditional printing. Printing barcodes on labels Here 's the goal. Initially it was designed as a replacement for RichEdit but now it does a lot more.

It also has some redrawing bugs" , and its free small brother ThtmlLite widget added to Samples palette. In opposite to Jeffrey Pohlmeyer's wrapper all functions are loaded dynamically. Here's a possible check-list: Print Column auto-sizing Column sorting by clicking on header Column merging Column re-arranging by drap and drop Double- clicking on a row selects the entire line Flat and hierarchized rows main row, sub-rows As a reference, here's the size of an EXE built with Delphi 7 Enterprise to contain just a grid make sure you clean up the Uses line in the PAS file when replacing one grid with another You can't use this grid without linked database To install: Launch Delphi, and open the DPK file, eg.

No forum for support? Berg GridView Moved here. Here are a few actions that you can perform with this control: Here's how to make a column read-only but allow editing for a specific cell depending on the value of another column in this row: A grid that would allow you to build unique user interface solutions? Checked If you want a task pane to resize automatically if the user changes the form's size eg. Here are some well-known components that support Internet protocols: Magenta Systems File Transfer Components are copyrighted software, but the compiled component DCUs may be used without cost in applications for use by the developer or within their company but which are not otherwise distributed including freeware and shareware.

You don't have to use a variable to hold the pointer to the instance source: TPageControl Use a TPageControl to host the different pages, hide them all, and only display the desired page when the user selects the item in a menu.

Frames Create frames, and insert the desired frame in the main form at runtime Resources TPageControl - Delphi Usage Examples, Tips and Tricks Displaying a lot of fields If your application connects to a SQL server, it will have to display and handle a lot o fields that users can edit and save. Here are ideas proposed by experienced developers: Net Delphi Review: Register with Borland, and download hotfixes Install DelphiSpeedup Make those changes "The installation should have created a shortcut named "Delphi for Microsoft Win32" in its program menu entry.

That will already speed up the load time. If you have not done so yet install the update 2 you can download from the registered users site. The BDS Welcome page has a link to that on the lower left. They were originally posted on blogs by Borland people e. DCU Unit in compiled format. In a Delphi application, every form has a corresponding unit behind it. Text ; Child forms: MDI or frame or pagecontrol? How to add a routine to the list in the class? How to install GExperts? How to upgrade CnWizards?

Silently ignores it if sender is not a TControl, which will have unexpected results.. Faster than 'as' if you know that sender definitely is a TControl. How can a runtime frame notify its parent form? How to close a dynamically-created form?

In the calling form: Show; end; In the dynamically-created form: Can the IDE show the matching end for a given begin? Delforex is now part of Gexperts. GExperts allows you to locate a matching delimiter eg find an "end" from a "begin" , but it doesn't highlight them automatically like Castalia, for instance. CnPack uses color highlighting to do just that. What's all that hype about? Why upgrade from D7?

Improved Speed for Several Features. Message view Form Designer Design Guidelines. Form Positioner Code Editor: Improved Code Editor gutter. Close all other pages. Refactoring Debugger Remote debugging. Sort by load order. Close implicitly opened files. Operator overloading Non-virtual method declaration Regular instance methods Constructors with non-empty parameter lists Static methods and properties FastMM built in More information on changes since Delphi 7 http: So What is the Point?

Why use Delphi vs. After moving routines into Unit2, the project stops compiling Make sure Unit2 is referenced in Unit1's Implementation through "Uses Unit2", and that all exported routines in Unit2 are declared in Unit2's Interface section. How can I change the application's icon?

Project Options How to change the default application icon? Why does my local array start at 0 instead of 1? An array created in a routine procedure or function , even if its size is statically defined, is considered an "open array", and thus, starts at 0: Here's how to extract a single bit in a text: Here's how to extract tokens from a text file using TRegExpr: How to get an MDI child form to use the whole client area?

TForm2; , before being called with this kind of code: Show; end; I messed up Delphi with an update, and get errors at start-up! I had an issue with the Rave part after running the 7. Here's how to restore Delphi: Why use a package vs. In the Project menu, what's the diff between Compile and Build? I can't compile my first program! From Greg Lorriman in comp. In this regard delphi has the same relationship to ocx's as VB. But a delphi app is much less likely to use ocx's than a VB app.

I've never used one except experimentally. Yahoo Desktop Search is its closest competitor in terms of functionality and this search tool has one feature that YDS lacks: Delphi Message Assistant 2. DelphiPI automatically resolves dependencies between packages, compiles, installs and adds source paths to your IDE.

DelphiCodeAnalyser Analyse the design quality of your delphi code. You will never again format your source code by hand. The formatting engine of DelForExp has been integrated into the code base of GExperts and there is an experimental GExperts version available that includes the code formatter see below.

Documentation Insight Documentation Insight is a source code documentation solution which helps you naturally browse and document source code in RAD Studio. It also allows you to produce rich API documentation files and deliver to your customers.

Explain is a help file making software. It includes a built-in screen capturing tool with ability to automatically annotate Delphi forms and windows.

FastMM FastMM is a lightning fast replacement memory manager for Borland Delphi Win32 applications that scales well in multi-threaded applications, is not prone to memory fragmentation, and supports shared memory without the use of external. FinalBuilder A great tool for automating your build process. Also written in Delphi! Firebird Relational Database - Based originally on the Interbase open source released by Borland, this database is a good free database that is suited to many application's needs.

Firebird Embedded A page where you can obtain information about an embedded version of Firebird. FixInsight A static analyzer that detects source code issues in Delphi applications and helps find bugs early in the development process. GExperts is open source software. There is also an experimental version of GExperts that includes the DelForExp see above code formatter.

Help Generator Help Authoring tool with the ability to generate topic pages from the application you are writing help for. ICARUS A freeware tool that analyses uses lists in your Pascal or Delphi source code, and tells which units that may be removed or moved to the implementation section.

IcoFX A free icon editing tool to design or package. InnoSetup A nice free installer that comes with full Delphi source code. MadExcept A replacement exception handler that gives stack dump and much more upon exceptions, rather than default uninformative exception box.

Can display, save to file, or email exception report, and much more. MakeUpd Created by Gregory L. Bullock's is a useful utility for patching binary files.

The full source code is available on the web site. Pascal Analyzer A tool that analyses your Delphi or Borland Pascal source code and produces 40 different reports that help you understand your source code better, and assist you in finding errors and anomalies.

Pascal Browser A tool that analyses your Delphi or Borland Pascal source code and produces documentation. ProDelphi A Delphi profiler that works by instrumenting the source code. Also provides Post Mortem Report for crashed applications.

SamplingProfiler A free Delphi sampling profiler that doesn't require instrumentation. Provides statistical profiling data without affecting execution time or application performance behaviour. Can be used to profile applications unattended for very long periods or in production environments.

SmartInspect SmartInspect is an advanced logging tool for debugging and monitoring Delphi applications.





Links:
Cbd oil forums uk | Trendlinie Breakout Forex-Handelsstrategie | Steuer handel optionen | Der auf eine Anleihe bezogene Marktzins wird auch als bezeichnet | Online-Handel bedeutet | Aktueller Silberpreis pro Gramm uk | 40 Jahre Hypothekenzinsen Kalifornien | 1935 d Silberviertel |