Pascal

Pascal is an influential imperative and procedural programming language, largely (but not exclusively) intended to teach students structured programming and data structuring. Pasca was implemented on a wide range of architectures, from early PCs to mainframes. Pascal derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal). Pascal is a purely procedural language and includes control statements with reserved words, but has many data structuring facilities and other abstractions like type definitions, records, pointers, enumerations, and sets.

Share tech news, updates, or what's on your mind.

Sign up to Post

Search the database (Component TADOQuery), and list data VirtualStringTree, example:

/ / / Load / / /

Procedure load;
Begin
With TADOQuery.create (self) do
begin
Close;
   Sql.Clear;
   SQL.Add ('Select POS_TAG, POS_FOGO, POS_POSICAO');
   SQL.Add ('from CAD_POSICAO');
   SQL.Add ('where POS_FOGO IS NOT NULL');
   SQL.Add ('and POS_FROTA =' + QUOTEDSTR (edfrota.Text));
Open;
TADOQuery.first;
While not  TADOQuery.Eof do
Begin

Field 0:= DateToStr (now);
Field 1:= TADOQuery.FieldByName = ('Name'). AsString;
Field 2:= TADOQuery.FieldByName = ('SecondName'). AsString;
Field 3:= TADOQuery.FieldByName = ('SecondName'). AsString;
Field 4: =''; / / / Edit the cell VirtualStringTree
Field 5: =''; / / / Edit the cell VirtualStringTree
Field 6: =''; / / / Edit the cell VirtualStringTree

TADOQuery.next;
end;
end;

/ / / Save / / /

Procedure save;
Begin
/ / / Save row fields (0,1,2,3,4,5,6) VirtualStringTree
/ / / In MSSQL database

end;

I need help ... please ...
0
I am working with inno setup and I need to write a string value to HKCU\Software\Microsoft\Office\12.0\Excel\Options.  

This is to force the check in the excel addins.  The problem is that the keys are sequential i.e.
OPEN
OPEN1
OPEN2


Can someone assist me in finding the last OPEN and then assigning it to he registry line.
If that is not possible, should I use the code to write it to the registry and skip useing the registry block?

Also, this is the first time I have used pascal.  My coding experience is in other languages.

Here is the Inno script so far
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "DA Toolbox"
#define MyAppVersion "DA ToolBox 1.0"
#define MyAppPublisher "KKB"
#define MyAppURL "http://www.kkbcpa.com/"
#define MyAppExeName "MyProg.exe"
#define MyOfficeApplication "Excel"
#define MyAppRegistryRoot "HKCU"
#define MyAppFileName "Excel Toolbox 2013.xlam"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{D9E617D4-08B6-41FC-ABD3-F83CBA722736}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no

Open in new window

0
Hi,

i create a test program, new form1. (SLAVE)

I add a label1 called hello

///////

I create another program form1. (MAIN)

i add dialog control to open a file.
i add a text field.
buton salled save
button called read

/////

I want to load the (MAIN) program.
find the (SLAVE) via the openfile dialog
click READ button
then in the text file the words "hello" should appear in the text field in main.exe imported from SLAVE.
Change anything in the text feild to save it into SLAVE and click save.


I want this as simple as possible as i want to learn from this please guys, thanks alot.


// Quick run down

MAIN.exe >>> open file dialog >>> find slave.exe >>> read button >>> read label1 inside slave's entry point >>> type test into text field >>> save  >> i then load SLAVE.exe and label1 is now changed to test.
0
Hi,

i need to put on every form same JvCaptionButton?
with same properties and events.

How can I put that on every form.
But, general that every form loads JvCaptionButton or something...


Thx, hrvica5
0
Hi,

i have form on which i have 20 Tedit
i changed name of tedit and some of them are finishing with '_n' (for numbers)

for example money_n, salary_n....

I need some function which will recognize when cursor enters
in Tedit which ends with _n
and exit from TEdit

why?
because i want when cursor enters in money_n
that changes money_n.text='1000,00'
and when exits from money_n that change money.text='1.000,00'

and when enters in salary_n that changes only salary_n  

