Delphi

59K

Solutions

17K

Contributors

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

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

Sign up to Post

I am trying to debug a custom component by using delphi to do it.

using : Delphi Tokyo 10.2.2, Windows 7.



this is my component source:

unit pvDBLookupCombo;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, System.UITypes,
  RTLConsts,
  cxControls, cxContainer,
  cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, strUtils, variants
  , Data.DB;

type

  TProVDBLookupEditProperties = class(TcxLookupComboBoxProperties)
  private
       fSearchSQL : tStringList;
  public
    constructor Create(AOwner: TPersistent); override;
  published
     property ClearKey default 27;
     property GridMode default true;
     property ImmediatePost default True;
     property ValidationOptions default [evoRaiseException, evoShowErrorIcon];
    property SQL : tStringList read fSearchSQL write fSearchSQL;
  end;

  TProVDBLookupComboBox = class(TcxDBLookupComboBox)
  private
    { Private declarations }
//     FSearchKind: TSearchKind;
     fIsRequired : boolean;
     fSearchDataSource : tDataSource;

  protected
    { Protected declarations }
//    procedure DoOnNewLookupDisplayText(const AText: string);override;
  public
    { Public declarations }
      constructor Create(AOwner: TComponent); override;
      class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
  published
    { Published declarations }
    //property searchKind : tSearchKind read fSearchKind write fSearchKind;
    

Open in new window

0
Hello, (I'm using delphi 7 and paradox 9) , i'm coping data from table paradox to text file and i m using Timer (interval=30 minute) ,this table is updated every 30 minutes by another user which causes sometimes a blockage to the table paradox and if i close the application the blockage will be removed any solutions please .
0
Hi,

I want to add optional two-factor authentication during login into my Delphi win32 application.
Using: Delphi 10.1 Berlin Enterprise
User logs in using normal username and password. On his mobile phone he receives an authorisationcode which he needs to enter in the application.

What would be the easiest way to set this up?
A very basic example would be appreciated.
0
I have used TDBGrid and its related components which helps to populate data in Dbgrid. I have selected multiple (Three) row data record form Dbgrid and trying to populate these selected record on Quick report with separate pages along with respectively title.  I tried to achieve this functionality but unable to do same as my requirement. Please give me any suggestion or   solution to achieving all DBgrid selected data to populate with separate pages along with title on Quick report.

for additional information is, I am using Delphi 7 and  Quick report.

Please let me know in case of any query.

Regards
Manoj Yadav
0
Hello Guys,

How can I load a XML file ( the contents) into a field in my MSSQL table?

I only want the texts that inside the file and not the binary file

My field in my table is a text field.

thanks
Alex
0
Hello Community,

I'm absolutely new on programming and I want to learn Delphi as my main and solid first choice.
Searching on Google I did not find any interesting resource about how can I start programming on Delphi (or not just with updated content). I want to know about learning sites, learning video courses, ebooks and all of them completely easy to follow and readable.

Please, I hope that someone can help me with my request.
Also, Are there any free version of Delphi to start programming with?. And the result of the created apps with this IDE can be used for business?.

Regards,
0
Unsure what to ask :), but Record data being passed from script to plugin is incorrect

When the label1.caption is supposed to show MyInt instead is shows "71850800" no matter what

Script:
uses sysutils, classes;

type
  TMainSet = Record
    MyInt : Integer;
  end;
  PMainSet = ^TMainSet;

var
  MainSet : PMainSet;

function StrToBool(s:string):boolean;
begin
  if s = 'True' then result:= true else result:= false;
end;

function PluginProc(Code: Cardinal; p1, p2, p3: WideString): WideString; stdcall;
begin
  case code of
    0: result:= script.path;
  end;  
end;

procedure StartPlugins;
begin
  Script.StartPlugin(script.path+'Project1.dll', @MainSet, false{ìîäàëüíî});
end;

procedure This();
var
  ii:integer;
