Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Programming
Viewing all 173 articles
Browse latest View live

Sending mail without an eMail Client

$
0
0
This does not use an eMail Client to send mail, but sends mail directly

You will need to use indy projects components, get it here You can't view the links! Click here to register

This is the code that I use and works well for me.


Code:
      idsmtp: TIdSMTP;
      idmsgMailMessage: TIdMessage;

Code:
function SendMail(cMessage, cAttachment: string; cBody: TStrings; cTo, cFrom, cSMTP, cSMTPUser, cSMTPPassword: string): Boolean;
var cMailToStr, cMailTmp, cMail: string;
   nMails, xyz: Integer;
   lRemAtt: Boolean;
begin
   SendMail := True;
// For Display  'Busy .. Sending'

   if cSMTP.Text <> '' then begin
      try
         if not idmsgMailMessage.IsBodyEmpty then
            idmsgMailMessage.ClearBody;
         if idmsgMailMessage.MessageParts.AttachmentCount > 0 then
            idmsgMailMessage.MessageParts.Clear; 
      except

      end;

  //setup SMTP
      idSMTP.Host := cSMTP;
      idSMTP.Port := 25;
      idSMTP.Username := cSMTPUser;
      idSMTP.Password := cSMTPPassword;

      idmsgMailMessage.From.Address := cFrom;
      idmsgMailMessage.Recipients.EMailAddresses := cTo;

      idmsgMailMessage.Subject := cMessage;
      idmsgMailMessage.Body.AddStrings(cBody);
      lRemAtt := False;
      if cAttachment <> '' then
         if FileExists(cAttachment) then begin
            TIdAttachmentFile.Create(idmsgMailMessage.MessageParts, cAttachment);
            lRemAtt := True;
         end;

  //send mail
      try
         try
            idSMTP.Connect;
            idSMTP.Send(idmsgMailMessage);
         except on E: Exception do
            begin
      //  For Display   'ERROR: ' + E.Message;
               SendMail := False;
            end;
         end;
      finally
         if idSMTP.Connected then idSMTP.Disconnect;
         // For Display  'Email .. Sent'
         try
            if lRemAtt then
               idmsgMailMessage.MessageParts.Clear;
            if not idmsgMailMessage.IsBodyEmpty then
               idmsgMailMessage.ClearBody;
            if idmsgMailMessage.MessageParts.AttachmentCount > 0 then
               idmsgMailMessage.MessageParts.Clear;
         except

         end;

      end;
   end;
end;

 

 

How start unigui v.0.99 without error?

$
0
0
running smoothly and perfect
1- before install set date/time of your computer to 31/10/2014
2- install
3- copy dcu contents to "C:\Program Files\FMSoft\Framework\uniGUI\Dcu"
4- goto delphi then open all packages uniGui and uniTools folders and compile, build and install
5- now you can create new uniGui web or mobile application
6- after creating uniGui web/mobile copy the two units 'CodeRedirect.pas' & 'uniGUIPax.pas' which exist in dcu cracked folder 
copy it to your new project and then add them to project from the Delphi IDE
7- after open 'uniGUIPax.pas' file look at example which exist after declaring the unit

{
//SAMPLE
unit ServerModule;
...
implementation
uses uniGUIPax, Forms, ... ;
...
procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
sessionManager.sessions.sessionTimeout := 15*(60000); //15 minutes
with TUniGUIServerModule_(Self) do begin
Port := 80;
Title := Application.Title;
UniRoot := 'uni';
ExtRoot := 'ext-4.2.2.1144';
end;
end;
}

8- open serverModule and after implementaion key word put uses 

implementation
uses uniGUIPax, Forms;

9- at serverModule Create Event put the code

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
sessionManager.sessions.sessionTimeout := 15*(60000); //15 minutes
with TUniGUIServerModule_(Self) do begin
Port := 80;
Title := Application.Title;
UniRoot := 'uni';
ExtRoot := 'ext-4.2.2.1144';
end;
end;

10- this code will change the trial Configs

as example port in trial always 8077 here as you see it be port := 80;

11- to deploy application as standalone

copy the exe produced from delphi + 'uni-0.99.0.1169' folder which exist in program files and rename it to 'uni' as create serverModule or any other name
+ 'ext-4.2.2.1144' folder also exist in program files all those (exe + unigui folder + ext folder at the same path)

12- finished

Calculates the distance between two points on Earth

$
0
0
//With the code below you can calculate the distance between two points on the map

Const
          pi      = 3.14159265358979323846;
          half_pi = 1.57079632679489661923;
          rad     = 3.14159265358979323846/180;{conversion factor for degrees into radians}
   
Function atan2(y,x: extended): extended;
    begin 
      if x = 0.0 then
        begin
          if y = 0.0 then
            (* Error! Give error message and stop program *)
          else if y > 0.0 then
            atan2 := half_pi
          else
            atan2 := -half_pi
        end
      else
        begin
          if x > 0.0 then
              atan2 := arctan(y/x)
          else if x < 0.0 then
            begin
              if y >= 0.0 then
                atan2 := arctan(y/x)+pi
              else
                atan2 := arctan(y/x)-pi
            end; 
        end;
    end; {atan2}


//For Teste

Var
   radius,lon1,lon2,lat1,lat2,dlon,dlat,a,distance :extended;

Begin
   radius:=6378.137; {Earth equatorial radius in Km; as used in most GPS} 

   {Input here coordinates of the two points:}

   lon1:=-99.133333; {The Zocalo square, Mexico City}
   lat1:=19.432778;
   
   lon2:=-99.1862;   {The National Museum of Anthropology, Mexico City}
   lat2:=19.4260;

 {The Haversine formula}

   dlon:= (lon2-lon1)*rad;
   dlat:= (lat2-lat1)*rad;
   a:= sqr(sin(dlat/2)) + cos(lat1*rad)*cos(lat2*rad)*sqr(sin(dlon/2));
   distance:= radius*(2*atan2(sqrt(a),sqrt(1-a)));
  ShowMessage('Distance: '+ FloatToStr( round(distance*1000)) +'metros');
   End.
 


 

