BCS Tidy Menu Items

The menu system contains numerous entries and this section of BCS Tidy orders those entries in ascending alphabetical sequence.

tim01

The input appears below.

{*-----------------------------------------------------------------------------
 Procedure: OnMenuClick
 Author:    Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC
 Date:      04-May-2016
 @Param     Sender: TObject
 @Return    None
 -----------------------------------------------------------------------------}
procedure TBCSMenu.OnMenuClick(Sender: TObject);
var
  buf: string;
  x: Integer;
begin
  With Sender as TMenuItem do
  begin
    buf := name;
    buf := buf;
  end;
  if buf = 'muiExit' then
  begin
    BCSMenuc.Close;
  end;
  if buf = 'muiGenMenuItem' then
  begin
    cgeMenuItem;
    buf := buf;
  end;
  if buf = 'muiGenMenuClick' then
  begin
    cgeMenuXqt;
    buf := buf;
  end;
  if buf = 'muiPutExeToClipboard' then
  begin
    cgeGenXQT;
  end;
  if buf = 'muiCallProcedure' then
  begin
    cgeCallProc;
    buf := buf;
  end;
  if buf = 'muiProcedureDefinition' then
  begin
    cgeProcDef;
    buf := buf;
  end;
  if buf = 'muiProcedureBlock' then
  begin
    cgeProcBlock;
    buf := buf;
  end;
 
  if buf = 'muiFonts' then
  begin
    dlgFont.Execute(BCSMenuc.Handle);
    defFont := dlgFont.Font;
    for x := 0 to (BCSMenuc.ComponentCount - 1) do
    begin
      if (BCSMenuc.Components[x] is TDBEdit) or
        (BCSMenuc.Components[x] is TDBGrid) or (BCSMenuc.Components[x] is TDBMemo)
        or (BCSMenuc.Components[x] is TDBText) or
        (BCSMenuc.Components[x] is TComboBox) or (BCSMenuc.Components[x] is TEdit)
        or (BCSMenuc.Components[x] is TLabel) or
        (BCSMenuc.Components[x] is TListBox) or (BCSMenuc.Components[x] is TMemo)
      then
        TButton(BCSMenuc.Components[x]).Font := defFont;
    end;
  end;
  if buf = 'muiColors' then
  begin
    dlgColors.Execute(BCSMenuc.Handle);
    defColor := dlgColors.Color;
  end;
  if buf = 'muiHelp' then
  begin
    XQT('http://bcsjava.com/doc/app/BCS%20BCSMenu%20Base%20Dialog.htm', '', '');
  end;
  if buf = 'muiStyles' then
  begin
    frm001c.frmShowModal
  end;
end;

The sorted output is listed below.

{*-----------------------------------------------------------------------------
 Procedure: OnMenuClick
 Author:    Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC
 Date:      04-May-2016
 @Param     Sender: TObject
 @Return    None
 -----------------------------------------------------------------------------}
procedure TBCSMenu.OnMenuClick(Sender: TObject);
var
  buf: string;
  x: Integer;
begin
  With Sender as TMenuItem do
  begin
    buf := name;
    buf := buf;
  end;
  if buf = 'muiCallProcedure' then
  begin
    cgeCallProc;
    buf := buf;
  end;
  if buf = 'muiColors' then
  begin
    dlgColors.Execute(BCSMenuc.Handle);
    defColor := dlgColors.Color;
  end;
  if buf = 'muiExit' then
  begin
    BCSMenuc.Close;
  end;
  if buf = 'muiFonts' then
  begin
    dlgFont.Execute(BCSMenuc.Handle);
    defFont := dlgFont.Font;
    for x := 0 to (BCSMenuc.ComponentCount - 1) do
    begin
      if (BCSMenuc.Components[x] is TDBEdit) or
        (BCSMenuc.Components[x] is TDBGrid) or (BCSMenuc.Components[x] is TDBMemo)
        or (BCSMenuc.Components[x] is TDBText) or
        (BCSMenuc.Components[x] is TComboBox) or (BCSMenuc.Components[x] is TEdit)
        or (BCSMenuc.Components[x] is TLabel) or
        (BCSMenuc.Components[x] is TListBox) or (BCSMenuc.Components[x] is TMemo)
      then
        TButton(BCSMenuc.Components[x]).Font := defFont;
    end;
  end;
  if buf = 'muiGenMenuClick' then
  begin
    cgeMenuXqt;
    buf := buf;
  end;
  if buf = 'muiGenMenuItem' then
  begin
    cgeMenuItem;
    buf := buf;
  end;
  if buf = 'muiHelp' then
  begin
    XQT('http://bcsjava.com/doc/app/BCS%20BCSMenu%20Base%20Dialog.htm', '', '');
  end;
  if buf = 'muiProcedureBlock' then
  begin
    cgeProcBlock;
    buf := buf;
  end;
 
  if buf = 'muiProcedureDefinition' then
  begin
    cgeProcDef;
    buf := buf;
  end;
  if buf = 'muiPutExeToClipboard' then
  begin
    cgeGenXQT;
  end;
  if buf = 'muiStyles' then
  begin
    frm001c.frmShowModal
  end;
