How To…Create a Custom Query Designer

Question

“How do I replace the existing query designer with a custom one of my own?”

Solution

Use the built-in dialog replacement architecture to create and register your own query designer. Start by copying the existing code located in the daQueryDesigner.pas file and renaming the class and file name.  You will also need to create a custom Query Dataview to be used with the query designer.  See the example below for an implementation of this.  Finally inside the initialization and finalization section, unregister the old designer and  register the new designer.

Download: CustomQueryDesigner.zip

Sample Delphi code:

Query Designer:

initialization

  daUnRegisterWizard(TdaQueryDesigner);
  daRegisterWizard(TmyQueryDesigner);

finalization

  daUnRegisterWizard(TmyQueryDesigner);

Query DataView:

initialization
    daUnRegisterDataView(TdaBDEQueryDataView);
    daRegisterDataView(TmyQueryDataView);

finalization
    daUnRegisterDataView(TmyQueryDataView);


end.