Adjust size of the columns of a DBGRID

$
0
0
procedure DBGridAjustaColunas( const Grid: TDBGrid );
var a : array of integer;
    i,
    n : integer;
    DataSet: TDataSet;
begin
  SetLength( a, Grid.Columns.Count);
  for i:= 0 to Grid.Columns.Count - 1 do
      a := Grid.Canvas.TextWidth(Grid.Columns.Title.Caption);

  DataSet:= Grid.DataSource.DataSet;
  DataSet.DisableControls;

  try
    while not DataSet.Eof do begin
          for i:= 0 to Grid.Columns.Count -1 do begin
              n:= Grid.Canvas.TextWidth( DataSet.Fields.Text );
              if n>a then a:=n;
          end;
          DataSet.Next;
    end;

    for i:= 0 to Grid.Columns.Count -1 do begin
        Grid.Columns.Width := a + 5;

        {checka espaço para colocar a imagem de ordenação na coluna}
        if Grid.Columns.Items.Width <
           Grid.Canvas.TextWidth(Grid.Columns.Title.Caption)+5 then
           Grid.Columns.Width := Grid.Columns.Width + 5;
    end;

    if not DataSet.IsEmpty then DataSet.First;

  finally
    DataSet.EnableControls;
  end;

end;

EXPORT DBGRID TO EXCEL WITH TOTAL

$
0
0
procedure pExportarDadosDBGridExcel(pDBGrid :TDBGrid; PastHeader :Boolean);
var
  Excel         : Variant;
  Linha, i, Col : Integer;
  SavedBookMark : TBookMark;
  vTotal        : Array[0..1000] of Double;
begin
  try
    if not pDBGrid.DataSource.DataSet.IsEmpty then
    begin
      Excel := CreateOleObject('Excel.Application');
      Excel.Workbooks.Add;

      Linha := 1;
      Col   := 1;

      // Percorrendo todas as colunas do DbGrid
      for i := 0 to (pDBGrid.Columns.Count-1) do
      begin
        // Testando se a coluna do grid está visível
        if pDBGrid.Columns.Items.Visible = True then
        begin
          // Atribuindo valor a célula no Excel
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col] := pDBGrid.Columns.Title.Caption;
          // Formatando o Cabeçalho
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.name := 'Verdana'; // Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.size := 8; // Tamanho da Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.bold := true; // Negrito
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.italic := true; // Italico
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.color := clBlack; // Cor da Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].Interior.Color := clSkyBlue; // Cor
          // Formatando Borda no Cabeçalho da Planilha
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].Borders.LineStyle := 1;
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].Borders.Weight := 2;
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].Borders.ColorIndex := 1;
          Col := Col+1;
        end;
      end;

      Linha := 2;
      Col   := 1;

      // Utilizando o dataset do DBGrid
      with pDBGrid.DataSource.DataSet do
      begin
        // Salvando a posição atual do cursor - linha selecionada no DBGrid
        SavedBookMark := GetBookmark;
        // Evitando que a movimentação no DataSet provoque o scroll do DBGrid
        DisableControls;
        // Posicionando no primeiro registro do DataSet
        First;

        // Percorrendo todas as linhas no DBGrid
        While not EOF do
        begin
          // Percorrendo todas as colunas do DbGrid
          for i := 0 to (pDBGrid.Columns.Count-1) do
          // Testando se a coluna do grid está visível
          if pDBGrid.Columns.Items.Visible = True then
          begin
            // Atribuindo valor a célula no Excel
            if pDBGrid.Columns.Field.DataType in [ftDateTime, ftTimeStamp] then
            begin
              Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].NumberFormat := 'dd/mm/aaaa hh:mmConfuseds';  //Formatando celula no Excel
              Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col]:= ' '+pDBGrid.Columns.Field.AsString;
            end
            else
              if pDBGrid.Columns.Field.DataType in [ftBCD, ftFMTBcd, ftFloat, ftCurrency] then
              begin
                Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].NumberFormat := '###.##0,0000';  //Formatando celula no Excel
                Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col]:= pDBGrid.Columns.Field.AsFloat;
              end
              else
                Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col]:= pDBGrid.Columns.Field.AsString;

            if pDBGrid.Columns.Field.DataType in [ftinteger, ftFloat, ftCurrency, ftFMTBcd, ftBCD] then
              vTotal:= nvl(vTotal,0) + nvl(pDBGrid.Columns.Field.AsFloat,0);

            Col := Col+1;
          end;

          // Indo para o Proximo registro
          Next;

          Linha := Linha+1;
          Col   := 1;
        end;

        // Percorrendo todas as colunas do DbGrid
        for i:= 0 to (pDBGrid.Columns.Count-1) do
        // Testando se a coluna do grid está visível
        if pDBGrid.Columns.Items.Visible = True then
        begin
          // Atribuindo valor a célula no Excel
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].NumberFormat := '###.###,00';  //Formatando celula no Excel
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,col] := iif(vTotal=0,'', FormatFloat('###,###.##',vTotal));
          // Formatando o Resumo
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.name := 'Verdana'; // Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.size := 8; // Tamanho da Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.bold := true; // Negrito
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.italic := true; // Italico
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].font.color := clNavy; // Cor da Fonte
          Excel.WorkBooks[1].Sheets[1].Cells[Linha,Col].Interior.Color := clYellow; // Cor
          Col := Col+1;
        end;

        // Reposicionando o cursor na linha em que estava antes do processo
        GotoBookMark(SavedBookMark);
        // Liberando a memória alocada pelo BookMark
        FreeBookMark(SavedBookMark);
        // Habilitando Controles
        EnableControls;
        // Utilizando recurso auto-dimensionar para ajustar o tamanho das colunas
        Excel.Columns.AutoFit;
        // Abrindo Excel
        Excel.Visible := True;

      end;
    end;

  except
    raise Exception.Create('Opção Inválida: Maquina não possui Excel instalado ou versão do Excel não é compativel!!!');
  end;
end;

 

Complete date in TEdit

$
0
0
Procedure CompletaDataEdit( Const pData : String ; pEdit : TEdit ; const pErro : boolean = True );
var
  DataStr          : String;
  Year, Month, Day : Word;
  i, TotSepara     : Integer;
begin
  DataStr:= pData;
  if DataStr = '' then
  begin
    pEdit.Text := '';
    Exit;
  end;
  TotSepara := 0;
  //Conta quantos numeros existem na Variaval DataStr( pData )
  for i := 1 to Length(DataStr) do
  begin
    if not (DataStr in ['0'..'9']) then
    begin
      DataStr := FormatSettings.DateSeparator;
      inc(TotSepara);
    end;
  end;
  // Remove os Separadores de Data
  while (DataStr <> '') and ( DataStr[Length(DataStr)] = FormatSettings.DateSeparator) do
  begin
    Delete(DataStr, Length(DataStr), 1);
    Dec(TotSepara);
  end;
  // Pega o Ano mes e Dia
  DecodeDate(Now, Year, Month, Day);
  if TotSepara = 0 then
  begin
    case Length(DataStr) of
         0 : DataStr := DateToStr(date);
      1, 2 : DataStr := DataStr+FormatSettings.DateSeparator+IntToStr(Month);
         4 : Insert(FormatSettings.DateSeparator, DataStr, 3);
      6, 8 : begin
               Insert(FormatSettings.DateSeparator, DataStr, 5);
               Insert(FormatSettings.DateSeparator, DataStr, 3);
             end;
    end;
  end;

  try
    pEdit.Text := DateToStr(StrToDate(DataStr));
  except
    if pErro = true then
      pEdit.Text := DateToStr(Date)
    else
      pEdit.Text := '';
  end;
end;


How to Use
// the OnExit Event de TEdit

procedure TFmBI0016.edt_dataExit(Sender: TObject);
begin
  inherited;
  //Complete a partially typed date
//​The function complements the date with the month and year
  CompletaDataEdit((Sender as TEdit).text,( Sender As TEdit));
end;




 

Complete date in TField

$
0
0
Procedure CompletaDataField( Const pData : String ; pField : TFIELD ; const pErro : boolean = True );
var
  DataStr          : String;
  Year, Month, Day : Word;
  i, TotSepara     : Integer;
begin

  DataStr:= pData;

  if DataStr = '' then
  begin
    pField.Value := NULL;
    Exit;
  end;
  TotSepara := 0;
  //Conta quantos numeros existem na Variaval DataStr( pData )
  for i := 1 to Length(DataStr) do
  begin
    if not (DataStr in ['0'..'9']) then
    begin
      DataStr := FormatSettings.DateSeparator;
      inc(TotSepara);
    end;
  end;
  // Remove os Separadores de Data
  while (DataStr <> '') and ( DataStr[Length(DataStr)] = FormatSettings.DateSeparator) do
  begin
    Delete(DataStr, Length(DataStr), 1);
    Dec(TotSepara);
  end;
  // Pega o Ano mes e Dia
  DecodeDate(Now, Year, Month, Day);
  if TotSepara = 0 then
  begin
    case Length(DataStr) of
         0 : DataStr := DateToStr(date);
      1, 2 : DataStr := DataStr+FormatSettings.DateSeparator+IntToStr(Month);
         4 : Insert(FormatSettings.DateSeparator, DataStr, 3);
      6, 8 : begin
               Insert(FormatSettings.DateSeparator, DataStr, 5);
               Insert(FormatSettings.DateSeparator, DataStr, 3);
             end;
    end;
  end;
  try
    pField.Value := StrToDate(DataStr);
  except
    if pErro = true then
      pField.Value := Date
    else
     pField.Value := NULL;
  end;
end;


//How to use

//Use this in OnSetText event the Field

procedure TFmBI0004.qry_vendedor_admissaoSetText(Sender: TField;  const Text: string);
begin
  inherited;
  //The function complete the date
  CompletaDataField(Text,Sender);
end;
 

TVirtualStringTree

$
0
0
I finally succedded to put 9000 records from database table (ID,PARRENT_ID,DESCRIPTION) into TVirtualStringTree in just half of second by loading it all and repartnting it at once. Seems easy but i't was'nt at all. TVirtualTree Components are genious, but not easy to use, . If someone is interested I will post the delphi code.


 

byte to integer converter

$
0
0
An integer holds 4 bytes. So you can code:

function Convert(const b0, b1, b2: Byte): Integer;
begin
  Result :=b0 or (b1 shl 8) or (b2 shl 16);
end;

shl is shift-left, this keyword performs a bitwise shift left of an Integer. The number is shifted x bits to the left.

Example:

- Byte 0 = 1:
Code:
00000001
- Byte 1 = 2:
Code:
00000010
- Byte 2 = 5:
Code:
00000101
=> Result = 328,193
Code:
00000000-00000101-00000010-00000001
You can test by calc.exe of Windows.

Bluetooth

$
0
0
Does anyone has any example source code with Bluetooth 2.1 serial port programming in Firemonkey, not native windows but Android. Also looking for BLE serial port interfacing.  

Proxy Setting Source

$
0
0
This is Proxy Setting source...

Usage... 



unit uniProxySetting;

interface

uses
  Windows, Wininet, Registry;

