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

How to send push notifications to iOS from firebase Delphi step by step setup
0
Hi,

how can I determine font colour based on background color


Thank you
0
Hi

Delphi 10.1: I sometimes have the error 50 when I try to create a file:
var
    f : TextFile;
begin
  ReWrite(f,'\\myServer\anyPath\myFile.txt');  //Error 50 if the file exists
end;

Open in new window


I also tried to delete the file before if it exists. That is also impossible. Deleting in the explorer works and the I can ReWrite it. This error occurs in programs that never had problems. I think it has something to do with a Windows-Update. How can I solve this?

Thanks, Peter
0
We have a large Delphi (RAD Studio 10.1 Berlin) application accessing a MS/SQL database.
The access to the database is via ADO components.
Almost all requests to the database are done via stored procedures (more than 500 such procedures)
The application has around 150 "sub-programs" each with its own form etc...
Several questions :
1. Will I have to change all uses clauses where ADO units are specified ?
2. And change all components declaration ?
3. Appart from that, whatelse will I have to consider ?
4. An idea of the effort (in hours of work, without the test phase) ?
Thanks
0
i can see from the "developer.andorid" forums that you can parse a USSD response from Android 8 onward using something like:

ResponceCallBack := TJTelephonyManager_UssdResponseCallback.Wrap( (TelephonyManagerObj as ILocalObject).GetObjectID);

telephonymanager.sendUssdRequest(StringToJString("*#100#"), ResponceCallBack, handler);

However, I cannot figure out how to set the "ResponseCallback" for "onReceiveUssdResponse" and "onReceiveUssdResponseFailed" to my own procedures?
0
I want to hadlle a dialog box in order to automatically download a file from a web page (using delphi and Twebbrowser).
So I wrote a code like this ...

procedure WebBrowserDownloadComplete(Sender: TObject);
begin
       SimulateKeystroke(VK_LEFT, 0);
       SimulateKeystroke(VK_RETURN, 0);
end;

Open in new window


First line seems to work (focus moves from cancel button to save button) , but the second line doesn't (save button is not triggered).
Strangely, if i write...

procedure WebBrowserDownloadComplete(Sender: TObject);
begin
       SimulateKeystroke(VK_RETURN, 0);
end;

Open in new window


SimulateKeystroke(VK_RETURN, 0) seems to work, (dialog box is closed, so cancel button is triggered)

I tried some tricks like using SimulateKeystroke(VK_RETURN, 0) repetetively in a loop, or insert delay in the code, but without result.
How can I fix this?
0
Hello

I must use an old Isapi dll 32 bits wrtten with Delphi7
-> is it useful to adapt it in 64 bits mode
-> which tool can I use for doing this

Thanks in advance
0
Hi Experts,

My company is using MYOB products for retail purposes. We are using MYOB EXO Clarity for building a report. We are having 1 central database at Melbourne and branch offices in Sydney and Perth.

When Perth generates an invoice, It is printing a Melbourne time as it is using the Melbourne database. I wanted to use incHour or incMinute or incSecond delphi function to change the printing time (local time of Perth or Sydney, Brisbane). How can I add this function in clarity. Is there any other way to print local time.

System.varialble is not supporting as it keeps printing the local time of the system. For example, if invoice no 54 has generated on 1-Jan-2019 and If I want to print today, It will show today's date (7-Nov-2019) on the invoice which is not advisable when it comes to warranty thing.

I want to print local timezone time.

Thank you.Clarity-Available-Function.JPG
0
How to enable design tab as per attachment picture?
Currently my Delphi 2007 only shows code and history tab but the form is shown as separate window. I would the form to show in the design tab.
IDE tabs
0
Hi

I have a SQL Server table with a varbinary-field in it. I want to insert that record in a MySQL-Database. How can I access this field-data?
myTable is local on a SQL Server
mySqlTable1 is on a MySQL Server in the web