end;

 

 

A 32-bit executable program may be downloaded by clicking here.
A 64-bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

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

BCS Tidy Class Sort

The BCS Tidy Application has a utility to sort the Delphi class.

cla01

The unsorted class is represented below.

/// Main Class
  Tfrm017 = class(TCustomForm)
 
  private
    procedure estMainMenu;
    procedure estStatus(pan1, pan2, int: Integer);
    procedure estWindow(top, width, height: Integer; Caption: string);
    procedure OnMenuClick(Sender: TObject);
    procedure OnTimer(Sender: TObject);
    procedure XQT(cmd, parm, defPath: string);
    procedure btnSaveClick(Sender: TObject);
    procedure btnClick(Sender: TObject);
    procedure WebBrowser1DocumentComplete(ASender: TObject;
      const pDisp: IDispatch; const rURL: OleVariant);
    procedure URLClick(Sender: TObject);
    procedure URLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure broNavigateComplete2(ASender: TObject; const pDisp: IDispatch;
      const URL: OleVariant);
 
  public
    procedure WebBrowser1DocumentComplete(ASender: TObject;
      const pDisp: IDispatch; const rURL: OleVariant);
    procedure frmShowModal();
    procedure broNavigateComplete2(ASender: TObject; const pDisp: IDispatch;
      const URL: OleVariant);
 
  end;

The re-ordered class statement appears below.

/// Main Class
  Tfrm017 = class(TCustomForm)
 
  private
    procedure broNavigateComplete2(ASender: TObject; const pDisp: IDispatch;
      const URL: OleVariant);
    procedure btnClick(Sender: TObject);
    procedure btnSaveClick(Sender: TObject);
    procedure estMainMenu;
    procedure estStatus(pan1, pan2, int: Integer);
    procedure estWindow(top, width, height: Integer; Caption: string);
    procedure OnMenuClick(Sender: TObject);
    procedure OnTimer(Sender: TObject);
    procedure URLClick(Sender: TObject);
    procedure URLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure WebBrowser1DocumentComplete(ASender: TObject;
      const pDisp: IDispatch; const rURL: OleVariant);
      const URL: OleVariant);
 
  public
    procedure broNavigateComplete2(ASender: TObject; const pDisp: IDispatch;
      const URL: OleVariant);
    procedure frmShowModal();
    procedure WebBrowser1DocumentComplete(ASender: TObject;
      const URL: OleVariant);
 
  end;

The ordering of the class is accomplished by collecting the associated blocks of code and providing a mechanism to sort procedure name in an ascending alphabetical sequence and merge the results (in place) to the Delphi source code.  This is accomplished by using sorted string lists.

A 32-bit executable program may be downloaded by clicking here.
A 64-bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

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

BCS Tidy Format Uses Statements

The BCS Tidy project is an ongoing effort to develop a source code restructuring application.  This particular utility sorts and reformats uses statements.

The unsorted uses statement is shown below.

uses frm001u, Graphics, SHDocVw, System.Classes, System.Types,
  System.IOUtils,
  Vcl.Buttons, Vcl.Controls, Vcl.ComCtrls, Vcl.DBCtrls, Vcl.DBGrids,
  Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Forms, Vcl.Menus, Vcl.StdCtrls, SysUtils,
  Winapi.ActiveX, Winapi.ShellAPI, Winapi.Windows, Winapi.Messages;

When the application is invoked the output uses statement appears below.

uses frm001u, Graphics, SHDocVw, System.Classes, System.IOUtils, System.Types, 
  SysUtils,Vcl.Buttons, Vcl.ComCtrls, Vcl.Controls, Vcl.DBCtrls, Vcl.DBGrids, 
  Vcl.Dialogs,Vcl.ExtCtrls, Vcl.Forms, Vcl.Menus, Vcl.StdCtrls, Winapi.ActiveX, 
  Winapi.Messages,Winapi.ShellAPI, Winapi.Windows;

This utility can be used for any Delphi source code uses statement.

A 32-bit executable program may be downloaded by clicking here.
A 64-bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

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

BCS Remove Info Stored On DVD

When information is successfully stored on a DVD that information no longer needs to exist on the hard disk.  This application removes that content.

dfd01

You may initially desire to identify which DVD device as  the subject of subsequent operations.  The following dialog will appear.

dfd02

The normal process is initiated when the Check DVD option is invoked.

dfd03

The selected directory is used for further queries.  When identical folders are found the folders residing on the hard disk are removed.

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

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