const
  INTERNET_PER_CONN_FLAGS               = 1;
  INTERNET_PER_CONN_PROXY_SERVER        = 2;
  INTERNET_PER_CONN_PROXY_BYPASS        = 3;
  INTERNET_PER_CONN_AUTOCONFIG_URL      = 4;
  INTERNET_PER_CONN_AUTODISCOVERY_FLAGS = 5;

  PROXY_TYPE_DIRECT         = $00000001;
  PROXY_TYPE_PROXY          = $00000002;

  INTERNET_OPTION_PER_CONNECTION_OPTION   = 75;

type
   INTERNET_PER_CONN_OPTION = record
      dwOption: DWORD;
      Value: record
         case Integer of
            1: (dwValue: DWORD);
            2: (pszValue: PAnsiChar);
            3: (ftValue: TFileTime);
      end;
   end;
   LPINTERNET_PER_CONN_OPTION = ^INTERNET_PER_CONN_OPTION;
   INTERNET_PER_CONN_OPTION_LIST = record
      dwSize: DWORD;
      pszConnection: LPTSTR;
      dwOptionCount: DWORD;
      dwOptionError: DWORD;
      pOptions: LPINTERNET_PER_CONN_OPTION;
   end;
   LPINTERNET_PER_CONN_OPTION_LIST = ^INTERNET_PER_CONN_OPTION_LIST;

   procedure SetProxyNew(Con, ProxyServer: String);
   procedure DisableProxyNew(Con: String);

   Procedure SetProxy(const Server: String);
    Procedure DisableProxy;

implementation

Procedure SetProxy(const Server: String);
var
  Reg : TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Internet Settings',False);
  Reg.WriteString('ProxyServer',Server);
  Reg.WriteBool('ProxyEnable',True);
  Reg.CloseKey;
  Reg.Free;
  InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0);
end;

Procedure DisableProxy;
var
  Reg : TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Internet Settings',False);
  Reg.WriteBool('ProxyEnable',False);
  Reg.CloseKey;
  Reg.Free;
  InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0);
end;

procedure SetProxyNew(Con, ProxyServer: String);
var
   list: INTERNET_PER_CONN_OPTION_LIST;
   dwBufSize: DWORD;
   Options: array[1..2] of INTERNET_PER_CONN_OPTION;

begin
   dwBufSize := sizeof(list);
   list.dwSize := sizeof(list);
   list.pszConnection := pchar(Con);
   list.dwOptionCount := High(Options);
   Options[1].dwOption := INTERNET_PER_CONN_FLAGS;
   Options[1].Value.dwValue := PROXY_TYPE_PROXY;
   Options[2].dwOption := INTERNET_PER_CONN_PROXY_SERVER;
   Options[2].Value.pszValue := PansiChar(ProxyServer);
   list.pOptions := @Options;
   InternetSetOption(nil, INTERNET_OPTION_PER_CONNECTION_OPTION, @list, dwBufSize);
   InternetSetOption(nil, INTERNET_OPTION_REFRESH, nil, 0);
end;

procedure DisableProxyNew(Con: String);
var
   list: INTERNET_PER_CONN_OPTION_LIST;
   dwBufSize: DWORD;
   Options: array[1..2] of INTERNET_PER_CONN_OPTION;

begin
   dwBufSize := sizeof(list);
   list.dwSize := sizeof(list);
   list.pszConnection := pchar(Con);
   list.dwOptionCount := High(Options); // the highest index of the array (in this case 3)
   Options[1].dwOption := INTERNET_PER_CONN_FLAGS;
   Options[1].Value.dwValue := PROXY_TYPE_DIRECT;
   Options[2].dwOption := INTERNET_PER_CONN_PROXY_SERVER;
   Options[2].Value.pszValue := PansiChar('');
   list.pOptions := @Options;
   InternetSetOption(nil, INTERNET_OPTION_PER_CONNECTION_OPTION, @list, dwBufSize);
   InternetSetOption(nil, INTERNET_OPTION_REFRESH, nil, 0);
end;

end.




 

Print multiple files with Fastreport

$
0
0
Hello,

I want to print multiple files with FastReport but when I use frxReport.ShowReport (False); it only shows me the last file in the preview.

Help me please
 

Minimize APP in Android

$
0
0
Hi there:

I want so start an aap and inmediately I want to send it to the background, like the home button does.

I have tried:

form1.SendToBack;
form1.Active := false;
form1.Hide;
form1.DoHide;
WindowState := TwindowState.wsMinimized;

and no one works.

I do noy want the user knows that the App has started. So the form transparency is set to true, no elements are visible on the form. The only need of this app is to start a service.

So the app starts, and I see the screen on black color...and nothing happens until I press home button. So the black screen is there forever if I do not press the home button  or back button.

How can I send the app to the background "by code".

Thanks in advance.

I managed to do it,

This is the code;

procedure TForm1.ButtonHome;
var
  Intent: JIntent;
begin
  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.ACTION_MAIN);
  Intent.addCategory(TJIntent.JavaClass.CATEGORY_HOME);
  MainActivity.startActivity(Intent);
end;
 

How to use FormatDateTime

$
0
0
Hi

I'm not too experienced in Delphi, so I have a little problem using FormatDateTime. I read the help file but maybe I can't see the exaplanation how to solve my problem:

I need to convert string into date, example: 'September 15th, 2015'. 

How to convert this into TDate?



Code:
var myDate:TDate;
str:string;
begin
str:='September 15th, 2015';
myDate:=FormatDateTime(??);
end;

Any advise?

Thank you

JD

frxReport1 DesignReport

$
0
0
I install fast report 5.1.5 but the problem 
frxReport1.DesignReport not work 

Please how i sloved it
 

CodeRage 7 November 2012 OverView

$
0
0
CodeRage 7: Tuesday, November 6, 2012 – 5am PST

Bob Swart – What’s New in the Delphi Language

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
In this session, Bob will explain the purpose of XE3 record
helpers, as well as some existing record helpers found in Delphi
XE3, plus a number of custom new record helpers like a
TIntegerHelper, enhanced TStringHelper, TArrayHelper and an example
TEnumHelper. Bob will only use the Delphi XE3 code editor (and
compiler) to demonstrate this new language feature which is
available in all editions of Delphi XE3.

CodeRage 7: Tuesday, November 6, 2012 – 6am PST

Vsevolod Leonov – Migration From Client/Server To Multi-Tier

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
DataSnap platform for multi-tier provides powerful capabilities for
developers. Now it’s easy to start a new multi-tier project with
many variants of deployment. But sometimes the goal is to convert
the existing Client/Server project into DataSnap version. Sometimes
it needs the migration of the code style into pattern, typical for
multi-tier programming. So we have a traditional project,
implementing interaction with DBMS. How can we support migration?
What should be easily change and what needs some refactoring? The
presentation will consider the basic and reliable techniques, which
will help you to upgrade the existing projects and get the
advantages of new DataSnap multi-tier architecture.

CodeRage 7: Tuesday, November 6, 2012 – 7am PST

Brian Long – IDE Productivity Tips & Techniques

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Everyone can benefit from efficiency boosts from time to time.
Brian takes you on a journey through a whole list of time-saving
Delphi & C++Builder IDE shortcuts and lesser known product
features to help give your programming productivity a hike. The
lion’s share of this session is a reflection on personal experience
on trying to be more efficient in the IDE.

CodeRage 7: Tuesday, November 6, 2012 – 8am PST

John Thomas, Sarina Dupont, Marco Cantu – Delphi XE3
Product Address

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
John Thomas, Sarina Dupont and Marco Cantu give an overview of
Delphi, C++Builder and RAD Studio. JT introduces Marco as the new
Delphi Product Manager. Sarina gives a preview of Mobile Studio’s
Delphi for iOS.

CodeRage 7: Tuesday, November 6, 2012 – 9am PST

Sarina DuPont and Henry Liu – Introduction to Visual Live
Bindings

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Learn how to connect UI controls to datasets using Visual
LiveBindings in your VCL and FireMonkey application. In this
session you will see how to go from application prototyping using
sample data to production by changing your data source to a
ClientDataSet or the database of your choice. Learn how to visually
organize your project with layers and use LiveBindings actions to
easily navigate through images and data in your applications.

CodeRage 7: Tuesday, November 6, 2012 – 10am PST

Darren Kosinski – New Features in FireMonkey 2, Part 1

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
An overview presentation and demonstrations of new features in
FireMonkey FM2, including anchors and layouts, bitmap styles and
non-client area styles, and multi-media playback and capture.

CodeRage 7: Tuesday, November 6, 2012 – 11am PST

Darren Kosinski – New Features in FireMonkey 2, Part 2

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
An overview presentation and demonstrations of new features in
FireMonkey FM2, including Location and Accelerometer sensors and
Touch and Gestures.

CodeRage 7: Tuesday, November 6, 2012 – 12pm PST

Ray Konopka – Creating Custom FireMonkey Controls with
Delphi XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
RAD Studio supports cross-platform user interface development with
the FireMonkey framework. Like the VCL, FireMonkey is
component-based, but unlike the VCL, FireMonkey is based around the concept of styles. As a result, creating custom FireMonkey controls is quite a bit different than create VCL controls. This session
provides you with what you need to get started building custom
FireMonkey controls.

CodeRage 7: Tuesday, November 6, 2012 – 1pm PST

Quinn Wildman – Creating your first InterBase Applications
Using Delphi XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This presentation is designed for a user starting to use InterBase
and Delphi. It demonstrates how to create a database and tables
using IBConsole, and shows how to create a small useful trigger and
how to import data. You’ll also see how to create a simple database
application using InterBase Express with FireMonkey using Delphi.

CodeRage 7: Tuesday, November 6, 2012 – 2pm PST

Stephen Blas – dbExpress Connectivity to SQLite

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session provides instruction on setting up SQLite on Windows
and Mac and shows a sample application that manipulates data.

CodeRage 7: Tuesday, November 6, 2012 – 3pm PST

Malcolm Groves – An Introduction to Model-View-View Model
(MVVM) in Delphi

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
With the addition of cross-platform support to Delphi, and the
coming Mobile Studio product, there is an increasing need to have
device-specific User Interfaces. At the same time, you want to
minimize the amount of code you have to rewrite for each platform.
This session will look at Model-View-ViewModel, one technique that
leverages LiveBindings to not only minimize the effort required to
slide different UIs in front of your code, but also increases the
maintainability and testability of your app as a bonus.

CodeRage 7: Tuesday, November 6, 2012 – 4pm PST

Goran Begic – SmartBear Software – Profiling of 64-bit
Applications with AQtime and Delphi

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
The presentation consists of two parts. In the first part the
presenter will introduce five tips for improvement of performance
of your algorithms written in Delphi code inside RAD Studio XE3.
Each tip will be followed with an example demonstration using the
free tool AQtime Standard shipping with RAD Studio. The second part
of the presentation will focus on some more advanced topics
including line level profiling and advanced counters for in depth
analysis of performance of your code.

Wednesday, November 7, 2012

CodeRage 7: Tuesday, November 7, 2012 – 5am PST

Nirav Kaku – HTML5 Builder and Delphi DataSnap

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session will show you how to build a Delphi DataSnap server
application using a DataSet and pass the rows via JSON to an HTML5
client application.

CodeRage 7: Tuesday, November 7, 2012 – 6am PST

Stephen Ball – Getting Practical with DataSnap : A Hands-on
Session with Prizes

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
In this fast paced session, attendees will be shown how to take and
run with this ready-to-use DataSnap based business engine and how
it has been built. Step-by-step, you will be shown how to populate
it with your own data structures and output information to any
client type, including stunning FireMonkey client applications.
Along the way, you will see how to use each of the server side
state for data management (Session, Invocation, Server) plus a
number of language features introduced from D7 up to XE3 within
Delphi, and shows how RTTI partnered with FireMonkey Styles can
help build dynamic run time generated screens from any object; A
Competition! At the end of this session, get the link to the
project code, download it and join the competition to build a front
end view of data coming out the engine using your favourite C++ /
Delphi tools. So what are you waiting for?

