[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

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 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
My Delphi programs are showing as HEUR/AGEN virus infected by Avira AntiVirus. That too files that I have uploaded on the web about a year ago.
0
Where has Delphi Formus gone ?

https://forums.embarcadero.com/
0
Hi Experts,
In one of my screen i am getting Edatabase error exception when clicking on more than one records in a grid. The problem is as below.
I have a grid ( Dev express tcxgrid). Tableview data controller - Data source is linked with TDatasource. Dataset of Tdatasource is set to a Toraquery ( from dev art).

In grid i am displaying the fields from a temporary table. So in the screen i have a search button, on click of the search button i am executing a stored proc which actually loads the search result into a temporary table. something like below:

with datmodule1 do
begin
  with storedproc1 do
  begin
    try
        try
           execproc;
        except
            // some code not related to the issue
        end;
   finally
    unprepare;
  end;
end;

with toraquery1
begin
  close;
  sql.text := 'select * from tmptable1';   //records are inserted in this temp table in side the stored proc which gets executed above.
  open;
end;

Records are loaded in the screen. There is a checkbox type column in the grid which by default loaded as ticked. As i am inserting that field as 1 in the temp table which i have written inside the stored proc.

Then there is a button which deselect all the ticks, code for that is an update statement as below:

with Datamodule1 do
  begin
    with qryMisc do
    begin
      close;
      sql.text := 'Update tmptable1 set checked = 0';
      execsql;
    end;
    toraquery1.close;
    toraquery1.open;…
0
I have a working system that uses SQL Express as the database.
On 2 computers, window 8.1, everything is okay.
I have just installed another computer with Windows 10 and the program brings an error when assigning MyQuery.FieldByName('MyDateField').AsDateTime to a DateTime variable.
It only happens on this computer.

I have installed the program on my development computer that is also Windows 10 and using SQL Express and have no problems.

The ShortDateFormat is the same on all computers.

1. The command ShowMessage(ShortDateFormat) displays the same on all computers 'd/MM/yyyy'
2. FieldByName('MyDateField').AsString on the working computers displays the date in the ShortDateFormat, like '31/12/1999'
3. FieldByName('MyDateField').AsString on the new computer displays the date as '1999-12-31'
4. FloatToStr(FieldByName('MyDateField').AsDateTime) on the new computer raises error "'1999-12-31' is not a valie date time."

All the settings are the same

I have never seen anything like that and I need your help here.

Using Delphi 7 and SDAC
0
Hello,

I need to use a SOAP interface of the Dogana in Italy.
I develop some code in delphi (berlin) using SOAPHTTPClient, but i become always this error:

"Impossibile passare dalla codifica corrente a quella specificata.
Line: 1
<?xml version="1.0" encoding="utf-8"?><s."

I try
HTTPRIO.Converter.Options:=HTTPRIO.Converter.Options+[soUTF8InHeader];
HTTPRIO.Converter.Options:=HTTPRIO.Converter.Options+[soUTF8EncodeXML];
HTTPRIO.HTTPWebNode.UseUTF8InHeader:=true;
HTTPRIO.Converter.Encoding := 'UTF-8';

Thank you for the help.

Andreas
0
I got a signed executable, when running on my local machine everything works fine but with one of our clients there is an issue when they try to run it from a network drive.
They get a "Open File - Security Warning" (see the image). When they run it from a local disk, there are no issues as well
network-drive-error.PNG
0
please help me to translate this memory loader to delphi

#include "stdafx.h"
#include <Windows.h>

DWORD GetSectionProtection(DWORD sc)
{
    DWORD dwResult=0;
    if (sc & IMAGE_SCN_MEM_NOT_CACHED)
        dwResult |= PAGE_NOCACHE;

    if (sc & IMAGE_SCN_MEM_EXECUTE)
    {
        if (sc & IMAGE_SCN_MEM_READ)
        {
            if (sc & IMAGE_SCN_MEM_WRITE)
                dwResult |= PAGE_EXECUTE_READWRITE;
            else
                dwResult |= PAGE_EXECUTE_READ;
        }
        else 
        {
            if (sc & IMAGE_SCN_MEM_WRITE)
                dwResult |= PAGE_EXECUTE_WRITECOPY;
            else
                dwResult |= PAGE_EXECUTE;
        }
    }
    else
    {
        if (sc & IMAGE_SCN_MEM_READ)
        {
            if (sc & IMAGE_SCN_MEM_WRITE)
                dwResult|=PAGE_READWRITE;
            else
                dwResult|=PAGE_READONLY;
        }
        else 
        {
            if (sc & IMAGE_SCN_MEM_WRITE)
                dwResult|=PAGE_WRITECOPY;
            else
                dwResult|=PAGE_NOACCESS;
        }
    }

    return dwResult;
}


inline BOOL IsImportByOrdinal(DWORD ImportDescriptor)
{
    return (ImportDescriptor & IMAGE_ORDINAL_FLAG32)!=0;
}

#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif

//typedef BOOL (WINAPI *pointMAIN)(int , char*);

typedef BOOL (WINAPI *pointWINMAIN)(HINSTANCE, HINSTANCE, LPSTR, int);


HMODULE MemLoadExe(PBYTE data)
{
    IMAGE_FILE_HEADER        *pFileHeader        = NULL;
 

Open in new window

0
I have a horrible problem with Delphi XE7.
The Hard Disk on my Desktop PC crashed and I had to reinstall Delphi XE7.
Although my Laptop and Desktop have identical structures for all the components and .pas files, I can't compile my Apps on the Desktop in the IDE.
The Laptop compiles like clockwork, but on my Desktop I get continuous "Out of Memory" exceptions, and then the IDE aborts.
I have tried to use IdeFixpack, and that made it even worse. I also tried Madshi's MadCollection with the same result.
I have spent 3 Days on this, without success. Has anybody an idea, what the problem could be?
0
I wanna make the mobile game called '2248' on PC and I'm almost done, im just having a problem with the Accept parameter of the Dragover event. The problem is that I want the program to allow the dragging only the panel which's caption is identical, or if I have already dragged a few panels before then also allow the drag if  the sum of the panels caption dragged before equals to the one im trying to drag to. And also, I dont want the panels to be able to dragged into panels that are not their 'close-neighbours', so only allowing to drag to the panels next to it.
Here is a picture of how It actually looks like, if u dont know the game:https://m.crazygames.com/game/2248
procedure TForm1.balklikk(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=MBleft then begin
TPanel(sender).BeginDrag(True);
kiindulo:=strtoint(TPanel(sender).caption);
oszeg:=strtoint(TPanel(sender).caption);
end;
end;

procedure TForm1.over(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept :=(Source is Tpanel) and ((Tpanel(sender).caption=Tpanel(source).caption) or (oszeg=strtoint(Tpanel(Sender).caption)));
Tpanel(source).Tag:=1;
if (Source is Tpanel)
  and (Sender is Tpanel)
    and (Source <> Sender)
      and (Tpanel(Sender).Tag=0)
        and(Accept=true)
          and (State = dsDragEnter) then begin
z:=z+1; T2[z]:=Tpanel(Sender); Tpanel(Sender).Tag:=1; oszeg:=oszeg+strtoint(Tpanel(Sender).caption);
end;
end;

Open in new window

on the 'balklikk' event of the panel it just checks if it was a left click, if yes then the dragging begins. Also i have declared here a variable that later on in the over event counts the sum of the previously dragged panels captions. If the initial caption is= with the one we dragged to(source.caption=sender.caption) then it will go to a for cicle in which i store the dragged panels and also i increase the sum(oszeg) with the (sender), so next time something gets dragged, it also gets analyized whether the sum is = or not.
0
Hey,
I want to serialize an object to xml with delphi 7,  i searched but i didn't find a full solution, i think with HttpRio we can do it .
thank you in advance.
0
Hi. I'm working in Delphi xE7.  I recently changed computers.  I installed the same delphi on the new pc and when I tried to run a certain part of my project where I use a Timage on a form I got an exception EInvalidGraphic with message "Unknown picture file extension (.png)."  Mind you this program was working on the previous pc.  Is there something that I'm missing perhaps when I installed on the new pc?  Any ideas or suggestions of what I could look for would be greatly appreciated.  Thanks in advance.
0
Hi !
Are it possible to rotate a video using Dspack ?
Have downloded JongovEdgeDetectFilter but I can´t get it to work !
Ilkka
0
Hello,i wish that you are fine
My problem is that i want to send a text file from my computer to another one using Delphi 7 how can i do this please
thanks.
0
I am using Delphi con connect to mysql, using myDac componentes (paid version).

I have a table called items(upc,description,retail,picture).
picture is a Blob Field storing .bmp or .jpg images.

How can I show a .jpg image from a BLOB field using the DBCtrlGrid and DBImage component on Delphi XE7.

There is no way for me to have .jpg in the Blob and be able to show it on the DBImage over the DBCtrlGrid, as if .bmp is the only image supported, only .bmp works ok.

I used the DBCTRLGRID to arrange the way visual components should display information, but it seems only to support display for .gmp images, I already put in use the .jpeg library but no luck.
DBCtrol_grid_noJPG_SUPPORT.png
0
My Delphi application for Windows is packed in appx so I can have it published in Microsoft Store. At the first run, the app creates a folder in <user>AppData\Roaming to store there some files accessible for the users. Here's the code:

MyFolder:=GetSpecialFolderPath(CSIDL_APPDATA)+'\MyApp';
CreateDir(MyFolder);
TDirectory.SetAttributes(MyFolder,[TFileAttribute.faNormal]);

Open in new window


It works fine. When the app is running, the users can open its dialog windows, see this folder with all the files, read them or write into them. But only from the app! The mystery is that this new folder cannot be seen in Windows Explorer. Even in Command Prompt it seems non-existent!

Can anybody explain what this means?
0
Hi Guys,

The idFtp has an important event that gets the results, I don't know how to set / use the event when I create the idFtp in runtime. I need to
an example for it.  Below you can see my code and use it to give me an example.

Thanks a lot

  Function RunFTP( FtpServidor ,  FtpUsuario, FtpSenha, FtpPorta,  FtpAutentica, FtpCaminhoUpload, FtpCaminhoResposta: String): Boolean;

  Result := True

  if EstaVazio(FtpServidor) or EstaVazio( FtpUsuario ) or EstaVazio( FtpSenha ) or  EstaVazio( FtpAutentica ) or
     EstaVazio( FtpPorta )  {or EstaVazio( SmtpCaminhoUpload ) or EstaVazio( SmpCaminhoResposta )} then Begin
     ShowMessage('As configurações de FTP não estão completas no parceiro: ' + CodCad);
     Result := False;
     Exit;
  End;


  if FtpAutentica = '1' then
     FtpAut  := true
  else
     FtpAut  := false;


  IdFTP1 := TIdFTP.Create();
  IdFTP1.Disconnect;

  IdFTP1.Host     := FtpServidor;
  idFTP1.DirectoryListing.DirectoryName:= FtpCaminhoUpload;
  IdFTP1.Port     := Strtoint(FtpPorta);
  IdFTP1.Username := FtpUsuario;
  IdFTP1.Password := FtpSenha;
  IdFTP1.Passive  := FtpAut;

  try
     IdFTP1.Connect;
  except
     IdFTP1.Disconnect;
     IdFTP1.Connect;
     Result := False;
     Exit;
  end;

  BarraRotina('UP',Carquivo+iif(Tipo = 'Upload',' Envio ',' Recebimento ')+' de Arquivo '+Carquivo,0,0);

  Try
    Try
      if Tipo = 'Upload' then begin
         IdFTP1.Put (cArquivo, FtpCaminhoUpload+Carquivo, true);
      end else if Tipo = 

Open in new window

0
I want to programmatically have a form made visible in its normal size on the screen, when currently it is minimized (so just appears as an icon in the windows bar
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.