Query1.SQL.Text := 'SELECT myString1, myVarBinary1 FROM myTable';
Query1.Execute;
mySqlQuery1.SQL.Text := 'INSERT INTO mySqlTable1 (str1, blob1) VALUES('+QuotedStr(Query1.FieldByName('myString1').AsString)+','+??myVarBinary1??)'

Open in new window

How can I access the varbinary-field? Something like Query1.FieldByName('myVarBinary1').As???
Thanks for any help
Peter
0
I need to query an ASP.NET C # page using Delphi and the ICs overbyte TSslHttpCli component. I can get the login page with "GET" authenticate with "POST" but when making a query on an internal form using "POST" I am logged out with session expired.

I have a simple font doing the operations, who can help I send the fonts already working and showing where the error is.
0
I am using Delphi 7
I need to read/parse a cell in an Excel spreadsheet that displays #VALUE in Excel (ie. a formula with undefined input)

it crashes when I use
var
s80 : string ;
....
s80 := XLApp.Cells[row,col] ;

it clearly does not type caste properly.

So I tried to look at the variant type and act accordingly

var1 : variant ;
s80 : string ;
vt : TVarType ;
...
var1 := XLApp.Cells[row,col] ;
vt := VarType(var1) ;

if vt  = 9 then ... is ok ?
               else .... is a problem ?

vt always returns 9

See Variant Types
   http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Variants_VarType.html

so I am still unable to give cells with #VALUE a miss.

Suggestions please.
0
Hello,
  We have a PCL-1712 PCI Data aquicision device (DAQ). I want to get the data from analog input and pass the to analog output in almost realtime. The DaqNavi SDK contains and DAQ Emulator which you can use for programming/test. Since the SDK is buggy with Delphi it needs to be done in MFC/C++.

Anyone can program it ?

SDK Link: https://support.advantech.com/support/DownloadSRDetail_New.aspx?SR_ID=1-13L33UP&Doc_Source=Download

Thank you
0
Hello;
I have a program c++ which call a Delphi DLL; The Delphi DLL has to inform the program c++ by the result of his work several times during his lifecycle.

in yours opinions what are the possibles methods for doing this? without using files ou databases like a third part!

Thanks in advance.

I will list here what i think:

- First idea is by passing a pointer to delphi dll when launching it; but i don't know which types to use in the two sides and how Delphi treat pointers!

- Second idea is by using an intermediate c++ DLL; Delphi will call a function in the DLL C++ which will modify the values of the c++ dll variables. in the other side, when the c++ program launch the c++ dll, it will pass a pointer. When delphi call the c++ function, the function will fill the pointer passed by c++ program. Do you think that works?

I don't know if i was clear; Thank you
0
Hi !
I am using Delphi7 to develop program.
Firstly,TPrinter.GetPrinter function does not return value of port.The value of port is empty.

procedure TForm1.Button1Click(Sender: TOBject); 
var 
  hPrinter  : THandle; 
  pDevice : array[0..255] of Char; 
  pDriver  : array[0..255] of Char; 
  pPort     : array[0..255] of Char; 

begin 
  Printer.PrinterIndex := -1;
  Printer.GetPrinter(pDevice, pDriver, pPort, hPrinter);
  ShowMessage(pPort);       
end; 

Open in new window


 The following code return usb001 port with function Winspool.GetPrinter( hPrinter, 2, Nil, 0, @bytesNeeded ).
function GetCurrentPrinterHandle: THandle; 
var 
  Device, Driver, Port : array[0..255] of char; 
  hDeviceMode: THandle; 
begin 
  Printer.GetPrinter(Device, Driver, Port, hDeviceMode); 
  if not OpenPrinter(@Device, Result, nil) then 
    RaiseLastWin32Error; 
end;
 
function GetCurrentPrinterInformation: TPrinterInfo; 
var 
  hPrinter  : THandle; 
  pInfo:  PPrinterInfo2; 
  bytesNeeded: DWORD; 