CodeRage 7: Wednesday, November 7, 2012 – 7am PST

Michael Philippenko – Fast Report – Cross-platform
Reporting with FireMonkey

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session covers the advantages and limitations of business
reporting creation with FastReport under FireMonkey. The
presentation will include a short review, comparison with VCL, and
demonstration of possibilities.

CodeRage 7: Wednesday, November 7, 2012 – 8am PST

Sarina Dupont and Jose Leon – HTML5 Builder Product
Address

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
In this session, Product Manager Sarina DuPont talks about what
HTML5 Builder is all about and how you can leverage the latest in
web technologies to build mobile and web apps using HTML5 Builder.
This session also includes demos.

CodeRage 7: Wednesday, November 7, 2012 – 9am PST

Marco Cantu – FireMonkey with Style

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Styles are the technical foundation of visual controls in
FireMonkey. This session explains why and how, and also covers
what’s new in FM2 regarding styles.

CodeRage 7: Wednesday, November 7, 2012 – 10am PST

Cary Jensen – LiveBindings: Expressions and Side Effects

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
At the core of LiveBindings, first introduced in Delphi XE2, is an
expression engine designed to evaluate string expressions
dynamically at runtime. This presentation looks at some of the
internals of LiveBindings, and shows how the expression engine can
be used to implement powerful side effects.

CodeRage 7: Wednesday, November 7, 2012 – 11am PST

Marco Cantu – Delphi XE3 Development for Windows 8

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session covers the “dual” architecture of Windows 8, Delphi
XE3 support for desktop applications including some new Windows 8
APIs, the Metropolis styles in VCL and FireMonkey, plus the
LiveTile component.

CodeRage 7: Wednesday, November 7, 2012 – 12pm PST

Cary Jensen – ClientDataSets Part 4: Aggregates and
GroupState

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This series on ClientDataSets continues with a look at aggregates
and group state. Presented by ClientDataSet expert Cary Jensen,
this session demonstrates how to define and control aggregate
calculations, as well as how and when to determine group state.

CodeRage 7: Wednesday, November 7, 2012 – 1pm PST

Pawel Glowacki – Building Scalable, Multi-tier Systems with
DataSnap XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
In this demo-oriented session, learn how to use RAD Studio XE3 and
DataSnap architecture for creating scalable, multitier, secure
systems. See different DataSnap server and client application
types, use role-based authentication/authorization framework for
fine-grained security, check out how to use callbacks, and learn
what it takes to deploy your server to the cloud.

CodeRage 7: Wednesday, November 7, 2012 – 2pm PST

Jim McKeeth – What’s New in Embarcadero Prism XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Come learn what’s new in XE3 and some tips and tricks to get the
most from Embarcadero Prism XE3 and the Oxygene language that
powers it!

CodeRage 7: Wednesday, November 7, 2012 – 3pm PST

Girish Patil – Tour of the New Gnostice Document Processing
Tools

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
In this session, we’ll take a tour of the new products and features
of the Gnostice XtremeDevSystem suite of tools for electronic
document processing. Processing that includes creating, viewing,
printing, editing and working with formats such as PDF, DOCX and
others. We’ll look at both the VCL version using Delphi and the
.NET version using Delphi Prism. Along the way, we’ll also look at
some general technological aspects of the PDF format.

CodeRage 7: Wednesday, November 7, 2012 – 4pm PST

Alister Christie – LearnDelphi.tv – XML Data Bindings in Delphi

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Using XML can be a headache. Learn how to make it a breeze with XML
Data Bindings.

Thursday, November 8, 2012

CodeRage 7: Thursday, November 8, 2012 – 5am PST

Pawel Glowacki – FireMonkey 3D programming using Delphi
XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
The FireMonkey framework available in RAD Studio XE3 contains a
number of enhancements for creating cross-platform 3D applications,
including new material system based on GPU shaders and enhanced
“TModel3D” component. Join this session to see how easy and fun 3D
programming with FM2 can be!

CodeRage 7: Thursday, November 8, 2012 – 6am PST

Sarina Dupont, Adrian Chavez, Jose Leon – HTML5 Builder
Mobile Development & Deployment

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Learn how to build client and server mobile applications using
JavaScript, HTML5, CSS3 and PHP with connectivity to leading
databases and deploy to iOS, Android, BlackBerry and Windows Phone.
Also covered in this session is mobile user interface styling, and
how to use the included HTML5 components like the multimedia
component for rendering video and audio in your mobile
applications.

CodeRage 7: Thursday, November 8, 2012 – 7am PST

Robert Love – Introduction to the Jedi Code Library

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session covers what the open source Jedi Code Library (JCL)
provides. This session also discusses some of the best known areas
of the JCL such as its JCLDebug.pas unit as well as many of the
lesser known areas, that can really simplify what you do. You can't view the links! Click here to register

CodeRage 7 – Thursday, November 8, 2012 – 8am PST

Sriram Balasubramanian – InterBase Product Address

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Come learn what’s new in InterBase XE3 and how we are making it
easier for RAD Studio/C++ developers to develop C/S and embedded
database applications with InterBase. We will also highlight what
we have planned for the upcoming year (2013) to take InterBase to
Mobile OS platforms so you can deliver your database applications
to multiple platforms using the highly productive and small
footprint software stack.

CodeRage 7: Thursday, November 8, 2012 – 9am PST

Dmitry Arefiev, DA-SOFT Technologies – AnyDAC SQLite Driver
Review

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session presents AnyDAC SQLite driver. See how to manage and
use SQLite encryption, and how to extend SQLite engine by custom
functions, locales and data sources. The session discusses SQLite
callbacks as well.

