BCS Flash Builder 4.5 Execute URL Routine

There are those occasions when our flex application will need to interface with existing sites on the world wide web.  To invoke a URL in flash builder is slightly different than any other programming scenario I have used.

I have written a small routing that handles URL requests.  The code is as follows”

protected function XQTCmd(cmd : String): void
			{
				var urlReq:URLRequest = new URLRequest(cmd);
				navigateToURL(urlReq, "_blank");
			}

Place the routine in the root MXML and invoke the routine by using a coded statement indicated below.

protected function ABWBtn_clickHandler(event:MouseEvent):void
			{
				XQTCmd("http://localhost/bm02/bm02-debug/bm02.html")
			}

This code can be initiated from any event available to the MXML application.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Delphi XE3 Repositories

To effectively utilize the component architecture of the Delphi XE3 VCL a repository should be established. This approach eliminates the need to update the Delphi XE3 compiler library search options with each component created.

The better approach is to make one entry in the compiler environment and place all component parts in that repository. If you employed the BCS Delphi XE3 Source Code Generator a batch file to copy the pertinent component parts was created and available. Notice the end target for these parts is c:\xp\dcu (the default repository).

When components require reports a similar scenario holds true. While an entry to the library search options is not required a central location for reports is highly desirable. When the components are utilized they will already know where the required report descriptions are located. The default location is C:\xp\FRep for FastReport report files.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Delphi XE3 Source Code Generator

We now have a Delphi source code generator for the XE3 version of Delphi. This version of the XE3 source code generator is set up to produce a VCL application.

The BCS XE3 Delphi Code Generator generates three Delphi source code projects. The famidml.dproj is a standalone project made available for developing additional functionality at the modal dialog level. Project famidpk.dproj is a project that will install the component on the default component palate “AB Comps” (minus double quotes). The famidcmpml.dproj project test the newly installed component.

These projects are generated based on a family id (famid) and an output target directory. The code generator ensures no code with the same output path plus the family id as its low level qualifier exists. This approach makes it impossible to overlay existing components.

How this code generator work is dependent on a file naming scheme consisting of a family id and other file naming component suffixes.

The source code skeletons are the life blood of the code generator. To create a new skeleton copy the existing skeleton to a new sub directory and add the functionality desired. I now have skeletons for ADO data table support, master detail scenarios via ADO, and support for FastReport.

A component to support generation of ADO data tables is required and can be found here.

The source code for this project is available here.

Component documentation for all components including code skeletons can be viewed here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Delphi XE3 Retrieve Metadata

There are those occasions when metadata is required to facilitate successful completion of another assigned task.

The BCS Delphi XE3 Retrieve Metadata component relies on component BCS XE3 Get Alias, DSN, User Id and Password.  The source code for this component may be located at http://cc.embarcadero.com/Item/29412.

The driver program for the component identifies all the associated properties handled by this component.

unit BCSGenDEdp;

interface

uses
  Forms, System.SysUtils, System.Classes, BCSGenDEU, Windows;

type
  TBCSGenDECmp = class(TComponent)
  private
    { Private declarations }
    FPwd : String;
    FUsr : String;
    FDsn : String;
    FTab : String;
    FDbn : String;
    FCnt : Integer;
    Fmn : TStringList;
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
    function Execute : BooLean;
    property pwd : String read FPwd write FPwd;
    property usr : String read FUsr write FUsr;
    property dsn : String read FDsn write FDsn;
    property tab : String read FTab write FTab;
    property dbn : String read FDbn write FDbn;
    property mcnt : Integer read FCnt write FCnt;
    property mna : TStringList read Fmn write Fmn;
  end;

procedure Register;

implementation

function TBCSGenDECmp.Execute : Boolean;
begin
  result := false;
  fmn := TStringList.Create;
  Application.CreateForm(TBCSGenDEC, BCSGenDEC);
  if BCSGenDEC.ShowModal = id_OK then
  begin
    result := true;
    pwd := BCSGenDEC.BCSAiliasCmp1.pwd;
    usr := BCSGenDEC.BCSAiliasCmp1.usr;
    dsn := BCSGenDEC.BCSAiliasCmp1.dsn;
    tab := BCSGenDEC.BCSAiliasCmp1.tab;
    dbn := BCSGenDEC.ADOConnection1.DefaultDatabase;
    fmn.Assign(BCSGenDEC.ListBox1.Items);
    mcnt := BCSGenDEC.ListBox1.Items.Count;
  end;
  BCSGenDEC.Free;
