GpStructuredStorage file    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~sqli.vtd" sqliForm.vtdLsqliFormName.vtd. sqliStep.vtdI%sqliStepFile.vtd8sqliStepStr.vtd6sqliStepStrEvent.vtd sqliVar.vtd sqliVer.vtdsqliReports.vtdacKeyacNamed acIsDebugacType acVarInINI acAutoStart acAutoClose acEndMessageacLocalization2acFormNameAuthoracActive anVersion acLogType acInstCoded anUserChg anUserIns adTimeChg adTimeIns acNoteacCompiledScriptDEMO004Attachments to DPAFAFFFTRT0 VBB acKey acFormName2 acDocType acObjectName2acType acKeyShortCut2acTabSheetName2 anUserChg anUserIns adTimeChg adTimeIns acFormTypeDEMO004AresEditPCDGBGB3 acFormName2acName2acKeyanNoacViewacSetOfacDescracReportacFileCreateTableanFileDelimiter acFileNameacFileTableName acFileDest acFileType acFileTypeXML acShowIfEmptyacTitleButtons anTitleLinesanBeginFromRecord anUserChg anUserIns adTimeChg adTimeIns acCharSet2 acStyleSheet acUnitName2 acNewThreadacDFMacPAS acSQLExport2acSQLExpacNoteDEMO004GPFAENFcBLGB windows-1250 AresProjectFProgram AresProject; uses sysutils, classes, forms, dialogs, dlcomponents; begin //this is one way, how we can find "master" datasource, which //we will need to create master detail dataset if OwnerForm <> nil then begin if OwnerForm.FindComponent('bMenuDBNavigator') <> nil then begin //Showmessage(TNavigator3(OwnerForm.FindComponent('bMenuDBNavigator')).datasource.name); end; end; end. DEMO004GFFAENFN BLGB windows-1250FForm1Fobject Form1: TForm Tag = 99 Left = 510 Top = 240 Caption = 'Attachments' ClientHeight = 246 ClientWidth = 450 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poDesigned PixelsPerInch = 96 TextHeight = 13 object GrAttachments: TcxGrid Left = 0 Top = 41 Width = 450 Height = 205 Align = alClient TabOrder = 0 LookAndFeel.Kind = lfOffice11 object GrAttachmentsDBTableView1: TcxGridDBTableView NavigatorButtons.ConfirmDelete = False DataController.DataSource = DataSource1 DataController.Summary.DefaultGroupSummaryItems = <> DataController.Summary.FooterSummaryItems = <> DataController.Summary.SummaryGroups = <> OptionsData.Inserting = False OptionsView.NoDataToDisplayInfoText = '' OptionsView.ColumnAutoWidth = True OptionsView.GroupByBox = False object GrAttachmentsDBTableView1Column4: TcxGridDBColumn DataBinding.FieldName = 'anNo' Options.Editing = False SortIndex = 0 SortOrder = soAscending Width = 34 end object GrAttachmentsDBTableView1Column1: TcxGridDBColumn Caption = 'Description' DataBinding.FieldName = 'acDescr' Width = 251 end object GrAttachmentsDBTableView1Column2: TcxGridDBColumn DataBinding.FieldName = 'acSetOf' Visible = False Width = 52 end object GrAttachmentsDBTableView1Column3: TcxGridDBColumn Caption = 'Filename' DataBinding.FieldName = 'acNote' Options.Editing = False Width = 163 end end object GrAttachmentsLevel1: TcxGridLevel GridView = GrAttachmentsDBTableView1 end end object dlcxPanel1: TdlcxPanel Left = 0 Top = 0 Width = 450 Height = 41 Align = alTop Alignment = taLeftJustify BorderStyle = bsNone BorderSize = 1 BorderColor3D = clWhite Border3D = False BorderColor = clGray Color = 15065304 ColorTo = 15065304 ComponentSize = csSmall Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] Options = [] ParentColor = False PanelType = ptNone TabOrder = 1 Templatable = False Transparent = False HeaderVisible = False HeaderColor = 15065304 HeaderColorTo = 15065304 HeaderHeight = 0 HeaderFont.Charset = DEFAULT_CHARSET HeaderFont.Color = clWindowText HeaderFont.Height = -11 HeaderFont.Name = 'Tahoma' HeaderFont.Style = [] HeaderAlignment = taLeftJustify HeaderPanelType = ptNone HotColor = clBlack HotColorTo = clBlack CheckedColor = clBlack CheckedColorTo = clBlack Checked = False object dlcxButton1: TdlcxButton Left = 6 Top = 7 Width = 75 Height = 25 Cancel = False Caption = 'Add...' ComponentSize = csSmall Templatable = False Default = False ModalResult = 0 TabOrder = 0 ImmediatePopUp = False end object dlcxButton2: TdlcxButton Left = 262 Top = 7 Width = 75 Height = 25 Cancel = False Caption = 'dlcxButton2' ComponentSize = csSmall Templatable = False Default = False ModalResult = 0 TabOrder = 1 ImmediatePopUp = False end end object _evsaver: TEventCom events = 'dlcxButton1.OnClick=dlcxButton1Click'#13#10'dlcxButton2.OnClick=dlcxBu' + 'tton2Click'#13#10'DsAttach.BeforeInsert=DsAttachBeforeInsert'#13#10 end object DataSource1: TDataSource DataSet = DsAttach Left = 151 Top = 6 end object DsAttach: TdlDataset SQL.Strings = ( 'select * from tpa_sqliStep where acKey like :acKey and acSetOf l' + 'ike '#39'A'#39) MasterFields = 'acKey' AutoCalcFields = False Cached = False LocateInsert = False Editable = True RequestLive = False QueryRecCount = False DetailDelay = 0 LocalMasterDetail = False StrictUpdate = False TrimFixedChar = True TrimVarChar = True AddRowidToSQL = False ORACompatibility = True Left = 183 Top = 7 ParamData = < item DataType = ftUnknown Name = 'acKey' end> end end Unit FForm1; { On Grid we set OptionsView.NoDatataToDisplay to ''; We disable inserting in grid, but we permit deleting. } interface uses Forms, Controls, StdCtrls, SysUtils, Classes, Graphics, dlcomponents, Dialogs, cxGrid, db, dlDatabase; type TForm1 = class(TarForm) GrAttachments: TcxGrid; GrAttachmentsDBTableView1: TcxGridDBTableView; GrAttachmentsLevel1: TcxGridLevel; DataSource1: TDataSource; DsAttach: TdlDataset; dlcxPanel1: TdlcxPanel; dlcxButton1: TdlcxButton; GrAttachmentsDBTableView1Column1: TcxGridDBColumn; GrAttachmentsDBTableView1Column2: TcxGridDBColumn; GrAttachmentsDBTableView1Column3: TcxGridDBColumn; GrAttachmentsDBTableView1Column4: TcxGridDBColumn; dlcxButton2: TdlcxButton; procedure DsAttachBeforeInsert(DataSet: TDataSet); procedure dlcxButton2Click(Sender: TObject); procedure dlcxButton1Click(Sender: TObject); private public constructor Create(AOwner: TComponent); override; end; var Form1: TForm1; implementation constructor TForm1.Create(AOwner: TComponent); begin inherited Create(AOwner); ares.AssignObjectsToForm('FForm1',Self); GrAttachments := FindComponent('GrAttachments'); GrAttachmentsDBTableView1 := FindComponent('GrAttachmentsDBTableView1'); GrAttachmentsLevel1 := FindComponent('GrAttachmentsLevel1'); DataSource1 := FindComponent('DataSource1'); DsAttach := FindComponent('DsAttach'); dlcxPanel1 := FindComponent('dlcxPanel1'); dlcxButton1 := FindComponent('dlcxButton1'); GrAttachmentsDBTableView1Column1 := FindComponent('GrAttachmentsDBTableView1Column1'); GrAttachmentsDBTableView1Column2 := FindComponent('GrAttachmentsDBTableView1Column2'); GrAttachmentsDBTableView1Column3 := FindComponent('GrAttachmentsDBTableView1Column3'); GrAttachmentsDBTableView1Column4 := FindComponent('GrAttachmentsDBTableView1Column4'); dlcxButton2 := FindComponent('dlcxButton2'); DsAttach.BeforeInsert := DsAttachBeforeInsert; dlcxButton2.OnClick := dlcxButton2Click; dlcxButton1.OnClick := dlcxButton1Click; //this is way how we can create master/detail relationship. We can also do it visualy //but non-visual is prefered way if OwnerForm <> nil then DsAttach.MasterSource := TDataSource(OwnerForm.FindComponent('dsSQLi')); //we should allways manualy open dataset DsAttach.open; end; procedure TForm1.dlcxButton1Click(Sender: TObject); var od: TOpenDialog; acKey: string; begin //we create open dialog od := TOpenDialog.create(nil); try if od.execute then begin DsAttach.Insert; // acKey := DsAttach.MasterSource.Dataset.FieldByName('acKey').asString; // DsAttach.FieldByName('acKey').asString := acKey; // DsAttach.FieldByName('acSetOf').asString := 'A'; // DsAttach.FieldByName('anNo').asInteger := DBGetIntValue('select max(anNo) from tpa_sqliStep where acKey like '+QuotedStr(ackey))+1; // DsAttach.FieldByName('acNote').asString := od.FileName; // TBlobField(DsAttach.FieldByName('acSQLExp')).loadFromFile(od.FileName); // DsAttach.post; end; finally od.free; end; end; procedure TForm1.dlcxButton2Click(Sender: TObject); begin DsAttach.cancel; end; procedure TForm1.DsAttachBeforeInsert(DataSet: TDataSet); begin Dataset.cancel; end; end. acKeyanNoanSeqNoacHField2acHType anHLengthanHDecacPField2acPTypeanPLegthanPDec acPFormat acPSeparator anUserChg anUserIns adTimeChg adTimeIns acKeyanNoanSeqNo acFieldName2 anFieldSize acFieldTitleacFieldReadOnly acEditType acFieldConst anUserChg anUserIns adTimeIns adTimeChg acFieldFormatacFieldDefault acKeyanNo acDataEventacDataReturnValue acKeyAndNo anUserChg anUserIns adTimeChg adTimeIns acKey acWhereKeyanNo acFieldName acParamVar acFieldType acFieldREQacFieldCaption2 acDefaultExpacDefaultValue acLookUpSQL acOperator acVarHint2 acAddApostrof anUserChg anUserIns adTimeChg adTimeIns acPrtCrit ACKEY ANVERSIONANNOACSQLEXPACNOTE ADTIMECHG ANUSERCHG ADTIMEINS ANUSERINSacReportacLangIdacLocalization2 acFormNamedacNamedacDefaultPrinter acPreviewanMaxPrStLevelacSubstituteSignacPrintIfEmpty acPrintToText anNoOfCopy acOrderBy acRegUserCodeacActive acKeyShortCut2 anUserIns adTimeIns anUserChg adTimeChg acText1acText2acText3acNote acReportData