CodeRage 7: Thursday, November 8, 2012 – 10am PST

Jim Tierney – Using LiveBindings Bind Sources and Adapters

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Jim will use bind source components and adapter components to link
non-db data. Learn how to use intermediate fields, how to link
controls to user-defined TObjects, and how to create custom adapter
components.

CodeRage 7 – Thursday, November 8, 2012 – 11am PST

Marco Cantu – Using jQuery with DataSnap REST Applications

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
An overview of the architecture and features of Delphi DataSnap
REST applications, an introduction to jQuery, and how to use it in
practice to improve the website of the model (including using a few
jQuery components).

CodeRage 7 – Thursday, November 8, 2012 – 12pm PST

David I – The Very Best of RAD Studio XE3

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
David I presents “code only, no slides” demonstrations of several
new capabilities in RAD Studio XE3 including: device and sensor
management, capturing audio and video, location and motion sensors, FireMonkey gestures and actions, material source for FireMonkey 3D components, building FireMonkey apps for the Apple Mac Store and whatever else fits into the time available for this session.

CodeRage 7: Thursday, November 8, 2012 – 1pm PST

Al Mannarino – HTML5 Builder Multi-Tier Application Development

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session shows how to create and use a DataSnap REST Client
Module to access a Delphi DataSnap server and call the functions
exposed by the Delphi DataSnap server. DataSnap is a technology
that enables RAD creation of multi-tier web applications. We will
use HTML5 Builder to create a client-side web applications that
interacts with DataSnap. A DataSnap REST client module is a data
module that lets you access a DataSnap server. You can then include
that data module in another data module or a web page to be able to
call the functions exposed by the DataSnap server.

CodeRage 7: Thursday, November 8, 2012 – 2pm PST

Olaf Monien – Effective Business Objects in FireMonkey

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
This session will show how to build a business-type multi-platform
application that is built on top of Aurelius ORM, consumes it’s
data by connecting to a REST Service and presents the data by
utilizing LiveBindings.

CodeRage 7: Thursday, November 8, 2012 – 3pm PST

Ray Konopka – CodeSite Express vs CodeSite Studio

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
CodeSite is an advanced debugging and application logging system
that gives developers deeper insight into how their code is
executing. CodeSite Express, which is included in RAD Studio,
provides core logging functionality but does not include the full
range of capabilities that are available in CodeSite Studio. In
this session, the core functionality of CodeSite Express is
demonstrated along with a several examples of the more advanced
features of CodeSite Studio.

CodeRage 7: Thursday, November 8, 2012 – 4pm PST

Ray Konopka – Effectively Using Raize Components

Download – You can't view the links! Click here to register

Watch – You can't view the links! Click here to register

Description:
Raize Components is a user interface design system for Delphi and
C++Builder. At its center is a collection of more than 125
general-purpose native VCL controls. This session will demonstrate
how developers use Raize Components to build sophisticated user
interfaces in less time with less effort. In addition, specific
attention will be focused on new RAD Studio features such as VCL
Styles and how they can be leveraged in Raize Components.

 

Delphi ile programlama (MYO Öğrencileri için kısa ders notları)

$
0
0
Türkçe eğitim veren üniversitelerimizde öğrenimine devam eden öğrencilerimize yönelik kısa notlar paylaşmayı düşünüyorum.
Bugün ilk paylaşımımı Delphi Programlama Dili'nin kısa bir tanıtımı ile başlatmak istiyorum.
Delphi programlama dili, pascal programlama dili üzerine bina edilmiştir. Programlama dünyasının tanıdığı klasik pascal programlama dili, bir zamanlar C programlama dili ile rakip dillerin başında geliyordu. C diline nesneye yönelik yapılar eklenip, C++ geliştirildikten sonra pascal da aynı şekilde kendini yeni şartlara ve yapılara uyarlamak zorundaydı ve OBJECT PASCAL geliştirildi. Borland firması bu dillerle ilgili geliştirme yapan iki önemli firmadan biri idi; diğeri ise Microsot idi. Borland, hem C ("Borland C") hem de Pascal ("Borland Pascal") üzerinde çalışmalar yaptığı halde; Microsoft Pascal ile ilgilenmiyor, "Microsoft C" adı ile C Dilini geliştiriyordu. Tabi ki, bu diller sadece bu iki şirketin tekelinde değildi, ancak, konu ile ilgili en önde giden ve kendi markalarını oluşturan firmalardı bunlar.
Nitekim daha sonraki aşamalarda, Borland firması, bu dillerin Windows İşletim Sistemi üzerinde geliştirme yapabilmesini sağlayan versiyonlar dağıttı; ancak bunların kullanımı DOS işletim sistemindekilerden fazla bir farkı yoktu. Object Pascal'ın görsel bir geliştirme ortamına kavuşturulması ile Delphi ortaya çıktı. Başlangıçta Object Pascal Programlama Dili için bir IDE (Integrated development environment=Tümleşik Geliştirme Ortamı) olarak kabul edilen Delphi, Object Pascal üzerine bina ettiği yapıların geldiği boyut artık basit bir pascal yapısını aştığı için olacak ki, artık "Delphi Programlama Dili" olarak düşünülmeye başlandı. İlk Delphi versiyonu 1995te Borlanda tarafından çıkarılmıştı. Daha sonra Delphi'nin de içerisinde yer aldığı RADStudio paketi tüm hakları ile birlikte başka firmalara devredildi; bu işe el atan ve RADStudio üzerinde ciddi teknolojik reformlar gerçekleştiren firma Embarcadero'dur. XE serierlni hızlı bir şekilde duyuran Embarcadero Şirketi, son olarak 31 Ağustos 2015'te, Delphi 10 ve C++Builder 10'u içeren RAD Studio 10 Seattle sürümünü yayınlamıştır.
RADStudio2nun bu gelişimi ile birlikte, Delphi artık (Native Linux dağıtımları hariç) hemen hemen tüm işletim sstemlerine edebilir, Android ve IOS mobil işletim sistemleri ve MACOS (OSX), Windows işletim sistemleri için hem masaüstü hem de web tabanlı uygulama geliştirilebilir hale getirilmiş modern ve eksiksiz bir programlama aracıdır.
Delphi'nin gelişimi hakkında daha geniş bilgi için aşağıda listelediğim kaynaklara bakılabilir. Sonraki paylaşımımda "Programlamanın Temel Unsurları ve Delphi Programlarının Yapısı" konularını işleyeceğim.
Herkese iyi çalışmalar diliyorum.
                                                                                                                                                        Öğr.Gör. Fahri ÇAKAR
                                                                                                                                                        Dicle Üniversitesi 
                                                                                                                                                        Teknik Bilimler Meslek Yüksekokulu
                                                                                                                                                        Bilgisayar Teknolojileri Bölümü 