Thank you, hrvica5
0
Hi All:
I would like to round up some number to three decimal places

59.0625 ===> 59.063
I've try formatcurr, Format('%.3n', [59.0625]), Format('%.3f', [59.0625]) but the result is incorrect
0
I have a custom MAPI mailclient and try to open my default mailprogam from that.
This does still work fine on other computers with same OS (Windows XP- W7 -W8) but not in my own computer? (HP i7 quad core 12 GB RAM, Win7, Delphi 7).
I think this issue is related to my computer settings...
Any ide to solve this?
0
I have delphi application running on windows xp in a tray icon, but i need listen when user press reserved keys, example (Ctrl+Ctrl+end+#81), but when my application not is in focus this keys are pressed and not call my methods. How can i program to listen keys pressed on windows?

thanks for advance,
Felipe
0
We have been developing with Delphi 3/5/7/2010 in the last 15 years. We will end most of the projects this year (only bug fixes will be implemented).

We want to start new projects (mainly utilities for text/graphic processing, but other projects will come over time) from scratch, so a new development system is needed. Since many coders have moved away from Delphi in the last years I hope to get some feedback about what new development system to choose.

We have been developing all these years using Delphi for these reasons:

- The object pascal language is very easy to read. we have had also side-projects using c++ and c#, and when one developer had to take a project from someone else it was a blast with object pascal, but there was always a large timeframe until a developer could fully understand a c++/c# project written by someone else (and some of them were good c++ coders).
- Delphi has a blazingly fast compilation time. Most of our projects compile almost instantly.
- In the high time of Delphi popularity you had access to many thousands of third-party components, most of them for free.
- the fantastic Project Indy Internet components allowed us to add internet connectivity to our apps within hours instead of days/weeks

Since Delphi is/was in steady decline over the last years, we are completely open to anything else (even Java).

Here are some wishes/requirements:

- it should work on both Windows and Mac OS X with minimal code changes (required in …
0
I have a TClientDataSet, called cdsDiction, which is loaded as binary from a file called Diction.cds. This loads OK.

I have another TClientDataSet, called cdsDictionTemp which is intended to be a blank copy of Diction.cds. I am trying to load this as a copy of Diction.

To do this, I have a procedure:

procedure TfDB.SetUpcdsCopy(cdsOrigin, cdsDest: TClientDataSet);
var
  i: integer;
begin
  cdsDest.Free;
  cdsDest := TClientDataSet.Create(self);
  for I := 0 to cdsOrigin.Fields.Count - 1 do
  begin
    cdsDest.FieldDefs.AddFieldDef;
    cdsDest.FieldDefs.Items[i] := cdsOrigin.FieldDefs.Items[i];
  end;
  cdsDest.CreateDataSet;
  cdsDest.Open;
end;

Open in new window


This is called as follows:
  SetUpcdsCopy(cdsDiction, cdsDictionTemp);

Open in new window


The procedure works OK, and does all the steps, but cdsDictionTemp stays nil.

What have I done wrongly?
0
I want make a touchkeyboard, use a TTouchKeyboard class..

Form1 have Several Edit box1.. 10, and button1 that Shows a Form2(Numkeypad Form).

1. click button1 then shows a Form2 (I made a keypad form)

2. click form1's editBox1 . (focused editbox1)

3. click form2's Num keypads.

4. then Editbox have key Value..

I don't want use TTouchKeyboard component, I want to make a my Keypad form.
use inherit TTouchKeyboard.


I'm Delphi2010 User.

sorry I'm not good at English.. m.m;
0
My Delphi/ Firebird application connects to two databases:

- local and
- remote

Both connections are realized by TZConnection components.

Local works in an instant.
Remote takes quite a long time to connect and makes my application in-responsive.

Question:

How can I connect remote TZConnection in a separate thread?

Thank you

panJames
0
I have a CDS file called PAYGHeadings.cds, which is referenced in a CB.rc file as PAYGHeadings RCDATA system\PAYGHeadings.cds.

The form has an embedded ClientDataSet of cdsPAYGHeadings.

The .RES file seems to be OK, and with the link in the .dpr as {$R 'CB.res' 'CB.rc'}.

So far so good.

Here is the relevant code:
function TfDB.ActivatePAYGHeadings: boolean;
var
  ResStream: TResourceStream;
begin
  try
    ResStream := TResourceStream.Create(hInstance, 'PAYGHeadings', RT_RCDATA);
    cdsPAYGHeadings.LoadFromStream(Resstream);
    cdsPAYGHeadings.IndexDefs.Clear;
    with cdsPAYGHeadings.IndexDefs.AddIndexDef do
    begin
      Name := 'MainIdx';
      Fields := 'EffectiveDate, Scale';
      Options := [ixUnique];
    end;
    cdsPAYGHeadings.IndexName := 'MainIdx';
    result := true;
  except
    screen.cursor := crDefault;
    fDiagnosis.eTable.text := 'PAYGHeadings';
    fDiagnosis.showModal;
    result := false;
    exit;
  end;
end;

Open in new window

The CDS has a primary index of EffectiveDate and Scale;

Yet the code fails on assigning the IndexName.

I suspect I am missing a line or two of code, but I can't fathom the logic of how to set up the appropriate pointers.
0
Hello,

I am trying to run several different programs that require them to be run as an elevated process.  This eventually will be run as part of a service run under the local system account.  I am manually testing the Delphi code with a button that attempts to run the process as an elevated user and I keep getting a UAC prompt.  Is ther any way around this?
0
I can't see how you can add a data band to a report. Is there a button for this?
0
Cam someone guide me on how to set the text in a TStringGrid cell to be center aligned instead of the default left aligned using Delphi XE3? The typical OnDrawCell routines do not work when the DrawingStyle is set to gdsThemed, but they do work with this property set to gdsClassic or gdsGradient.  With this DrawingStyle setting and DefaultDrawing property set to True, you get the text in both locations, left and center aligned because the default drawing routines for the themed style have already run before your custom OnDrawCell event is executed. If you turn the DefaultDrawing property to Falsae, you lose all of the themed cell drawing which defeats the use of gdsThemed as your style.
0
Hi experts

In a previous question I asked about a error with the BDE and was advised to get rid of it
What is the easiest way to convert from Delphi - interbase BDE to another connection
I have in excess of 500 programs to convert, any examples or conversion tools would be appreciated

I use TTable(s), TStoredProc, TDatabase(s), TQuery

tDBLookupComboBox, TDBGrid etc

Table1.findkey, table1.findnearest, table1.last, table1.post etc

Thanks
0
I've a TMemoryStream with the content of an Windows Icon.

this code works fine:
var Icon: TIcon;

...

Icon := TIcon.Create;
Icon.LoadFromStream(IconStream);

Open in new window

However I cannot add this Icon instance to an ImageList, as the Icon is provided in two sizes (large and small Icon). Using ImageList.AddIcon() results in an Out of System Resources Exception.

I need a solution other than ExtractIconEx() to get the small icon from either the TMemoryStream or from the TIcon. I cannot use ExtractIconEx(), as it does not work with Streams, but only with files. Saving the stream to an file is not an option for performance reasons.
0
i am using Delphi 7, MySQL, DBX...
the following code every time generates a new conneection on the server, why? how can close the connection, or append the existing? When i am inserting or updating lot of records, get the error "too many connections".
I can see on the process list a lot of slepping processes :I


procedure Tf_workbench.ExecuteSQLQuery(p_SQL : String);
begin

 datamodule1.SQLQuery2.CommandText := p_sql;
 datamodule1.SQLQuery2.ExecSQL();
 datamodule1.SQLQuery2.Close;

end;

regards
Tamas
0
I've a TMemoryStream that contains an image in the Windows Bitmap Format.

I need to convert the content of the stream to a TIcon object.

So the chain should be:

MemoryStream -> a bmp class that loads the image from the stream -> convertion to a TIcon (not HICON).

It should work with Delphi 5, as this is for an old project, that cannot be upgraded.

I've tried fiddling around with TPicture, but got access violations when
trying to do a Picture.Graphics.LoadFromStream().
0
Hi all

I want to search all files and directory recursively in a folder. example 'C:\WINDOWS\'. I use many routine and procedure. Many of them are good for this job. Here is one example:

procedure TForm1.FileSearch(const dirName: string);
var
  searchResult: TSearchRec;
begin
  if FindFirst(dirName + '\*', faAnyFile, searchResult) = 0 then begin
    try
      repeat
        if (searchResult.Attr and faDirectory) = 0 then begin
          if SameText(ExtractFileExt(searchResult.Name), '.gif') then begin
            lbSearchResult.Items.Append(IncludeTrailingBackSlash(dirName) + searchResult.Name);
          end;
        end else if (searchResult.Name <> '.') and (searchResult.Name <> '..') then begin
          FileSearch(IncludeTrailingBackSlash(dirName) + searchResult.Name);
        end;
      until FindNext(searchResult) <> 0
    finally
      FindClose(searchResult);
    end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  FileSearch('C:\WINDOWS');
end;

Open in new window


But the problem is, when there is a folder with unicode character like 'ÆÇC¿¿examplefolderÆÇC¿¿©' inside 'C:\Windows' the result is not showed up. Only folder name like ????examplefolder???? with no files inside.

I use delphi 7 with Windows XP. Help me please, and dont tell me to use other version of Delphi. Thank you all
0
Dear Experts,
I need to be able from within my program to click the Show Desktop button on the taskbar.  Application.Minimize will not cut it.  I need to hide ALL windows at once with one click.  I am using Delphi and I am assuming there is an undocumented windows API that will allow me to do this easily.
0
I recently added the ability for our program to connect to the bing tile server and use the bing map as an overlay for our map. My work was primarily on writing the section of code that constructs the URL and uses the INDY Idhttp component to communicate with web (it basically acts as a browser so we can display the tiles on a form rather than a webpage). Recently several clients have stated that they are unable to to access the tile server. We quickly realized it was environment specific. Two clients resolved this by adding exceptions to there Firewall settings. The remaining client uses a Proxy server, which we never planned for. Is anyone familiar with setting up the Idhttp component to use a proxy server? What are the parameters and or settings that must be used? Any help pointing me in the right direction would be greatly appreciated. I am fairly new to the concept of Proxy servers. Thanks in advance.
0
Someone could indicate some kind Valgrind software to analyze memory leak in softwares delphi
0
I have this function in c# and a similar one in java, and  I am trying to implement in Delphi, but can't figure how to do it

basically, instead of writing a bunch of code to build a query, assign it to a query component, clearing and setting the parameters, I want to build a parameterized query, add parameters, and call a function that does the clean up, open, error checking, etc.

the parameters will be different data types.

I did this in c# and java, so there's gotta be a way to do it in Delphi - pretty much the only thing I'm stuck on is the object list.  I haven't used it before and can't seem to find a sample of how to do this, as all the samples seem to use a single object type...

is there a way to do this?
calling logic:

      List<object> parms = new List<object>();
...
            parms.Add(dOrder["CUSTUID"]);//string
            parms.Add(result);//date
            parms.Add(aUID);//long integer
            dbRoutines.execQuery("Update CustDocs Set CustUID = @p1, DateEdited = @p2 where RecordUID = @p3", parms);

Open in new window

the function -

   public static Boolean execQuery([SqlFacet(MaxSize=-1)]String mySQL, List<object> parms)
   {
      Boolean result = true;
	  using (SqlConnection sqlConn =
		 new SqlConnection("Context Connection=True"))
		 {
          SqlCommand sqlCmd = new SqlCommand("SET NOCOUNT ON; " + mySQL, sqlConn);
			sqlCmd.CommandType = CommandType.Text;
			sqlConn.Open();
         for (int x = 0; x <= parms.Count - 1; x++)
 

Open in new window

0

Pascal

Pascal is an influential imperative and procedural programming language, largely (but not exclusively) intended to teach students structured programming and data structuring. Pasca was implemented on a wide range of architectures, from early PCs to mainframes. Pascal derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal). Pascal is a purely procedural language and includes control statements with reserved words, but has many data structuring facilities and other abstractions like type definitions, records, pointers, enumerations, and sets.

Top Experts In
Pascal
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!