begin
  New(MainSet);
  while delay(2000) do begin
    ii := Random(9999);
    print(ii);
    MainSet^.MyInt := ii;
  end;
end;

begin
  Script.MainProc(@StartPlugins);
  script.newthread(@This);
  Delay(-1);
end.

Open in new window


Plugin:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

const
  WM_PluginShow = WM_USER + 5402;

type
  Tplugin = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ShowPugin(var Msg: TMessage); message 

Open in new window

0
I am working for a company now for a couple of weeks. The build process is done mostly manually and takes several hours spread over several days. The languages in use are C#, COBOL, Delphi, Visual Basic 6, and of course the database with T-SQL. For the version control, we use Apache Subversion (SVN), except for COBOL code and the documentation, which is kept in Microsoft Visual SourceSafe (VSS). I have the idea to improve the process using a continuous delivery tool. Do you think that Jenkins would do the job?

Thank you for your reply.
0
in Implementing Web Application Proxy in Windows Server 2012 ,can i publish exes and little bit internal Software's like ( notepad,excel,adobe reader..our internal delphi related exes).
0
Hi Experts,
I have an issue in column sorting in a grid which is a dev express grid ( tcxgrid).

So in the column if i have records eg ABCDE, A ABCDE, AB ABCDE etc then it should sort as A ABCDE, AB ABCDE, ABCDE.

Is there any way to do this?
0
I created a TextEditor in C#, Now i want to load a file in the text editor through delphi so i used  shell execute function to achieve this but When i execute this it is opening the text editor without opening the file. My code is,
ShellExecute(0, 'open', PChar('C:\Users\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe'),PChar('C:\Users\Desktop\215_1.rtf') , nil, SW_SHOWNORMAL);
and also when i try to load a file in Notepad (by changing the path), it is opening the file but not in my text editor  
Whats wrong in it?
0
I wrote a web service in delphi (10.2.3), when I try to import the wsdl generated by the service with wsimport I get some errors like:

  [ERROR] undefined simple or complex type 'soapenc:Array' 

Open in new window


 How can I avoid these errors?

Attached the wsdl file of the service
 wszeus.wsdl.txt
0
Is there a clean way to determine whether a particular file is locked in Windows?
Before updating my program I want to be sure no files in the installation folder are in use. This to prevent the update from failing.

I tried the following code:

function IsFileInUse(FileName: TFileName): Boolean;
var
  HFileRes: HFILE;
begin
  Result := False;
  if not FileExists(FileName) then Exit;
  HFileRes := CreateFile(PChar(FileName),
                         GENERIC_READ or GENERIC_WRITE,
                         0,
                         nil,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         0);
  Result := (HFileRes = INVALID_HANDLE_VALUE);
  if not Result then
    CloseHandle(HFileRes);
end;

Open in new window


and this one:

    Result := False;
    try
      fHandle := FileOpen(inFile, fmExclusive);

      if fHandle = -1 then
        result := True
      else
        FileClose(fHandle);
    except
      Result := True;
    end;

Open in new window


and this one ...

     
      try
        if FileExists( inFile ) then
        begin
          try
            fs := TFileStream.Create( inFile, fmOpenReadWrite or fmShareExclusive );
            Result := False;
          finally
            fs.Free;
          end;
        end;
      except
        Result := True;
      end;

Open in new window



But all three have the same problem: By testing whether the file is locked, it is  (sometimes) locked by the test itself.
Is there a better way to check whether a file is locked, or will every solution result in the same problems?
0
I'm trying to read an xml response from a api but I keep getting the following error:


How can I read the xml data if the response looks like this:
<status>success</status><statusmsg>online</statusmsg><vmstat>online</vmstat><hostname>quantum.vps</hostname><ipaddress>xxx.xx.xx.xxx</ipaddress>

Open in new window


My current code:
procedure TfrmMain.btn1Click(Sender: TObject);
var
  httpclient: TIdHTTP;
  doc: TXMLDocument;
  data: IXMLNode;
