Link to home
Start Free TrialLog in
Avatar of Connie McBride
Connie McBride

asked on

How to Debug DELPHI IDE?

I am trying to debug a custom component by using delphi to do it.

using : Delphi Tokyo 10.2.2, Windows 7.



this is my component source:

unit pvDBLookupCombo;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, System.UITypes,
  RTLConsts,
  cxControls, cxContainer,
  cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, strUtils, variants
  , Data.DB;

type

  TProVDBLookupEditProperties = class(TcxLookupComboBoxProperties)
  private
       fSearchSQL : tStringList;
  public
    constructor Create(AOwner: TPersistent); override;
  published
     property ClearKey default 27;
     property GridMode default true;
     property ImmediatePost default True;
     property ValidationOptions default [evoRaiseException, evoShowErrorIcon];
    property SQL : tStringList read fSearchSQL write fSearchSQL;
  end;

  TProVDBLookupComboBox = class(TcxDBLookupComboBox)
  private
    { Private declarations }
//     FSearchKind: TSearchKind;
     fIsRequired : boolean;
     fSearchDataSource : tDataSource;

  protected
    { Protected declarations }
//    procedure DoOnNewLookupDisplayText(const AText: string);override;
  public
    { Public declarations }
      constructor Create(AOwner: TComponent); override;
      class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
  published
    { Published declarations }
    //property searchKind : tSearchKind read fSearchKind write fSearchKind;
    property isRequired : boolean read fIsRequired write fIsRequired default false;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Provantage', [TProVDBLookupComboBox]);
end;
class function tProvDBLookupComboBox.GetPropertiesClass: TcxCustomEditPropertiesClass;
begin
  Result := TProVDBLookupEditProperties;
end;
constructor tProvDBLookupComboBox.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);
end;
constructor TProVDBLookupEditProperties.Create(AOwner: TPersistent);
begin
  inherited Create(AOwner);
   FSearchSQL := tStringList.Create;
end;


//procedure tProvDBLookupComboBox.doOnNewLookupDisplayText(const aText : string);
//var
//  aValue : string;
//  cString : string;
//  aFilter : string;
//begin
//   cString := aText;
//   if (cString = '*') or
//      (cString = '') and
//      (SearchKind <> wsDummy) then
//   begin
//      aValue := RegProvider.getRegValue('ProVantageSuite', 'Search', '', 'LastSearch' + searchTypeToString(SearchKind));
//      text := aValue;
//   end
//   else
//   if (cString <> '?') and
//      (containsText(cString, '?')) then
//   begin
//      aFilter := Properties.ListFieldNames + ' like ' + quotedStr(replaceStr(cString, '?', '%'));
//      Properties.ListSource.DataSet.Filter := aFilter;
//      Properties.ListSource.DataSet.Filtered := true;
//      DroppedDown := true;
//      if not properties.ListSource.Dataset.IsEmpty then
//      begin
//         if ((aText <> '?') and (aText <> '') and (aText <> '*')) then
//            RegProvider.setRegValue('ProVantageSuite', 'Search', '', 'LastSearch' + searchTypeToString(SearchKind), aText);
//      end;
//   end
//   else
//   begin
//      Properties.ListSource.DataSet.Filtered := false;
//      droppedDown := true;
//   end;
//end;
end.

Open in new window


in design time, I add the component to a form, then attempt to change the SQL.
the first time, it works:
User generated imageafter that, it blows up:
User generated image

so, I'm trying to track it down by debugging the component  (cause obviously, I've missed something)

on my package project, I have it set to this:
User generated image
but the second instance of Delphi is only 'flashing' the splash screen.  no error messages, and no delphi

my build options:
User generated image
package options:
User generated image
Avatar of Geert G
Geert G
Flag of Belgium image

destructor is missing
> frees the fSearchSQL

you shouldn't need a write on that SQL property
the contents of the object changes, not the object itself
what are you trying to accomplisch ?
Avatar of Connie McBride
Connie McBride

ASKER

I am trying to work out how to debug my custom, in house components, in Delphi itself, because sometimes, it 'goes bad' and I need to work out 'where' -
for example, when I close delphi and I get an access violation when the component is freed or something.
I've tried setting the host application to delphi, but that didn't work, it's not starting the second instance of delphi, I just get a quick flash of the startup splash screen.
my latest iteration.
it still will not work in Delphi.
it won't allow me to change the FSQL property.
unit pvDBLookupCombo;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, System.UITypes,
  RTLConsts,
  cxControls, cxContainer,
  cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, strUtils, variants
  , Data.DB;

type

  TProVDBLookupEditProperties = class(TcxLookupComboBoxProperties)
  private
       fSearchSQL : tStringList;
       function getSQL : tStringList;
  public
    constructor Create(AOwner: TPersistent); override;
    destructor Destroy;override;

  published
    property SQL : tStringList read getSQL write fSearchSQL;
  end;

  TProVDBLookupComboBox = class(TcxDBLookupComboBox)
  private
    { Private declarations }
     fIsRequired : boolean;
     fSearchDataSource : tDataSource;

  protected
    { Protected declarations }
//    procedure DoOnNewLookupDisplayText(const AText: string);override;
  public
    { Public declarations }
      constructor Create(AOwner: TComponent); override;
      class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
  published
    { Published declarations }
    property isRequired : boolean read fIsRequired write fIsRequired default false;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Provantage', [TProVDBLookupComboBox]);
end;
class function tProvDBLookupComboBox.GetPropertiesClass: TcxCustomEditPropertiesClass;
begin
  Result := TProVDBLookupEditProperties;
end;
constructor tProvDBLookupComboBox.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);
end;
constructor TProVDBLookupEditProperties.Create(AOwner: TPersistent);
begin
  inherited Create(AOwner);
   FSearchSQL := tStringList.Create;
end;
destructor TProVDBLookupEditProperties.Destroy;
begin
   freeAndNil(FSearchSQL);
   inherited destroy;
end;

function TProVDBLookupEditProperties.getSQL : tStringList;
begin
   if fSearchSQL = nil then
      fSearchSQL := tStringList.Create;
   result := fSearchSQL;
end;

//procedure tProvDBLookupComboBox.doOnNewLookupDisplayText(const aText : string);
//var
//  aValue : string;
//  cString : string;
//  aFilter : string;
//begin
//   doSearch here
//end;
end.

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Connie McBride
Connie McBride

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial