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

Hi

I looking for a TEdit with gradient color.  How to change a TCustomEdit for this?

thanks
0
I am a total novice regarding Delphi. I am trying to build a package for eventual use in a C++ builder project (in which language I am not a novice).
I am using code that I have found for using Smart cards.
the following code fragment generates an error and I need assistance to understand why and correct it.
I am using Embarcadero RAD Studio 10.2 enterprise edition

var
  r : string;
  a : integer;
begin
  a := 1;
  while a <= Length(Input) do
    begin
    case Input[a] of
      #010       : if WantFormats then r := r + #10 else r := r + ' ';
      #013       : if WantFormats then r := r + #13 else r := r + ' ';
      #027       : if a < Length(Input) then
                     begin
                     Inc(a);
                     r := r + Extended[Ord(Input[a])+1];
                     end else r := r + ' ';
      #128..#255 : ; {<<<<<<<<< This line gerates the error }
      else r := r + Ascii[Ord(Input[a])+1];
      end;
    Inc(a);
    end;
Result := r;
end;


gives the following error message
[dcc32 Error] GsmHelper.pas(551): E2011 Low bound exceeds high bound

Open in new window

0
Hi,

I'm trying to create subfolder in the TaskScheduler (using Delphi) and create schedules for my application inside the subfolder.
For TaskScheduler-access I use this EE-example.

To create a subfolder I found method TaskFolder.CreateFolder('\MyFolder', ?sddl?);.
Here sddl (=security descriptor associated with the folder) must be set, but I have no idea how to set it correctly.

So as a workaround I tried to create the folder "MyFolder" directly into folder "C:\Windows\System32\tasks\".
The folder is actually created by my application, but the folder is not visible inside Windows TaskScheduler.

procedure TForm1.Button1Click(Sender: TObject);
var ts : TTaskScheduler;
    tf: ITaskFolder;