begin
  httpclient := TIdHTTP.Create(nil);
  try
    doc := TXMLDocument.Create(nil);
    try
      doc.XML.Text := httpclient.Get('https://site.com/api.php?action=status'); //Modified URL for experts exchange
      doc.Active := True;
      data := doc.DocumentElement;
      lbl1.Text := data.ChildNodes['status'].Text;
    finally
      doc.Free;
    end;
  finally
    httpclient.Free;
  end;
end;

Open in new window

0
I want to execute a external application eg. anotherapp.exe or start.bat. After starting that application I want to check it's resource usage every x amount of seconds.
  1. Execute a app
  2. Retrieve it's resource usage every x amount of seconds

I mainly want to use this to execute x amount of .bat files so using the app caption to get the resource usage is not really an option.
0
In Delphi 10.2 Tokyo:

I created a package called TestFrameCompPkg that has a frame TTFrameComp as a component. The package build and install work as expected.

My problem occurs at design time with the ShowEdit and ShowLabel properties. When I place the component on the form, the property changes don't Hide and Show the ToolBar components in the IDE. But each does function normally at run time.

How do I get the show/hide properties to function at design time?


Code Example is below:

FrameComp.dfm
object TFramComp: TTFramComp
  Left = 0
  Top = 0
  Width = 800
  Height = 291
  TabOrder = 0
  object ToolBar1: TToolBar
    Left = 0
    Top = 0
    Width = 800
    Height = 29
    Caption = 'ToolBar1'
    TabOrder = 0
    ExplicitLeft = 192
    ExplicitTop = 48
    ExplicitWidth = 150
    object Edit1: TEdit
      Left = 0
      Top = 0
      Width = 121
      Height = 22
      TabOrder = 0
      Text = 'Edit1'
    end
    object Label1: TLabel
      Left = 121
      Top = 0
      Width = 31
      Height = 22
      Caption = 'Label1'
    end
  end
end

Open in new window


FrameComp.dfm
unit FrameComp;
interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
  Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
  Vcl.ComCtrls, Vcl.ToolWin;
type
  TTFramComp = class(TFrame)
    ToolBar1: TToolBar;
    Edit1: TEdit;
    Label1: TLabel;
  private
    function GetShowEdit: boolean;
    

Open in new window

0
In Delphi I'm looking for a way to clone a two forms (one that has an ancestor that inherits components and settings accordingly) into a new single form that has no ancestor requirement.

To try and describe this - let's say that I have two forms:

FORMANCESTOR contains 3 buttons on it sitting on a Panel. The captions on these buttons are set in FormAncestor, and Buttons are called BTN1, BTN2 and BTN3.

FORMCHILD is a descendant of FormAncestor so the panel with the 3 buttons inherits automatically and shows on FORMCHILD.  But FORMCHILD has BTN3's caption altered, and has a new 4th Button added to FORMCHILD.

What I would like to do is create a new form called FORMINDEPENDENT which has the 4 buttons and Panel, and inherits from TForm as opposed to TFormAncestor

I was just wondering if there is a standard way / correct method to merge / migrate / clone from decedents as per the above so that I have a new independent form that doesn't need to reference any ancestors and can just be a descendent directly from a TForm?

Thanks

Adam
0
I had this question after viewing TAdvStringGrid:  Cell's Background and Font color handling.

In a TAdvStringGrid, in grid.OnGetCellColor event-handler, I've set each cell of the fixed column to a different color:

ABrush.Color := GetMyCustomColor;

Open in new window


Now, when I click on a cell of this fixed column, in the grid.OnClickCell event-handler, I want to get the color of the clicked cell.

How can I do this?

I have tried:

grid.GetCellProperties(ACol, ARow).BrushColor)

Open in new window


But it does not work. I always get the same color: RGB(255, 255, 255).
0
I have quite normal parameter like:

Procedure Something(var test:integer);