end;

procedure Register;
begin
  RegisterComponents('AB Comps', [TBCSGenDECmp]);
end;

end.

In the driver program description it is easy to determine which properties are populated by the component BCSAiliasCmp1.

The other properties are initialized by the host component.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Delphi XE3 PHP Source Code Generator

To make JQuery Easy UI work in the PHP environment you will need at minimum five PHP files and one HTML file.

After carefully examining the process it was determined that metadata plays a major role in making the UI function properly. Once Active Data Objects (ADO) were reverse engineered all the required metadata was made readily available.

The next problem was to understand and reverse engineer the functionality of the associated PHP files. Once that was accomplished a Delphi XE3 application was written that provides a GUI for ease of operation.

With the GUI a list of available DSN are generated (in ascending alphabetical order) for your selection. Once a DSN is selected all the required metadata is captured and passed into the code generation tool. The GUI also asks for a target location for the generated code.

Within a matter of seconds’ six PHP scripts and a HTML file is generated with zero errors and zero defects (no testing is required).

Point your browser to the location where the code was deposited and start using the newly generated code.

To begin the process the following dialog appears.

jq01

 

 

 

 

 

 

The next dialog to appear is as follows.

jq02

 

 

 

 

 

 

 

Click on the Get Data Element Names button and the following will appear.

jq03

 

 

 

 

 

Finally the code generator would like to know where you would like to place the generated code.

jq04

 

 

 

 

 

 

 

 

After the path is selected traverse to the designated location and view the generated code.

jq05

 

 

 

 

 

 

 

Below you see the generated code in action.

jq06

 

 

 

 

 

 

 

 

 

 

This tool saves the technician countless hours of coding and testing PHP and HTML by automatically generating the required code.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS XE3 Get Date And Time Component

When the user need to suppply values for a date and time the BCSGetDateTime component provides the framework to communicate the date and time parameters.

The component documentation can be located here. The component source code can be found here.

When the user click on the drop down control for the date a calendar appears and the user can select the date graphically of key in the appropriate month day and year.

Conversely when the user would like to specify a time simply click on the hour, minute or second parameter and use the spin control or simply key the values in. There also exists a Make Time Midnight control that make the time to midnight of the current date.

When the user has the desired date and time simply click the Ok control. Conversely the user may also click on the Cancel control to discard all input.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Delphi XE3 Source Code Helper

This application launches a project to sort Delphi XE3 source code into tidy sorted (in ascending sequence) code. Program snippets and component parts are easier to locate in source code if the source code is stored in ascending alphabetical sequence.

This project is a non-trivial task therefore I have subrogated the tasks into processing code snippets. Once all the categories of code snippets are being handled properly then the task of placing the snippets in the appropriate order will be addressed.

The source code for this project can be found here.  The component documentation can be found here.

