Delphi has a little built-in tool that handles internationalization. But it´s really basic.
You also got a couple of commercial localization tools that support Delphi applications: Multilizer (http://www2.multilizer.com/) and Sisulizer (http://www.sisulizer.com/), and an open-source tool based on GetText: http://dxgettext.po.dk/
You can rename the computer using windows API calls (I can't remember them offhand, but I'll see if I can dig them up somewhere). I stand to be corrected on this, but as far as I know you cannot change the serial numbers of motherboards and/or hard disk drives.
"You cannot code for stupidity"
There is no problem at all. I only asked what people think about memory usage and performance.
I made a test with
- a DataModule with a TQuery and
- a simple class that creates the TQuery on the fly
both containing the same method.
Strangley, the method ran a few milliseconds faster in the class without visual components. The DataModule with visual components worked a few milliseconds slower, though (in theory) the components involved should have been the same. That means, the way you create instances - by drag&drop or create/free - actually does matter.
when I place a TQuery component, on a form, it consumes memory until the application quits.
The amount of memory that your query will consume is directly related to the amount of data which you are retrieving from the database, and as such cannot be helped. What you could do is look at how many fields are being returned and reducing that amount to only those fields that you need.
Corinna John wrote:
When I create/free the TQuery everytime I actually need it, the construction/destruction consumes time.
I've found that creating/destroying the components dynamically isn't time consuming. What will take time is establishing the connection to the database and the subsequent retrieval of the data from the query.
Since I hardly every use data-aware controls, most of the time I dynamically load the data to the screen(s) by creating a data controller which will provide the functionality for retrieving/updating the data from the database. Ideally this controller will have some database connection object within it, and a query/command object to query the database with. These data objects should be created and destroyed in the controller's constructor/destructor respectively. Then, by using events, you can perform some kind of action on the resulting query which you executed.
So a controller would look something like this (I see you are using the TQuery component, and although I am using ADO, the theory is still basically the same):
// my uber-super user defined event :P
TOnRetrieveData = procedure (ASender : TObject; AResultData : TADOQuery) of object;
TDataController = class(object)
FOnRetrieveData : TOnRetrieveData;
FDBConnection : TADOConnection;
FADOCommand : TADOCommand;
constructor Create(AOnRetrieveDataEvent : TOnRetrieveData);
procedure ExecuteSQL(const ASQLString : string);
constructor TDataController.Create(AOnRetrieveDataEvent : TOnRetrieveData);
// Assign the event...
FOnRetrieveData := AOnRetrieveDataEvent;
// Initialise the connection and command components
FDBConnection := TADOConnection.Create(nil);
FADOCommand := TADOCommand(nil);
FADOCommand.CommandType := cmdText;
FADOCommand.Connection := FDBConnection;
// setup the connection
FDBConnection.ConnectionString := 'this should now be your connection string';
// ensure that you are not prompted for the server login prompt...
FDBConnection.LoginPrompt := False;
// now we can open the connection...
procedure TDataController.ExecuteSQL(const ASQLString : string);
LQuery : TADOQuery;
LQuery := TADOQuery.Create(nil);
FADOCommand.CommandText := ASQLString;
LQuery.RecordSet := FADOCommand.Execute;
if Assigned(FOnRetrieveData) then
while (LQuery.RecordSet <> nil) do
// This is just a bonus because you could get more than one result data set from the query...
LQuery.RecordSet := LQuery..NextRecordset;
So to use the controller you would do something like this:
// other uses stuff
TMyForm = class(TForm)
Button1 : TButton;
Memo1 : TMemo;
Memo2 : TMemo;
FController : TDataController;
procedure Perform_OnRetrieveData(ASender : TObject; AResultData : TADOQuery);
procedure MyButtonClick(ASender : TObject);
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure TMyForm.Perform_OnRetrieveData(ASender : TObject; AResultData : TADOQuery);
LRows : Integer;
LIdx : Integer;
LLine : string;
LLine := '';
Memo2.Lines.Add('Start a data result output...');
while not(AResultData.EoF) do
for LIdx := 0 to AResultData.FieldCount-1 do
LLine := LLine+' '+AResultData.Fields[LIdx].Value;
Memo2.Lines.Add(' End a data result output...');
procedure TMyForm.MyButtonClick(ASender : TObject);
on E:Exception do
Memo2.Lines.Add('Exception occurred when trying to execute sql script. Reason:');
FController := TDataController.Create(Perform_OnRetrieveData);
Button1.OnClick := MyButtonClick;
DISCLAIMER: I have not tested this code, so if it contributes to global warming for some reason, I relinquish myself from any consequences it may have on the tragic collapse of the lifecycle of the common sea cucumber...
Hope that helps
"You cannot code for stupidity"
i'm having a problem with aggregate fields on a filtered dataset. before apply a filter, my aggregate fields look fine. as soon as a filter is applied to the dataset, the aggregate fields return me null.
this is an example of how i'm creating an aggregate field.
fld = new TAggregateField(ClientDataSet);
fld->Active = true;
fld->Expression = "SUM(Amount)";
fld->ResultType = ftFloat;
fld->FieldName = "TotalAmount";
fld->DisplayFormat = "0.00";
fld->Alignment = taRightJustify;
fld->Index = DataSet->FieldCount;
fld->DataSet = DataSet;
fyi - yes I have set the filtered property, the filter works fine on the dataset. only the aggregate field does not get updated. and i dont want to re-open the dataset, i've already got the set of records i want to work with, i just need the aggregate field to re-calculate.
Hi, I'm a C++ programmer that is looking into learning Delphi. I've been googling around trying to find the differences. More specifically, I've been wondering, can Delphi create, or do some unique feature, that C++ can't. So far all the sights I've been to, have not boasted such a claim, or I'm just going to all the wrong sights. I know Delphi compiles fast, creates fast applications with hardly any work, but I'm wondering more about the ability to create apps a C++ project would never dream of. Like for example, in VB, you can't create DLLs, But in C++ you can. Or in C++ you can multi-thread...
A link to a site would be just fine.
I've been wondering, can Delphi create, or do some unique feature, that C++ can't.
No such thing. Delphi is a layer on top of assembly, just as C++.
Member 4641878 wrote:
I know Delphi compiles fast, creates fast applications with hardly any work, but I'm wondering more about the ability to create apps a C++ project would never dream of.
Go for C# - you can create WPF-applications that a low-level programmer can only dream of. I surely wouldn't be able to recreate all that functionality in Delphi.
Member 4641878 wrote:
Like for example, in VB, you can't create DLLs, But in C++ you can. Or in C++ you can multi-thread...
VB is a very closed environment, but you can use the WinAPI. You can even use VB.NET to add real threading to a VB6-application. I'm using Delphi 6 only for small command-line applications for those clients who don't have/want the .NET framework.
Now, therein' lies the last advantage that Delphi has; it can create native executables that don't need a runtime. Anyway, that's something that C++ can do too
I can't help you with Delphi, but generally there's a difference between interpreters (like VB) and compiled languages (like C++), in that an interpreter can have macro's: a string that contains sourcecode that can be executed. Example (in pseudocode):
z=execute(string) // z contains 11
This works in an interpreter because the 'compiler' is avalable in runtime. In a compiled language the names of x and y are lost (because the compiler changed them to pointers) so you can't make something that mimics that. Although you pay heavilly for macro's (performance) it can be handy in some specific situations. Think about a list of items where the user can input a filter expression.
All pure compiled languages have the same 'power' because they are all derived from the same model. There are a few languages that mix the interpreter and the compiler concept. You could search if Delphi is capable of handling programs like the one above.
Build your test application. Then go back to your DLL project. Go to the Run menu. Select the Parameters menu item. In the Host Application area, put the path to your test application .exe.
NOTE: I'm telling you this from D5. I don't have D6 installed, but I think it was the same process.
Another issue you may run into (D5 suffers from this is), the breakpoints will disappear. This is a well known bug in D5 and debugging DLLs. Should this happen, make your test application test your DLL by using buttons. This way here, it won't automatically run through the DLL code. Before hitting a button (or some other control), go to the IDE. Go to the View->Debug Windows->Modules (or Ctrl+Alt+M). Right click your DLL in the list. Select Reload Symbol Table. This enter that path of your DLL. You should see your breakpoints re-appear.
Hi,i have rtf formatted data stored in a file, the data is english letter and unicode character mixed format, i want to display the mixed data in a richviewEdit control. the problem is if the data is only unicode character or only the english character, it was displayed correctly,but it is not good for the mixed character, is there any way to fix it?by the way, i have to use the richview control,please help!