In the form i have a global variabel (well global to that form) defied as:

  public
    { Public declarations }
   var gtest :integer;


Now i want to transfer the pointer from test to gtest.

gtest :=test; wont work. How should it be done?
0
I am creating an HTML message in Delphi with Indy and IdMessage.  I am attaching a company logo and it is referenced in the email to put the Logo in the correct place.  

All this works, except the attached logo shows up also as an Attachment.  Is there a way to do this and not have a visible attachment?
0
I wish to send a message to all client connected to my server application which uses an Indy 10 TCP Server component in Embarcadero C++ builder  XE 10.2 .

I have written the following function  which is meant to iterate through all the client connections to my server but it doesn't work.

I need some help in how to iterate through the list returned by the  IdTCPServer1->Contexts->LockList()  function.
I have seen an example in Delphi but my attempt in translating to C++ builder doesn't work.


void TForm1::BroadcastMessage(UnicodeString mess)
{
	TList *ls;
	int n;
	TIdContext *c;

	try
	{
		ls = IdTCPServer1->Contexts->LockList();
                n = ls->Count;
		for(int i=0;i<n;i++)
		{
			c = (TIdContext *)(ls->Items[i]); // <------ This line  is where the coding is wrong
			c->Connection->IOHandler->WriteLn(mess);
		}
		IdTCPServer1->Contexts->UnlockList();
	}
	catch(...)
	{
		IdTCPServer1->Contexts->UnlockList();
	}
}
//---------------------------------------------------------------------------

Open in new window

0
Hello.

I want to make a snake game using DELPHI. The basic, the snake eats the apple and it grows longer. I have the apple generating in random places. The only thing that I cant get is the delay. So i need the blocks to follow the first block in a train effect, but so far they are all stuck together and when I change direction they all move together instead of being in a 'train' effect.

Can anyone help me? I don't know if the explanation was detailed enough.
Many Thanks
54999858925__AB9E1587-E48B-4EC4-B511.MOV
0
I need some assistance in writing a TCP Server in Embarcadero C++ builder XE 10.1 using  an Indy 10 TCP server VCL control.
How do I accept a connection from a client when using an Indy 10 VCL control TIdTCPServer ?
I imagine that I need to write some code in the OnConnect Event handler although logically one might expect a "BeforeConnect"  event handler .I haven't found any methods anywhere in the AContext or its members called Accept() ?
Also, my understanding is that  when a connection is established, the Execute event is invoked which supplies an AContext parameter which equates to a thread. Can I let the Execute event handler terminate and have a separate thread that manipulates the saved value of the AContext parameter in a list. the separate thread would poll round each AContext in the list  to independently send/receive data to/from the remote clients ?
0
Hi, i have an application running in a debian server, developed in delphi 7 for 32 bits, with postgresql as database, port 5433.
To get an easy way for updating the app, all the clients (windows platform, 32, 64 bits, xp, 7, and 10), reference the executable in the server, but execute it in a local folder, where an ini file configures the link to the database.
In a lot of customers (not all with a debian server, instead, there are windows servers and ubuntu server), and in this customer, this scheme works fine.
In one PC, with Win10, i have this strange problem:
1) if i use a link, that reference the exe in the server and execute the app, it doesn't work. I get an error (internal to the app), as if i can't reach postgresql server.
2) if i copy the exe, and execute in any folder, executing in the same folder as 1), the app works fine.
It seems to be something of the firewall... i disabled it.
It seems to be something of the antivirus... i disabled it (AVG).
pgAdmin, conects to the server.
I simply can't see any other posible solution...
Can anybody help?
Thanks!
0
I need to use various fonts for various parts of text in TRichEdit, Delphi Tokyo. For part of the text I need 'Times New Roman' and for the other 'Symbol'. So far does not work what I tried. Either font is set the samo for the whole text or my selected character does not show up.
0

Delphi

59K

Solutions

17K

Contributors

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.