| Didier Cabalé Delphi Page | ||
| Components | Programs | Tips | Games | Links |
![]() |
RAD Studio
XE4 is released !!
It delivers multi-device development for Intel and ARM devices, including Apple
iPhone, iPad, iPad mini, iPod touch, Windows and Mac. Try it! http://embt.co/RADXE4Trial
Interactive basic
viewer![]()
It's a long time I've been looking for a "basic interactive report viewer",
inherited from TGraphicControl, with little overhead, and html independant.
Not finding exactly what I wanted from outside, here is what I did:
1. digged into QuickReport
components source code.
2. adapted their QRX preview /browser, in modifying the layout.
3. proposed to QBS Software
(QuickReport publisher) some necessary modifications to the QuickReport source
code
.. and voilà, here is the interactive report I was after -> Interactive
basic viewer.
Want some more details ? download [this].
NB: this demo requires QuickReport 5.05.2 build2 or upper
TCsvTransform
class helper (ver 1.3)
Did'nt you ever need to simply store your data in a .csv (Comma Separated Value)
format, then load it in a TClientDataSet and play (CRUD) with it .. and then
save it back to the same (or other) .csv file ? Delphi does not provide any
built-in access to .csv data, but a TCsvTransform class helper makes it simply
come true.
How ? .. look at the example [here]
TFocusComboEdit
controls (ver 6.1)
Like TComboEdit or TDateEdit but showing a side-button displayed *only when
the control has the focus*.
Caution : These controls are TJvCustomXxxxEdit descendants and require JVCL
/RxLib installed.
version 6.1 supports LiveBindings -> can be used directly assigning TFocusComboEdit
to TLinkControlToField.Control property in object inspector.
TEventsHandler
class
enables to run multiple events at once, simulating event multi-casting. example
of use :
var
aEventsHandler: TEventsHandler;
begin
// create a new TEventsHandler with 'CreateNextForm' procedure as its main event
aEventsHandler := TEventsHandler.Create(CreateNextForm);
try
// set 'Validate' procedure to be run before aEventsHandler's main event
aEventsHandler.AddLinkedEventsHandler(odBefore, TEventsHandler.Create(Validate));
// set 'ClearStatusBar' procedure to be run after aEventsHandler's main event
aEventsHandler.AddLinkedEventsHandler(odAfter, TEventsHandler.Create(ClearStatusBar));
// run all events at once in the specified order
aEventsHandler.Execute;
finally
aEventsHandler.Free;
end;
end;
Vigenere
encoding unit
simple string encoding using Vigenere algorithm
Ascii2XML
utility (ver.1.1)
enables to transform any Ascii /flat file with fixed length fields to a XML
file, according the template of your choice.
For using it, follow these steps:
Nb: Requires JCLStrings.pas (from Jedi Component Library) and UParseReplace.pas
TEditableCtrlHolder
(ver.3.3) 
TEditableCtrlHolder is a data validator of any 'TEditableCtrl'(1) controls
of your TForm. For each of TEditableCtrl, you can set their DataType, MaxLength
and NullForbidden property. Check the validity of what you entered into each
TEditableCtrl against the properties defined above. You can also loop into all
TEditableCtrl to check if the entered values have been modified.
Version2 adds support to RxLib controls (TRxCheckListBox).
Version3 adds a OnValidate event-handler + support RxLib date-time picker controls
(TDateEdit and TDBDateEdit)
derived of TAlignedEdit from Peter Below (TeamB) that enables left, center or right justification of the text in a TEdit. This version enables text focusing when the TEdit becomes active, by removing the multi-line capability.
TDBTreeView
(ver.1.04)
Represents TDataSet records in a standard TTreeView.
click [here] for the screenshot
for a Delphi5 compatible version, click [here]
TMELabel
(ver.3.0)
Like a TLabel component with a MEFont property that sets the font on CMMouseEnter
Windows message.
Usefull with AboutBox type forms, when you want to link your TLabel with internet.
Nb: may be same component /behaviour as TJvLinkLabel from JVCL
GETVALUE
function for QuickReport
Enable to refer to other TQRPrintable controls (TQRExpr or TQRLabel) to get
their value.
Usefull when you don't want to repeat TQRExpr expression every time you want
to use it in your calculations.
To use it:
Parse
& Replace utility (ver.2)
You simply want to parse your html file that contains some custom tags, and
replace these tags by the required strings.
When used with TPageProducer, advantage of this method comparing with using the TPageProducer's OnHTMLTag
event handler:
Many programs are arleady built. Among them:
Executive dash-board:
severall 'dash-board' based products are available, depending on your power
/autonomy requirements:
| Synoptic of all dash-board's capabilities |
Type of dash-board
|
||||
| application fully-integrated | selectable | visual customizable | fully customizable | ||
| user's report latitude | print /preview | ![]() |
![]() |
![]() |
![]() |
| select report | no | ![]() |
![]() |
![]() |
|
| design report | no | no | ![]() |
![]() |
|
| script on report | no | no | no | ![]() |
|
In anyway and as a preliminary, these dash-boards must be connected to any either specific or open database, the one of your entreprise.
Scrivitt :
a program that enables to build standardised letters, simply in adding custom
paragraphs.
Document-Explorer:
Store your documents in a folder, and organize them as you wish with my TDBTreeView
component.
Archieve-Explorer:
Store your favourite magazines in the programm, and search them with the fields
and key-words of your choice.
BdCC: a front-office
configurator to your ERP, and add comprehensiveness and security to your business.
BCRx: a web application
that enable order entry and query +e-mail communication between customer and
company.
Data Dictionnary:
a simple data-dictionnary management software. Store your data in the required
XML format, and view /filter them in your browser with the required presentation.
Implemented with Delphi +XML +XSLT.
Reminder: don't
forget what you and your co-workers have planned !!
1. setup an open and unique database with the events you (or your co-workers)
want to be reminded for
2. receive at the right time an e-mail reminding you the event.
NB: for more infos, please contact me
Vanishing
/unstiking component property value issue ![]()
Have not you ever been in the situation where, from the IDE, you set a property
value for one of the component used, then test your program, be happy with it,
save it, then re-open it ... and noticing that the value that you set for your
component's property has changed ?
Here can be the reason:
1. if you set from your IDE the same propertie's value as the default one, then
Delphi will not save the value in the .dfm at the time you will save your project.
2. the problem raises when you re-open your project : as no propertie's value
is specified in the .dfm, the propertie's value that will appear in your object
inspector is the one set in your component's constructor (if one set), or the
default for the propertie's type.
When you build your own components and you want to set default for properties,
be carefull to be consistent with the value given in the constructor.
Whether you use your own components or third party components, one good way
to notice this trap, is to closely look at how properties are displayed in the
object inspector. If the values are displayed in normal weight font, it means
your propertie's value fits with its default. If the values are displayed in
bold font, it means your propertie's value differs from the default, or that
no default have been set.
Thus, when you first drop your component on your form, have precisely a look
at a property displayed in bold, and that becomes in normal weight when changing
manually its value.
LiveBinding
TObject
Delphi is an IDE that enables OOP (Object Oriented Programming) and designs
the user interface. Hence why not presenting the evidence : "editing TObject
instances on a form".
Object (TObject's instance) can be of a simple TObject class, or of a more complex
type like a TObjectList<T>. The UI controls that will handle the display
do not need being data-aware controls.
LiveBindings makes this possible, using TBaseObjectBindSource descendant.
Downloadable demo project group (below) shows :
- simple object (TObject) binded to control - FireMonkey project -,
- object list (TObjectList<T>) binded to control,
- two object lists (TObjectList<T>) linked in a master /detail relation,
both binded to a TStringGrid.
Want some more details ? download [the demo project group].
import
/export with XML
The question is quite frequently asked all around and is sometimes answered
with complex structures /process .. and the question is : "how to import
XML data in my RDB (relational database), then edit them (CRUD -create, update,
delete-) using standard UI controls, then export them back to a potentially
other XML format ?".
Of course the question can be only any part of the above, ie "how to (only)
import from XML" or "how to (only) export to XML".
The answer is quite simple if you use standard VCL components /structure, that
are:
For accessing data: TSQLConnection, TSQLDataSet, TDataSetProvider, TClientDataSet.
For transforming data: TXMLTransformClient or TXMLTransform.
For displaying data: either data-aware controls (TDBxxx), or standard VCL UI
+ LiveBindings controls.
Want some more details ? download [this].
NB: this demo requires SQLite dbExpress driver provided with XE3 Professional
(or higher)
deFocusControl
data event in LiveBindings
Posting a record with a null value for a required field fires a 'database error'
exception. Before this exception is being fired, a procedure TField.FocusControl;
is executed. The intention behind that is to set focus on the UI control linked
with this TField, highlighting it for further correction (ie or cancel the edit,
or post a non null value)
LiveBindings does not support the deFocusControl data event (ie procedure FocusControl(Field:
TFieldRef); is absent in Data.Bind.DBScope TDataLink desendants), probably because
TBindLinkDataLink is control-agnostic.
To overcome this, traditional DB-aware architecture comes to rescue : simply
create a TFieldDataLink that will hold the link between LiveBinded DataSource
and the UI control, like
with TFieldDataLink.Create do begin Control := aEdit; FieldName := 'aField'; DataSource := BindSourceDB1.DataSource; end;
Want more details through a live example, download [this].
Monitoring
SQLite® database
With RAD Studio XE3®, Embarcadero added native SQLite database driver within
their dbExpress framework. XE3
feature matrix says : "New in XE3! TSQLMonitor support for SQLite".
This requires some tweaks (via the Object Inspector) in the current TSQLConnection
: under SQLiteConnection.Driver property, add a DBXTrace Delegate Driver.
Want more details through a live example, download [this]
Generic classes:
through another example of composition, typecasting avoiding
Each time there's a novelty in the language, I'm wondering how this is going
to be useful in my current /coming projects.
With Generics (or parametrized types), one obvious with it is that it flattens
class hierarchies: instead of 2 levels and multiples classes, you can get the
same done with only one *generic* class.
But another clean-code plus is that you can avoid typecasting.
How ? .. look at the example [here]
Anonymous Method use
case
Delphi 2009 came with some novelties among them 'Anonymous Method' (AM). Reading
litterature about it made me think "nice .. but what for specific use may
I need it ?" or in other words "what stuff cannot be made without
it (AM) easily or nicely ?".
After searching and searching again, I found a situation where AM makes a more
concise /readable code : when you want that a procedure variable be declared
in the local context (not in the application scope).
For more details, download the demo [here]
Sometimes you need make
communicate 2 applications on the same PC *without the hassle of a middleware
layer*.
It's very easy : on the Sender application, send the message with [Winapi.Windows.SendMessage]
procedure; on the Receiver application, create a procedure that will capture
the message; the link between both application procedures will be the message
Id (integer).
Download a simple demo [here]
How about using records
instead of objects
since Delphi7, records are more alike objects (read this).
But the advantage of using records instead of objects is that you don't need
to create them. And , of course, if you don't have to create them, you won't
need to free them.
For frequently used entities, this leads to increasing run-time performance,
with gaining in readability.
Let's look at an example:
1. declaring a record:
TFieldListRecord = record
private
FItems: array of TFieldRec;
function GetCount: integer; inline;
public
procedure Load(const aJvCsvTableName: TFileName; const KeyFields: string; KeyValues: Variant);
function IndexOf(const s: string): integer;
property Count: integer read GetCount;
procedure SetItem(const FieldName: string; const FieldValue: Variant);
function GetItem(const FieldName: string): Variant;
function TransformToXML(const RootTag: string): string;
end;
2. using this record:
var
FL: TFieldListRecord;
begin
FL.Load(aFile, 'id', 10); //no need a Constructor
Edit1.Text := FL.GetItem('name');
end;
How to add
fields to a TDataSet at run-time
with TStringField.Create(aDataSet) do // create a TStringField, but can be any other field. begin FieldName := 'aFieldName'; FieldKind := fkLookup; DataSet := aDataSet; Name := DataSet.Name + FieldName; KeyFields := 'aKeyFields'; LookupDataSet := 'aLookupDataSet'; LookupKeyFields := 'aLookupKeyField'; LookupResultField := 'aLookupResultField';
aDataSet.FieldDefs.Add(FieldName, TStringField, 25, False); end;
WebSnap
simple project
Have you ever heard of WebSnap technology being deprecated by CodeGear
/Embarcadero®?
I hope they won't do that, because WebSnap is a really nice technology
to work with if you have any web development to do with Delphi.
Here is a simple project /tutorial that shows some things that are neither hard
to understand nor to implement, and that you simply cannot do with WebBroker
framework.
[here] the source code of the project.
How to get selected
a text drawn on a TCustomControl descendant, depending on mouse click:
[here] the source code of the example and
the component.
How to buid an intranet search engine using MS index server and ADO DB
connection
How to check memory leaks on a CGI web application (use Delphi5 professional)
NB: with higher versions of Delphi, use FastMem memory checker and the IDE web app debugger
|
| |
|
|
[cliquez ici] (262 Ko) |
|
|
[cliquez ici] (23 Ko) |
|
|
[cliquez ici] (638 Ko) |
|
| |
|
|
[cliquez ici] (171 Ko) |
|
|
[cliquez ici] (3 Ko) |
|
|
||
| my favourite .. | ||
|
web site in french |
||
|
learn from experts |
||
|
videos |
![]() |
|
|
|
||
|
general |
||
|
general |
||
|
library |
||
|
reporting |
||
|
charting |
||
|
|
||
|
newsgroup search engine |
||
|
newsgroup search engine |
||
|
newsgroup search engine |
||
|
newsgroup via http |
||
|
newsgroup via news protocol |
||
|
|
||
| Embarcadero Resource Center | resources | |
|
community |
||
|
library |
||
|
report bug |
||
| RAD Studio documentation | documentation | |
| Online Help for Delphi XE4 | documentation |