begin
  CoInitialize(nil);                    // uses ActiveX
  ts := TTaskScheduler.Create(Self);
  try
    ts.AutoConnect := True;
    ts.Connect1(GetNetComputerName);
    if ts.Connected then
    begin

      // ts.GetFolder('\MyFolder', ?sddl? );   << THIS DOESN'T WORK
      // As a workaround I create the folder myself.
      // System32 is changed into SysNative, as otherwise the folder would be created in SysWOW64.
      ForceDirectories('C:\Windows\SysNative\tasks\MyFolder\');

      if DirectoryExists('C:\Windows\SysNative\tasks\MyFolder\') then
        tf := ts.GetFolder('\MyFolder')   // << THIS GIVES AN UNKNOWN ERROR
      else
        tf := ts.GetFolder('\');

Open in new window

How can I create a subfolder for taskscheduler in order to add my application's schedules inside that subfolder?
0
Hello,

I have an Android app written in Delphi Seattle.

I need to show a form modally in a function then get back the value of an Edit object.

However, this doesn't work:

Function GetMyValue: String;
Begin
  Form1:=TForm1.Create(Nil);
.....

     ShowModal(
         procedure(ModalResult: TModalResult)
         begin

           if ModalResult = mrOK then
             Begin
              Result  := MyEdit.Text;
             End;
             
         end);

I get a compiler message: [dcc32 Error]  E2555 Cannot capture symbol 'Result'
I know that in anonymous method I cannot refer to the main functions result, but I need to get back the text when the user closes the form.

How can I do that?
Thank you very much!
0
Hello guys I need help for transcript a routine in PHP for Delphi.

In PHP I have this routine

$i 			= 0;
$geral 	= 0;
while($resposta = mysql_fetch_array($sql)){

		$Qtd[]			        =	$resposta['QTD_ATUAL'];
		$ID_PRODUTO[]	=	$resposta['Id'];
		$CODIGO[]		        =	$resposta['CODIGO'];
		$LOTE[]			        =	$resposta['LOTE'];
		$VALIDADE[]		=	$resposta['VALIDADE'];
		
		$geral		                =	array_sum($Qtd);

$i++;
}

Open in new window


How do that  in Delphi?
0
I have created a mail program that use web browser as the body.

I must add a unsubscribe for the email body.

The code3 worked fine when I was using Delphi XE 8 . Now I am using Delphi XE 10.2.

My Code..
I have called TwebBrowser "htmlEditor"

Procedure TFrame15.Button1Click(Sender: TObject);
Var
  htmlDoc: IHTMLDocument2;
  HtmlSelObj: IHTMLSelectionObject;
  HtmlTxtRng: IHTMLTxtRange;
  S: WideString;
begin
  htmlDoc := htmlEditor.Document as IHTMLDocument2;
  htmlDoc.execCommand('InsertImage', false, '');
  HtmlSelObj := htmlDoc.selection;
  c:=('<a href=''mailto:'' + b + '?subject Unsubscribe>Unsubscribe</a>'''');
   if HtmlSelObj.type_ = 'Control' then
    HtmlSelObj.Clear;
    HtmlTxtRng := HtmlSelObj.createRange as IHTMLTxtRange;
    HtmlTxtRng.pasteHTML(S);
   htmlEditor.SetFocus();  
end;

Open in new window

0
How I Close and restart the current application I am using Delphi 10.2 Tokyo
0
I have a website that runs xenforo forum software. I basically have a donations user group and those users have the ability to download some software. I want to add a login form to my application that checks if that user is in that group and if he / she is then it will open the main form. I want to know how I can make such a login form?
0
Hello guys

I have a maskedit where I inform ddd hh:mm:ss and I want to inc my date, I tried this code and it works fine for days but not
for hours :(

For example:  001  02:35:40 add to my date 07/11/2017 13:00:00

procedure TFDatasPrevisao.MaskEdit1Exit(Sender: TObject);
var
  dias, horas, minutos, segundos : String;
  Dt   : TDateTime;
begin
  Dt       := MaskEdit1.DateTime;
  Dias     := Copy(MaskEdit3.text, 1,3);
  Horas    := Copy(MaskEdit3.text, 5, 2);
  Minutos  := Copy(MaskEdit3.text, 8, 2);
  segundos := Copy(MaskEdit3.text, 11, 2);

  if StrToInt( dias ) > 0 then
  Begin
    dt := IncDay(dt, StrToInt( dias ))
  End;

  if StrToInt( horas ) > 0 then begin
     dt := IncHour(dt, StrToInt( horas ))
  end;

  if StrToInt( minutos ) > 0 then begin
     dt := IncMinute(dt, StrToInt( minutos ));
  end;

  MaskEdit2.Date :=  dt;

end;

Open in new window


Whats is wrong? any clue for a better way?

thanks
Alexandre
0
Hello.
You can close all database tables except some?
  (what I need)
And then reopen them?
I use absolute database that is similar to BDE
If so, how to do so many thanks.
Simo
0
Hi
Please help me to insert picture into access,  with delpi 7 ,
data type Is "Attachment'
GoodDay
structure.jpg
0
How Can I Read Cyrillic text from Old DBF file. Get the code page on the text.Encoding to Unicode then
write into DBF file with the same code page as the original ?

Thanks in advance.
0
Hello Guys

I have two variable in this format:  dd/mm/yyyy hh:mm:ss

StartDate = '01/11/2017 13:00:00'  
EndDate  = '02/11/2017  13:30:00'

How to get the difference between these two dates in days and hours

ddd  hh:mm:ss
001   01:30:00

Thanks
Alex
0
Hello guys,

I want to invest some time to study a new language for developing application for mobile (cell phone).

Nowaday I work with Delphi and I know that some last version of it, it is possible to build application for mobile,

but I am not sure if it worths it.

What should be the better language to start it? Java, Delphi, Visual Studio?

I'd like an opinion from you.

Thanks a lot
Alexandre
0
Hello,

I use Delphi Seattle.
If I use VCL forms application I often use Copy / Paste to duplicate objects.
E.g. I put a grid on the form, set a lot of properties then I paste it on another form to save time.

However, I cannot do this with Multi Device form. When I press Ctrl+C on any object I get Access violation at address... message.

Is there a way to fix this? Thank you.
0
type
  TNodeFunction = function(AInput: String): String;

implementation

function Func1(AInput: String): String;
begin
   result := AInput;
end;

Open in new window

Then I can do this:
var
  SomeFunc,: TNodeFunction;
begin
     SomeFunc = Func1;
    ....
So far it is good.

But my problem is that a certain place I need to detect in my program that I gave value to SomeFunc or not.

I tried this :
If SomeFunc<> nil Then <- but I get this error [dcc32 Error]  E2008 Incompatible types

Thank you very much for your help!
0
When trying to install the Graphics32 packages on Delphi XE 10.1 Berlin, it says that rtl220.bpl is missing.
The rtl found in the Delphi bin directory is indeed rtl240
How can I fix this ?
Thanks
0
Hi

Delphi 10.1 Berlin
I have written an app to monitor a folder (new files, delete files) and it does not work in some cases.
- locally it works
- if i start the application on PC1, monitor a folder on the server, add a file in that folder on PC1 it works
- if I add a file to that folder but on the server (not PC1) it does not work (but on some networks this also works!). If I have open the file explorer on PC1 I can see the added file some ms later - but my app doesn't show it.
My code
procedure TForm31.FormCreate(Sender: TObject);
var
    isf : IShellFolder;
    Eaten, attr : DWord;
    pidl : pItemIDList;
begin
  snh := TShellNotifyHandler.Create(self);
  snh.OnShellNotify := ShellNotifyHandler1;
  snh.ShellMsg := WM_User+100;
  snh.Events := [seDelete, seRenameItem, seCreate];
  snh.Recursive := true;
  SHGetDesktopFolder(isf);
  isf.ParseDisplayName(self.Handle, nil, PWideChar(ExtractFilePath(ParamStr(0))), Eaten, pidl, attr);
  label1.Caption := ExtractFilePath(ParamStr(0));
  snhHandle := snh.RegisterPIDL(self.Handle,pidl);
end;

procedure TForm31.ShellNotifyHandler1(Sender: TObject; LEvent: TShellEvent;
  pidl1, pidl2: PItemIDList);
var
    SRec: TSearchRec;
    Res : integer;
begin
  ListBox1.Clear;
  Res := FindFirst(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'*.*', faAnyFile, SRec);
  while Res = 0 do
  begin
    if (SRec.Name <> '.') and (SRec.Name <> '..') then
      ListBox1.Items.Add(SRec.Name);
    Res := FindNext(SRec);
  end;
  

Open in new window

0
TBannerAd can't load via LoadAd in Delphi 10.2 Tokyo - Firemonkey Android.

Uses Permissions - OK

Access network state

Internet

AdMob Service = True for Project/Options/Entitlement List - OK

AdUnitID - OK

procedure TForm1.FormCreate(Sender: TObject);
begin
BannerAd1.AdUnitID:='ca-app-pub-3940256099942544/6300978111';
// AdMob Banner Sample ad unit ID
// Also I tried for my real AdUnitID
end;

Open in new window


My sample code for to try - OK

procedure TForm1.Button1Click(Sender: TObject);
begin
BannerAd1.LoadAd; 
end;

Open in new window


I used AdMob for my old project in different Delphi version.

There didn't any problem for this.

But, my application is freezing for a time and TBannerAd can't load via LoadAd for this project.

Log monitor is giving this error for this problem.

The Google Play services resources were not found.

Check your project configuration to ensure that the resources are included.
0
to be more specific slow connection client got disconnected from the server when write memorystream with this code in on execute event
 if OutboundCmds <> nil then
    begin
      for I := 0 to OutboundCmds.Count - 1 do
      begin
 
        AContext.Connection.IOHandler.Writeln(OutboundCmds.Strings[I],
          IndyTextEncoding_UTF8);
 
 
        MS := TMemoryStream(OutboundCmds.Objects[I]);
        if MS <> nil then
        begin
          AContext.Connection.IOHandler.LargeStream := true;
          AContext.Connection.IOHandler.Write(MS, 0, true);
        end;
      end;
 
    end;
 
  finally
    if OutboundCmds <> nil then
    begin
      for I := 0 to OutboundCmds.Count - 1 do
      begin
        OutboundCmds.Objects[I].Free;
      end;
    end;
    OutboundCmds.Free;
  end;

Open in new window


specially here
 MS := TMemoryStream(OutboundCmds.Objects[I]);
        if MS <> nil then
        begin
          AContext.Connection.IOHandler.LargeStream := true;
          AContext.Connection.IOHandler.Write(MS, 0, true);
        end;
      end;

Open in new window


clients with good connection speed don't have any problems . what could be the problem with slow internet ?

if i remove the memory stream write they dont get disconnected and remains connected
0
I need to update a datum but change to each record in mastersource.
datamod.TTGiacenzaMangimeQtascarico.Value is a value that must be incremented.
Currently, if the record change (the ones shown on the left in the photos), the value of datamod.TTGiacenzaMangimeQtascarico.Value changes with
scaricototale: + = scaricototale datamod.PollaioTScaricoMangime.Value , and you should upgrade and increase.

It should increase at each record change. You have to upgrade.
How to do ?
Thank you

Image 1 procedureImage 2 procedure
procedure Tdett_form.calcolaGiacenza;
var
scaricoTotale,scaricogen:extended;
begin
 try
  DataMod.PollaioT.DisableControls;
   scaricototale:=0;
  datamod.PollaioT.Filter:='Nome='''+Nomeedit.Text+'*''';
  datamod.PollaioT.Filtered:=true;
  DataMod.PollaioT.First;
    while not DataMod.PollaioT.Eof do
    begin
      scaricototale:= scaricototale+datamod.PollaioTScaricoMangime.Value;
      DataMod.PollaioT.Next;
    end;
     If datamod.PollaioT.Locate('Articolo',datamod.TTGiacenzaMangimeArticolo.Value,[locaseinsensitive]) then
     begin
     datamod.TTGiacenzaMangime.Edit;
     datamod.TTGiacenzaMangimeQtascarico.Value:=scaricototale;
     datamod.TTGiacenzaMangime.Post;
     end;

finally
  DataMod.PollaioT.enableControls;
  datamod.PollaioT.Filtered:=false;
end;
     end;

Open in new window

0
My application loads ms access database table from my desktop. I wish be able to transfer this table to my domain(I have what I need to access this domain).
Please help me to do the following:
1. copy my table (Ms Access) to my site.
2. have the ability to edit this table and save it again.
3. have  the location address of  this table so I can load with my app.
4. Inside My app, I have no difficulty to use this table (Iam using FireDac of Delphi 10 seatle)
5.other options than using my site to publish my database are welcome
thank you in advance
0
Hi
I havean ACCES DB with Delphi. I open the Db from a  menuline open DB. The I have a menuline to close de DB. So I can use different DB for each year.
When I run my software from delphi (execute) it run properly but when i close the Database and without to return to Delphi, if I trie to open it again, I have nothing in my Different db grid. So it seems that it is not open but I haven't any error mesage just blank dbgrid an d DBtext component.
Any idee? Beacause if I close le DataBase and reopen it again it schould work.
Regards
Claude
0
Below is a snippet from a REST server application that I have written in Embarcadero C++ builder XE10.1 Berlin

void TWebModule1::Action1Get(TWebRequest *Request,TWebResponse *Response)
{
  Code here generates some JSON response based on the Request.....

// send the response
Response->ContentType 	= u"application/json";
Response->Content       = ... some JSON text

}

Open in new window


I wish to modify the REST server so as to return some html text in another Action handler but I need to know the value to assign to the Response->ContentType instead of "application/json"
Also what other values are valid Response->ContentTypes ?
0
Hello,

I tried this : http://blog.marcocantu.com/blog/xe5_anonymous_showmodal_android.html

and my problem is that using this code:

var
  dlg: TForm1;
begin
  dlg := TForm1.Create(nil);
  // select current value, if avaialble in the list
  dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(Edit1.Text);
  dlg.ShowModal(
    procedure(ModalResult: TModalResult)
    begin
      if ModalResult = mrOK then
      // if OK was pressed and an item is selected, pick it
        if dlg.ListBox1.ItemIndex >= 0 then
          edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
      dlg.DisposeOf;
    end);

Open in new window


The  dlg.DisposeOf; gives Access Violation error.
I tried it with Free, but that gives the same error message.

How can I free the form then? Thank you.
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.