Kaynaklar:
1- https://tr.wikipedia.org/wiki/Delphi_(programlama_dili)
2- http://www.delphiforumu.com/
3- http://www.delphiturkiye.com/
4- http://www.embarcadero.com/
5- http://delphi.about.com/

 

 

Delphi ile programlama (ClientSocket ve ServerSocket Bileşenlerinin Yüklenmesi)

$
0
0
ClientSocket and ServerSocket Bileşenleri
 
Delphi IDE’sinde bir çok bileşen sizin için hazır halde gelir. Kurulum bittiğinde bazıları “Tool Palette”deki yerlerini almış olurlar, ancak bazıları ise pakete dahil olduğu halde, sık kullanılmadıkları için yüklenmeiş olurlar. Bunları istediğiniz zaman yükleyebilmeniz için, bileşenler hazır olarak bulundurulurlar. Sizin bunları “Tool Palette”’e eklemenizi beklemektedirler.
Bu tür bileşenlerden biri de, soket bileşenleridir; soket bileşenleri, kurulum sırasında, varsayılan olarak yüklenmez. Soket bileşenleri kullanmak için, C:\Program Files\Embarcadero\RAD Studio\VERSION\bin\ klasöründe bulunan dclsockets.bpl paketini yüklemeniz gerekir.
 
Soket bileşenleri yüklemek için:
  1. Delphi IDE’sindeki ana menüden şunu seçin: Component > Install Packages. 
  2. Install Packages diyalog kutusunda,  Add (Ekle) buttonunu tıklayın.
  3. Add Design Package diyalog kutusunda, Delphi kurulumunu yaptığınız klasörlerdeki bin klasörünü bulunuz (C:\Program Files\Embarcadero\RAD Studio\VERSION\bin\ gibi). 
  4. Bu klasördeki dclsockets<nnn>.bpl dosyasını seçin ve Open (Aç) buttonuna tıklayınız.
  5. OK buttonuna basarak Install Packages diyalog kutusunu kapatınız. 


The socket components  are listed in the Internet category of the Toot Palette. 
 
Bu adımların bir defa uygulanması, kurulum için yeterliddir. Soket bileşenleri (TClientSocket and TServerSocket) artık “Tool Palette”de bulunan “Internet” kategorisi içerisinde yer alacak ve bundan sonra da kullanımınız için hazır olacaklardır.
ClientSocket ve ServerSocket bileşenleri, "soket programlama"  için gereklidir. Bir chat programından tutun, bir uzak veritabanını yönetmeye kadar, bir çok işlemleri yapabilmenize imkan sağlarlar.
Bu konu ile ilgili bir örnek uygulama ile birlikte, kullanıma yönelik geniş bir anlatım yapacağım.
İyi çalışmalar diliyorum.
Öğr.Gör. Fahri ÇAKAR
Dicle Üniversitesi
Teknik Bilimler MYO
Bilgisayar Teknolojileri Bölümü

Hue_sample

DBGrid Populate Procedure

$
0
0
I wrote this quiet a while back and works up to Delphi 2007 for me without a problem

Uses Db,dbGrids,DbTables;

procedure PopulateDBGrid(DataSource: TDataSource; var RDBGrid: TDBGrid; DataFields, DataDescript, DataRO: array of const);
var nCurrec: Integer;
   lReadOnly: Boolean;
   TempVar: string;
begin
   If not RDBGrid.Visible Then
      RDBGrid.Visible := True;
   RDBGrid.DataSource := DataSource;
   RDBGrid.Columns.Clear;
   for nCurRec := 0 to High(DataFields) do begin
      RDBGrid.Columns.Add;
      RDBGrid.Columns[nCurRec].FieldName := DataFields[nCurRec].VPChar;
      if High(DataRO) >= nCurRec then
         RDBGrid.Columns[nCurRec].ReadOnly := DataRO[nCurRec].VBoolean;
      if High(DataDescript) >= nCurRec then
         RDBGrid.Columns[nCurRec].Title.Caption := DataDescript[nCurRec].VPChar;
   end;
   RDBGrid.Repaint;
end;

Usage : 
      PopulateDBGrid(dtaAuto, DBGrid1, ['AccounNo', 'Name', 'TelNo'], ['Account No', 'Name', 'Telephone No'], [True, True, False]);
      dtaAuto is the datasource to use to populate the DBGrid
      DBGrid1 is the DBGrid to be populated
       ['AccounNo', 'Name', 'TelNo'] is the table fields to display
       ['Account No', 'Name', 'Telephone No'] is the Column Headings that will be displayed
       [True, True, False] specifies if the field is readonly or editable (True = Readonly and Fasle Editable)


I have been trying to get this to work since XE6 but for some or other reason the DBgrid just will not display anything, If someone can figure it out I would appreciated it.

 
Viewing all 173 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>