{*-----------------------------------------------------------------------------
 Procedure: FormatUses1Click
 Date:      27-May-2013
 @Param     Sender: TObject
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSSourceHelperC.FormatUses1Click(Sender: TObject);
var
  buf: String;
  obuf: String;
  i: Integer;
  j: Integer;
  k: Integer;
begin
  BCSSourceHelperPageControl1.ActivePageIndex := 0;
  k := 1;
  Repeat
    buf := memUnsorted.Lines[k];
    buf := Trim(buf);
    if Length(buf) > 0 then
    begin
      i := 1;
      j := 1;
      repeat
        if ((buf[i] = ',') or (buf[i] = ';')) then
        begin
          obuf := Trim(obuf);
          memSorted.Items.Add(obuf);
          j := 0;
          obuf := '';
        end
        else
        begin
          obuf := obuf + buf[i];
        end;
        Inc(i);
        Inc(j);
      until i > Length(buf);
    end;
    Inc(k);
  Until k > memUnsorted.Lines.Count - 1;
  obuf := '';
  i := 0;
  j := 1;
  obuf := '';
  memSortFormated.Lines.Clear;
  memSortFormated.Lines.Add('uses');
  Repeat
    if (Length(obuf) + Length(memSorted.Items[i]) + 2 < 80) then
    begin
      obuf := obuf + memSorted.Items[i] + ', ';
    end
    else
    begin
      memSortFormated.Lines.Add('  ' + obuf);
      obuf := memSorted.Items[i] + ', ';
    end;
    Inc(i);
  Until i > memSorted.Items.Count - 1;
  Delete(obuf, Length(obuf) - 1, 2);
  obuf := obuf + ';';
  memSortFormated.Lines.Add('  ' + obuf);
end;

This code disassembles the uses statement by storing each statement member in a sorted list box.  The items are then retrieved (in order) from the list box and a new uses statement is generated.

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

The resulting output looks like this.

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

The main class for any dialog is comprised of many parts.  The next section of code deals with class variables.

{*-----------------------------------------------------------------------------
 Procedure: ClassVariablesClick
 Date:      28-May-2013
 @Param     Sender: TObject
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSSourceHelperC.ClassVariablesClick(Sender: TObject);
var
  vars: Array [1 .. 255] of rec_area;
  i: Integer;
  j: Integer;
  buf: String;
  varn: String;
  f3: String;
begin
  BCSSourceHelperPageControl1.ActivePageIndex := 1;
  ClassPageControl.ActivePageIndex := 0;
  i := 0;
  j := 1;
  Repeat
    buf := memRawClassVariables.Lines[i];
    f3 := Trim(buf);
    Delete(f3, 4, Length(f3));
    if f3 = '///' then
    begin
      vars[j].com := buf;
    end
    else
    begin
      vars[j].vari := buf;
      buf := Trim(buf);
      varn := buf;
      Delete(varn, Pos(':', varn), Length(varn));
      lbxSortedVariables.Items.Add(varn + '@' + IntToStr(j));
      Inc(j);
      vars[j].com := '';
    end;
    Inc(i);
  Until i > memRawClassVariables.Lines.Count - 1;
  i := 0;
  repeat
    buf := lbxSortedVariables.Items[i];
    Delete(buf, 1, Pos('@', buf));
    if vars[StrToInt(buf)].com > '' then
    begin
      memRestructuredClassVariables.Lines.Add(vars[StrToInt(buf)].com);
    end;
    memRestructuredClassVariables.Lines.Add(vars[StrToInt(buf)].vari);
    Inc(i);
  until i > lbxSortedVariables.Items.Count - 1;
end;

For the class variables the variable and comment are stored in a record.  The variable name and a pointer to the array of records is then passed to a sorted list box.

/// Timer for Dialog
    BCSSourceHelperTimer1: TTimer;
    /// Status Panel For Dialog
    BCSSourceHelperStatusPanel1: TStatusBar;
    /// Main Page Control
    BCSSourceHelperPageControl1: TPageControl;
    /// Tab sheet 1 for page control
    TabSheet1: TTabSheet;
    /// Tab sheet 2 for page control
    TabSheet2: TTabSheet;
    /// BCS XE3 Utilities Component
    BCSXE3UtilsCmp1: TBCSXE3UtilsCmp;
    /// BCSSourceHelper Main Menu
    BCSSourceHelperMainMenu1: TMainMenu;
    /// Help Menu Item
    Help1: TMenuItem;
    /// Raw Uses List
    memUnsorted: TMemo;
    /// Menu Item To Invoke Reformatting
    FormatUses1: TMenuItem;
    /// Sorted Uses Members Names
    memSorted: TListBox;
    /// Sorted And Formatted Uses Clause
    memSortFormated: TMemo;
    ClassPageControl: TPageControl;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    TabSheet6: TTabSheet;
    Memo1: TMemo;
    ReverseEngineerProgram1: TMenuItem;
    Class1: TMenuItem;
    C1: TMenuItem;

The variables are retrieved in order and the newly created variable list is generated.  The result are listed below.

/// BCSSourceHelper Main Menu
    BCSSourceHelperMainMenu1: TMainMenu;
    /// Main Page Control
    BCSSourceHelperPageControl1: TPageControl;
    /// Status Panel For Dialog
    BCSSourceHelperStatusPanel1: TStatusBar;
    /// Timer for Dialog
    BCSSourceHelperTimer1: TTimer;
    /// BCS XE3 Utilities Component
    BCSXE3UtilsCmp1: TBCSXE3UtilsCmp;
    C1: TMenuItem;
    Class1: TMenuItem;
    ClassPageControl: TPageControl;
    /// Menu Item To Invoke Reformatting
    FormatUses1: TMenuItem;
    /// Help Menu Item
    Help1: TMenuItem;
    Memo1: TMemo;
    /// Sorted Uses Members Names
    memSorted: TListBox;
    /// Sorted And Formatted Uses Clause
    memSortFormated: TMemo;
    /// Raw Uses List
    memUnsorted: TMemo;
    PrivateDeclarations1: TMenuItem;
    Procedures1: TMenuItem;
    PublicDeclarations1: TMenuItem;
    ReverseEngineerProgram1: TMenuItem;
    /// Tab sheet 1 for page control
    TabSheet1: TTabSheet;
    /// Tab sheet 2 for page control
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    TabSheet6: TTabSheet;

The process will continue with the remaining sections.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Flash Builder 4.5 Tutorial Offline

The Flash Builder 4.5 seem to be an awesome tool. Getting around the tutorials for FB 4.5 leaves quite a bit of room for improvement.

If you happen to be bandwidth challenged (slow internet connection) the current configuration is a constant source of frustration.

I have captured all the videos and tutorials http://archbrooks.com/fbtut/fbtut.zip . The videos were converted to mp4 and the tutorial pages were converted to pdf format.

The project in nearly 835 megabytes but due to good compression I have made it fit in approximately 5.5 megabytes. The download takes about twenty minutes. Please feel free to let me know of your results at arch@archbrooks.com.

To download the tutorial via FTP ftp to account archbrooks.com. The username is x3utils and the password is “fbTutorial2!” (minus double quotes). Once logged in begin the transfer to save the the tutorial to your local hard disk.

The next task was to write an interface that makes it easy to launch either a PDF or video.

BCSFBDoc

 

 

 

 

 

 

 

 

Click on the image to gain a clearer view of the screen shot.

I used Delphi XE 3 to develop this media launcher.

Traverse the options box using the scroll thumb on the right and then left click on the video (.mp4) or the tutorial (.pdf) and magically the selected media begins to play.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS XE3 Utilities Component

The BCS XE3 Utilities component is designed to increase efficacy and eliminate code redundancy. DRY (don’t repeat yourself) is an admiral virtue for software development.

The component documentation for BCSXE3Utils can be found here.  The complete source can be found here.

Component documentation for all available components can be found here.

The Select A Directory feature allows any application using this component to select a directory or sub directory by invoking its calling sequence.

{*-----------------------------------------------------------------------------
 Procedure: btnSelDirClick
 Date:      20-May-2013
 @Param Sender TObject Primary Object For Dialog
 @Return    None
 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.btnSelDirClick(Sender: TObject);
begin
  SelADir;
  lblSelDir.Caption := DirSel;
end;
{*-----------------------------------------------------------------------------
 Procedure: SelADir
 Author:    AMB01
 Date:      20-May-2013
 @Return    String
 -----------------------------------------------------------------------------}

function TBCSXE3UtilsC.SelADir: String;
begin
  DirSel := '';
  if SDCaption = '' then
  begin
    dlgSelDir.Title := 'Select A Directory Now!';
  end
  else
  begin
    dlgSelDir.Title := SDCaption;
  end;
  if dlgSelDir.Execute then
  begin
    DirSel := IncludeTrailingPathDelimiter(dlgSelDir.FileName);
    Result := DirSel;
  end;
end;

Notice the caption of the directory selection may be changed via the SDCaption property.  The selected directory is then appended with the required trailing path delimiter so the results are ready to rock. The DirSel property has the directory that was selected.

The Get File List allows the user to retrieve a list of files after the directory is selected.  The list of files is populated in the list box and their contents are also available in the property FilRetOc.  The number of lines in the dynamic string array is contained in the property FileLen.

The invoking sequence is as follows:

{*-----------------------------------------------------------------------------
 Procedure: btnGetFileNamesClick
 Author:    AMB01
 Date:      20-May-2013
 @Param Sender TObject Primary Object For Dialog
 @Return    None
 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.btnGetFileNamesClick(Sender: TObject);
begin
  SelADir;
  FilRetOc := GetFileNames(DirSel, GetUserInput('Select File Extension',
    'Specify File Extension Now', '*.zip'));
  PopulateListBox(FilRetOc, FilLen, lbxFileLB);
  lblFileCount.Caption := FormatFloat('#,###', FilLen);
end;

The GetUserInput is a function that prompts the user for input.  Its code is listed below.

{*-----------------------------------------------------------------------------
 Procedure: GetUserInput
 Author:    AMB01
 Date:      20-May-2013
 @Param     rcap, rpro, rdef: String
 @Return    String

 -----------------------------------------------------------------------------}

function TBCSXE3UtilsC.GetUserInput(rcap, rpro, rdef: String): String;
begin
  Result := InputBox(rcap, rpro, rdef);
end;

Notice the string parameters that are passed to the InputBox routine which makes a handy portal for getting text information from the user.

The GetFileNames function populates the dynamic string array and also sets the FileLen property it the appropriate value for the contents of the dynamic string array.

{*-----------------------------------------------------------------------------
 Procedure: GetFileNames
 Author:    AMB01
 Date:      20-May-2013
 @Param     path, ext: String
 @Return    System.Types.TStringDynArray

 -----------------------------------------------------------------------------}

function TBCSXE3UtilsC.GetFileNames(path, ext: String)
  : System.Types.TStringDynArray;
var
  oc: TStringDynArray;
begin
  oc := TDirectory.GetFiles(path, ext, TSearchOption.soAllDirectories);
  FilLen := Length(oc);
  Result := oc;
end;

There is code block used here that uses a dynamic string array to populate the list box.  The procedure name is PopulateListBox.  The code for PopulateListBox follows below.

 

{*----------------------------------------------------------------------------- Procedure: PopulateListBox Author: AMB01 Date: 20-May-2013 @Param ai: TStringDynArray; incnt: Integer; var lbx: TListBox @Return None   -----------------------------------------------------------------------------}   procedure TBCSXE3UtilsC.PopulateListBox(ai: TStringDynArray; incnt: Integer; var lbx: TListBox); var i: Integer; begin lbx.Items.Clear; i := 0; Repeat lbx.Items.Add(ai[i]); Inc(i) Until (i > (incnt - 1)); end;

 

When you click on a file in the list box the shell execute API in invoked and any associated application is launched for that file.  As an example if the file extension is .docx then Microsoft Word would stat up and the clicked on file would appear in word for further processing and editing.

The code for the shell execute API is listed below.

{*-----------------------------------------------------------------------------
 Procedure: lbxFileLBClick
 Author:    AMB01
 Date:      20-May-2013
 @Param     Sender: TObject
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.lbxFileLBClick(Sender: TObject);
begin
  XQTPgm(lbxFileLB.Items[lbxFileLB.ItemIndex]);
end;

As you can see any command in the form of a string can be passed to the XQTPgm routine and that command will be invoked immediately.

The code for XQTPgm is listed below.

 

{*-----------------------------------------------------------------------------
 Procedure: XQTPgm
 Author:    AMB01
 Date:      20-May-2013
 @Param     cmd: string
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.XQTPgm(cmd: string);
begin
  ShellAPI.ShellExecute(Handle, PWideChar('open'), PWideChar(cmd), '',
    PWideChar(XQTDir), sw_Normal);
end;

If the program requires a execute from a specific directory the XQTDir parameter should be set prior to calling XQTPgm.  To set and clear the XQTDir property use the SetXQTDir and ClearXQTDir procedures respectively.  Of course SetXQTDir uses the SelADir function that was discussed earlier.

The get directories function is listed below.

{*-----------------------------------------------------------------------------
 Procedure: btnGetDirsClick
 Author:    AMB01
 Date:      20-May-2013
 @Param Sender TObject Primary Object For Dialog
 @Return    None
 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.btnGetDirsClick(Sender: TObject);
begin
  lbxDirLB.Items.Clear;
  SelADir;
  DirRetOc := GetDirs(DirSel);
  PopulateListBox(DirRetOc, DirLen, lbxDirLB);
  lblDirCount.Caption := FormatFloat('#,###', DirLen);
end;

As usual the SelADir function is used to get the initial directory.  Then the GetDirs function is invoked and a dynamic string array is populated with the list of directories. The DirRetOc is the property that contains the list of directories and the DirLen property contains the number of items in the dynamic string array.  Finally the directory list box is populated with the PopulateListBox function which was previously discussed.

The GetDirs function is listed below.

{*-----------------------------------------------------------------------------
 Procedure: GetDirs
 Author:    AMB01
 Date:      20-May-2013
 @Param     path: String
 @Return    System.Types.TStringDynArray

 -----------------------------------------------------------------------------}

function TBCSXE3UtilsC.GetDirs(path: String): System.Types.TStringDynArray;
var
  oc: TStringDynArray;
begin
  oc := System.IOUtils.TDirectory.GetDirectories(path);
  DirLen := Length(oc);
  Result := oc;
end;

To detect the first and last day of any given week simply click the Find First and Last Day of Week control.

The invoking procedure is listed below.

{*-----------------------------------------------------------------------------
 Procedure: btnFDowLDowClick
 Author:    AMB01
 Date:      22-May-2013
 @Param     Sender: TObject
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.btnFDowLDowClick(Sender: TObject);
begin
  hide;
  if BCSGetDateTimeCmp1.Execute then
  begin
    show;
    rdt := BCSGetDateTimeCmp1.SelDateTime;
    lblCurDateTime.Caption :=
      FormatDateTime('dddd   , mmmm    dd,yyyy hh:m:ss', rdt);
    GetFLDOW(rdt);
    lblFDow.Caption := FormatDateTime('mm/dd/yyyy', FirstDayOfWeek);
    lblLDow.Caption := FormatDateTime('mm/dd/yyyy', LastDayOfWeek);
  end;
  show;
end;

As you have noticed the BCSGetDateTimeCmp1 component allows the user to select the desired date and time.

The GetFLDOW routine performs the heave lifting and can be viewed below.

{*-----------------------------------------------------------------------------
  Procedure: GetFLDOW
  Date:      25-May-2013
  @Param     var rdt: TDateTime
  @Return    None

-----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.GetFLDOW(var rdt: TDateTime);
begin
  FirstDayOfWeek := StartOfTheWeek(rdt);
  LastDayOfWeek := EndOfTheWeek(rdt);
end;

The FirstDayOfWeek and LasDayOfWeek properties will house the first and last day of the selected week respectively.

The increment date and time function allow the user to traverse dates and times my increments of months, days, years, hours, minutes and seconds. First the user is prompted to provide the increment values. A negative value will move the date and time to a date and time in the past. Positive values will yield a date in the future. Finally a starting date and time via the BCS Get Date And Time Component must be selected. The calculation commence with the date is selected. The date selected and the newly created date are readily visible for review.

{*-----------------------------------------------------------------------------
 Procedure: btnIncDateTimeClick
 Date:      26-May-2013
 @Param     Sender: TObject
 @Return    None

 -----------------------------------------------------------------------------}

procedure TBCSXE3UtilsC.btnIncDateTimeClick(Sender: TObject);
var
  rdt : TDateTime;
begin
  hide;
  if BCSGetDateTimeCmp1.Execute then
  begin
    show;
    rdt := BCSGetDateTimeCmp1.SelDateTime;
    ReportDateTime(lblInitDate, rdt);
    rdt := IncMonth(rdt, StrToInt(edtMonths.Text));
    edtMonths.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
    rdt := IncDay(rdt, StrToInt(edtDays.Text));
    edtDays.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
    rdt := IncYear(rdt, StrToInt(edtYears.Text));
    edtYears.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
    rdt := IncHour(rdt, StrToInt(edtHours.Text));
    edtHours.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
    rdt := IncMinute(rdt, StrToInt(edtMinutes.Text));
    edtMinutes.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
    rdt := IncSecond(rdt, StrToInt(edtSeconds.Text));
    edtSeconds.Text := '0';
    ReportDateTime(lblAfterAdd, rdt);
  end;
  show;
end;

These routine are prepared to demonstrate capabilities and to serve as a baseline documentation for utilizing many of the new facilities in Delphi XE3.

Modifications will be made to this component as new requirements are called for through further application development.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS XE3 Application Launch

This application uses the command language interpreter. Any and all registered applications will function normally when launched by this application.

When the user presents the launcher with a word document the MS Word Application is invoked. When the user presents the launcher with a PDF file specification the associated PDF reader is launched.

This application may also be used to launch any installed executable application available system wide.

The source code can be found here. The component documentation can be found here.


Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.