begin 
  hprinter := GetCurrentPrinterHandle; 
  try 
    Winspool.GetPrinter( hPrinter, 2, Nil, 0, @bytesNeeded ); 
    pInfo := AllocMem( bytesNeeded ); 
    try 
      Winspool.GetPrinter( hPrinter, 2, pInfo, bytesNeeded, @bytesNeeded ); 
       Result.SeverName          := pInfo^.pServerName; 
       Result.PrinterName        := pInfo^.pPrinterName; 
       Result.ShareName          := pInfo^.pShareName; 
       Result.PortName           := pInfo^.pPortName; 
       Result.DriverName        

Open in new window

0
Hi Experts!

I have been using DataSnap REST for some weeks but I have problems understanding some concepts related to TJSONObject and how these data are sent.
I have three related questions.
I consider a simple class:


TMyclass = class
  private
    [JSONName('name')] // invio
    Fname: string;
    [JSONName('surname')] // invio
    Fsurname: string;
    [JSONName('mytext')] // invio
    Fmytext: string;

    procedure Setname(const Value: string);
    procedure Setsurname(const Value: string);
    procedure Setmytext(const Value: string);
  public
    property name: string read Fname write Setname;
    property surname: string read Fsurname write Setsurname;
    property mytext: string read Fmytext write Setmytext;
  end;
  
.....

procedure TMyclass.Setname(const Value: string);
begin
  Fname := Value;
end;

procedure TMyclass.Setsurname(const Value: string);
begin
  Fsurname := Value;
end;

procedure TMyclass.Setmytext(const Value: string);
begin
  Fmytext := Value;
end;  

Open in new window


.....

In my code I have something similar to:

Procedure TMain.Send_JSON;
var
   VJSONObject: TJSONObject;
   VMyclass:TMyclass;
begin
   VMyclass:=TMyclass.Create;

   VMyclass.name:='John';
   VMyclass.surname:='Ace';
   VMyclass.mytext:='';

   VJSONObject:=TJson.ObjectToJsonObject(VMyclass);
   //...
   
   RESTClient1.ResetToDefaults;
   RESTRequest1.ResetToDefaults;
   RESTResponse1.ResetToDefaults;
   RESTClient1.BaseURL:='http://111.222.333.444:8080/datasnap/rest/mypath';
   RESTRequest1.Timeout:=RESTRequest_Timeout;
   
   RESTRequest1.Resource:='/MyParam'; 
   RESTRequest1.Method:=TRESTRequestMethod.rmPOST; 
   RESTRequest1.AddBody(VJSONObject.ToJSON, ContentTypeFromString('application/json'));
   //...
   RESTRequest1.Execute;
   //...
end;

Open in new window



[First question]
When I send this JSON:
         {"name":"John","surname":"Ace","mytext":""}
i don't want to have:
"mytext":""
in the JSON.

[Second question]
I don't know a way to insert a JSON array like this:
{"name":"John","file": [{"name_file":"myfile1.txt","dir_file":"C:\mydir"},{"name_file":"myfile2.txt","dir_file":"C:\mydir2"},...]}

[Third question]
I am looking for a method to manipulate the:

VJSONObject.ToString

before insert in the:

RESTRequest1.AddBody(VJSONObject.ToJSON,...

but I couldn't find it. I search something like:

  VJSONObject := Json.StringToJsonObject(VJSONObject.ToString);

I have a lot of problems because there is no documentation on this part.
Does anyone have a solution?


Working with RAD Studio Tokyo 10.2.3
0
Hello,
I want to show a series in the chart. In the legend, the series should not be displayed.

I have the following plan. You can use the checkboxes to display one or more series in the legend.
If only one series has been selected, I add more series to shown in the chart,  but the new series should not be displayed in the legend.
The data for the series comes from a table.

Is that possible?
I did not find anything in the documentation:


http://www.teechart.net/docs/teechar...als/index.html
0
Hello,
in my form is a scrollbox.
Within the scrollbox I have a TImage.

1) The scrollbox should have only a scrollbar if the generated content does not fit on the image. Contents are drawings of rectangles.
2) The scrollbox should only be as high as the generated content, but should be at least X pixels high.
3) When I draw a rectangle out of the view, then the rectangle should be visible, when scrolling.

How can I implement this?
These questions are so important.

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ScrollBox1: TScrollBox;
    Image1: TImage;
    procedure FormActivate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
  left:=5;
  top:=10;
  form1.Width:=Screen.Width-15;
  form1.Height:=Screen.Height-50;
  ScrollBox1.Align:=alClient;
  image1.Left:=0;
  image1.Top:=0;
  image1.Width:=ScrollBox1.Width;
  image1.Height:=ScrollBox1.Height;
  image1.Canvas.Rectangle(1400,50,2000,100);
end;

end.

Open in new window


Unbenannt.PNG

Thank you
0
Hello,
I have to know something urgent.
Is there a simple and reliable way around to  scroll automatically on scrollbox2 when scrollbox1 is scrolled.
I mean, when I scroll on scrollbox1 30px to the right, then  scrollbox2 should scroll 30px to the right, too.
When I scroll on scrollbox2 30px to the right, then  scrollbox1 should scroll 30px to the right

Thank you
0

hi expert
I want to change the color of the top row of stringgrid.
I want to change the white color to gray.

ı want to increase the size of stringgrid line from left to right
thanks a lot.

I shared the features I want as pictures.

Ads-z.png
Adsiz2.png
0
Hello,
I would like to represent a DBChart depending on the values ​​in different colors.
I get the values ​​from the database.
The change of color I have managed.
How can I assign multiple values ​​to a series and graph them?


query1.open('select * from artikel');
  query1.First;
  while not query1.Eof do
  begin
    if query1.FieldByName('preis').Value < query1.FieldByName('minimum').Value then
      DBChart1.Series[1].Color:=clred;

    else
      DBChart1.Series[1].Color:=clblue; 

Open in new window

0
I am using an Indy 10 UDP client component with Embarcadero C++ builder EX 10.1 Berlin

I need to determine the IP address of the local PC that received the broadcast packet (not the peer IP). there are two network cards.
The UDP client is bound to 0.0.0.0 port 13580

How do I determine the IP address of the Ethernet port that generated the event ?

void __fastcall TForm1::IdSystatUDPServer1UDPRead(TIdUDPListenerThread *AThread, const TIdBytes AData,
          TIdSocketHandle *ABinding)
{
	UnicodeString u;


	u = ABinding->IP; // this is the binding which is 0.0.0.0
 	u = AThread->Binding->IP; // I was expecting this to give what I want but it returns .0.0.0.0

	if(u == u"10.41.0.20")  // only use specified local ethernet port
{
.....
}
else
{ // handle differently if another network adapter received the data

}

Open in new window

1
Hello,
I want to create 4 panels of the same size in a form. If you enlarge / reduce the form, then the panels should scale with.
The form always has 4 panels of the same size (even when resizing the form).
I already played with align left, right, bottom, top. However, the desired result did not come out.
The whole thing should look something like this:

1.PNG
Thank you very much.
0
Hello,
I have the following problem:

If I want to draw a rectangle on the paintbox in the lower right corner, then the rectangle will not be displayed completely after scrolling. What do I have to change to make the rectangle completely visible after scrolling down?

Here is a video of the problem (20s):
https://youtu.be/EETK1P1oG8g

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ScrollBox1: TScrollBox;
    PaintBox1: TPaintBox;
    procedure PaintBox1Paint(Sender: TObject);
    procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  protected
    procedure Paint; override;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Paint;
begin
  inherited;
    //paintbox1.Canvas.Rectangle(5,5,300,200);
end;

procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  paintbox1.Canvas.Rectangle(X,Y,X+200,Y+300);
end;

procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
  paint;
end;

end. 

Open in new window


Thank you
Unit1.dfm
Unit1.pas
0
I would like to see any examples of QuickReport 6.0 professional BarChart code for Embarcadero C++ Builder XE 10.1 berlin please ?
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.