From: Peter T. <pe...@us...> - 2003-06-22 10:09:45
|
Update of /cvsroot/jvcl/dev/JVCL3/design In directory sc8-pr-cvs1:/tmp/cvs-serv14366/JVCL3/design Modified Files: JvStdCtrlsReg.pas JvSystemReg.pas Added Files: JvPageLinkEditor.dfm JvPageLinkEditor.pas JvPageListTreeViewReg.pas JvPreviewReg.pas JvTreeItemsEditor.dfm JvTreeItemsEditor.pas JvValidateEditReg.pas JvValidatorsEditor.dfm JvValidatorsEditor.pas JvValidatorsReg.pas Log Message: - Added validators and error providers - Added print preview components - Added page components and .NET style treeview - Added a treeview with checkbox and radiobutton support --- NEW FILE: JvPageLinkEditor.dfm --- object frmJvTreeViewLinksEditor: TfrmJvTreeViewLinksEditor Left = 294 Top = 184 Width = 472 Height = 267 ActiveControl = tvItems BorderIcons = [biSystemMenu] Caption = 'JvTreeViewLinks Editor' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False PopupMenu = popTree OnResize = FormResize PixelsPerInch = 96 TextHeight = 13 object Bevel1: TBevel Left = 0 Top = 198 Width = 464 Height = 42 Align = alBottom Shape = bsTopLine end object Splitter1: TSplitter Left = 163 Top = 0 Width = 3 Height = 198 Cursor = crHSplit AutoSnap = False end object Splitter2: TSplitter Left = 268 Top = 0 Width = 3 Height = 198 Cursor = crHSplit AutoSnap = False end object pnlLeft: TPanel Left = 0 Top = 0 Width = 163 Height = 198 Align = alLeft BevelOuter = bvNone BorderWidth = 4 TabOrder = 0 object Label1: TLabel Left = 4 Top = 4 Width = 155 Height = 16 Align = alTop AutoSize = False Caption = '&Nodes:' FocusControl = tvItems Layout = tlCenter end object tvItems: TTreeView Left = 4 Top = 20 Width = 155 Height = 174 Align = alClient ChangeDelay = 60 HideSelection = False Indent = 19 PopupMenu = popTree ReadOnly = True ShowButtons = False ShowLines = False TabOrder = 0 ToolTips = False OnChange = tvItemsChange end end object btnOK: TButton Left = 285 Top = 207 Width = 75 Height = 25 Anchors = [akRight, akBottom] Caption = '&OK' ModalResult = 1 TabOrder = 3 end object btnCancel: TButton Left = 373 Top = 207 Width = 75 Height = 25 Anchors = [akRight, akBottom] Caption = '&Cancel' ModalResult = 2 TabOrder = 4 end object pnlMid: TPanel Left = 166 Top = 0 Width = 102 Height = 198 Align = alLeft BevelOuter = bvNone TabOrder = 1 object btnLink: TButton Left = 5 Top = 24 Width = 91 Height = 25 Action = acLink Anchors = [akTop] TabOrder = 0 TabStop = False end end object pnlRight: TPanel Left = 271 Top = 0 Width = 193 Height = 198 Align = alClient BevelOuter = bvNone BorderWidth = 4 Caption = 'pnlRight' TabOrder = 2 object Label2: TLabel Left = 4 Top = 4 Width = 185 Height = 17 Align = alTop AutoSize = False Caption = '&Pages:' FocusControl = lbPages Layout = tlCenter end object lbPages: TListBox Left = 4 Top = 21 Width = 185 Height = 173 Align = alClient ItemHeight = 13 TabOrder = 0 end end object acMain: TActionList OnUpdate = acMainUpdate Left = 168 Top = 64 object acLink: TAction Caption = '<- Create &Link ->' ShortCut = 16397 OnExecute = acLinkExecute end end object popTree: TPopupMenu Left = 58 Top = 72 end end --- NEW FILE: JvPageLinkEditor.pas --- {----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvPageLinkEditor.PAS, released on 2003-01-01. The Initial Developer of the Original Code is Peter Thörnqvist [pe...@pe...] . Portions created by Peter Thörnqvist are Copyright (C) 2003 Peter Thörnqvist. All Rights Reserved. Contributor(s): Last Modified: 2003-01-01 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, located at http://jvcl.sourceforge.net Known Issues: -----------------------------------------------------------------------------} {$I JVCL.INC} {$I WINDOWSONLY.INC} unit JvPageLinkEditor; { Changes: 2002-10-22: changed the way a parent/child PageIndex is assigned so that it matches the actual component using this editor } interface uses Windows, Forms, Classes, SysUtils, Controls, StdCtrls, ExtCtrls, ComCtrls, ActnList, {$IFDEF COMPILER6_UP}DesignEditors, Variants, DesignIntf, {$ELSE}DsgnIntf,{$ENDIF}JvPageListTreeView, Menus; type { a property editor for the PageLinks property of TJvCustomPageListTreeView} TJvPageLinksProperty = class(TClassProperty) public function GetAttributes: TPropertyAttributes; override; procedure Edit; override; end; TfrmJvTreeViewLinksEditor = class(TForm) tvItems: TTreeView; btnLink: TButton; lbPages: TListBox; acMain: TActionList; acLink: TAction; Label1: TLabel; Label2: TLabel; btnOK: TButton; btnCancel: TButton; Bevel1: TBevel; pnlLeft: TPanel; pnlMid: TPanel; pnlRight: TPanel; popTree: TPopupMenu; Splitter1: TSplitter; Splitter2: TSplitter; procedure tvItemsChange(Sender: TObject; Node: TTreeNode); procedure acLinkExecute(Sender: TObject); procedure acMainUpdate(Action: TBasicAction; var Handled: Boolean); procedure FormResize(Sender: TObject); private { Private declarations } FTreeView:TCustomTreeView; procedure CreatePopUpItem(Index: integer); procedure DoPopClick(Sender: TObject); procedure AssignComponents(TreeView: TCustomTreeView; const PageList: IPageList); procedure AssignToComponents(TreeView: TCustomTreeView; const PageList: IPageList); public { Public declarations } class function Edit(TreeView: TCustomTreeView; const PageList: IPageList): boolean; end; procedure ShowPageLinkEditor(TreeView:TJvCustomPageListTreeView); implementation type THackTreeView = class(TJvCustomPageListTreeView); { TJvPageLinksProperty } procedure ShowPageLinkEditor(TreeView:TJvCustomPageListTreeView); begin if TfrmJvTreeViewLinksEditor.Edit(TreeView, {$IFDEF COMPILER6_UP}TreeView.PageList{$ELSE}TreeView.PageListIntf{$ENDIF}) and (THackTreeView(TreeView).Items.Count > 0) then THackTreeView(TreeView).Items.GetFirstNode.Expand(false); end; procedure TJvPageLinksProperty.Edit; begin ShowPageLinkEditor(GetComponent(0) as TJvCustomPageListTreeView); end; function TJvPageLinksProperty.GetAttributes: TPropertyAttributes; begin Result := [paDialog, paReadOnly]; end; {$R *.dfm} function GetStrippedText(const AText: string): string; var i: integer; begin Result := AText; for i := Length(AText) downto 1 do if AText[i] = '(' then begin Result := Copy(AText, 1, i - 2); Break; end; end; function GetNewTreeText(const AText: string; Index: integer): string; var i: integer; begin Result := AText; for i := Length(AText) downto 1 do if AText[i] = '(' then begin Result := Copy(AText, 1, i - 2); Break; end; Result := Format('%s (%d)', [Result, Index]) end; procedure TfrmJvTreeViewLinksEditor.DoPopClick(Sender: TObject); begin with Sender as TMenuItem do begin lbPages.ItemIndex := Tag; if acLink.Enabled then acLink.Execute; end; end; procedure TfrmJvTreeViewLinksEditor.CreatePopUpItem(Index: integer); var m: TMenuItem; begin m := TMenuItem.Create(popTree); m.Caption := Format('Create link to page %d', [Index]); m.Tag := Index; if Index < 10 then m.ShortCut := ShortCut(Ord('0') + Index, [ssCtrl]) else if (Index >= 10) and (Index < 36) then m.ShortCut := ShortCut(Ord('A') + Index - 10, [ssCtrl]); m.OnClick := DoPopClick; popTree.Items.Add(m); end; procedure TfrmJvTreeViewLinksEditor.AssignComponents(TreeView: TCustomTreeView; const PageList: IPageList); var N1: TJvPageIndexNode; N2: TTreeNode; i: integer; begin tvItems.Items.Clear; FTreeView := TreeView; if TreeView <> nil then begin tvItems.Items.Assign(THackTreeView(TreeView).Items); tvItems.ShowButtons := true; // THackTreeView(TreeView).ShowButtons; end; if TreeView is TJvCustomPageListTreeView then begin N1 := THackTreeView(TreeView).Items.GetFirstNode as TJvPageIndexNode; N2 := tvItems.Items.getFirstNode; while Assigned(N1) and Assigned(N2) do begin N2.Data := Pointer(N1.PageIndex); N2.Text := Format('%s (%d)', [N1.Text, N1.PageIndex]); N1 := TJvPageIndexNode(N1.getNext); N2 := N2.getNext; end; end; lbPages.Items.Clear; popTree.Items.Clear; if PageList <> nil then for i := 0 to PageList.getPageCount - 1 do begin lbPages.Items.Add(Format('%s (%d)',[PageList.getPageCaption(i),i])); CreatePopUpItem(i); end; if tvItems.Items.Count > 0 then begin tvItems.Items[0].Selected := true; tvItems.Items[0].Expand(false); end; end; procedure TfrmJvTreeViewLinksEditor.AssignToComponents(TreeView: TCustomTreeView; const PageList: IPageList); var N1: TJvPageIndexNode; N2: TTreeNode; begin if TreeView <> nil then THackTreeView(TreeView).Items.Assign(tvItems.Items); if TreeView is TJvCustomPageListTreeView then begin N1 := THackTreeView(TreeView).Items.GetFirstNode as TJvPageIndexNode; N2 := tvItems.Items.getFirstNode; while Assigned(N1) and Assigned(N2) do begin N1.PageIndex := integer(N2.Data); N1.Text := GetStrippedText(N2.Text); N1 := TJvPageIndexNode(N1.getNext); N2 := N2.getNext; end; end; end; procedure TfrmJvTreeViewLinksEditor.tvItemsChange(Sender: TObject; Node: TTreeNode); begin if (Node <> nil) then begin if Node is TJvPageIndexNode then lbPages.ItemIndex := TJvPageIndexNode(Node).PageIndex else lbPages.ItemIndex := integer(Node.Data); end; end; procedure TfrmJvTreeViewLinksEditor.acLinkExecute(Sender: TObject); var N: TTreeNode; begin N := tvItems.Selected; N.Data := Pointer(lbPages.ItemIndex); if FTreeView is TJvCustomSettingsTreeView then begin // make the editor behave like the component if (N.Parent <> nil) and (N.Parent.getFirstChild = N) then begin N.Parent.Data := Pointer(lbPages.ItemIndex); N.Parent.Text := GetNewTreeText(N.Parent.Text, lbPages.ItemIndex); end else if N.HasChildren then begin N.getFirstChild.Data := Pointer(lbPages.ItemIndex); N.getFirstChild.Text := GetNewTreeText(N.getFirstChild.Text, lbPages.ItemIndex); end; end; if (N is TJvPageIndexNode) then TJvPageIndexNode(N).PageIndex := lbPages.ItemIndex; N.Text := GetNewTreeText(N.Text, lbPages.ItemIndex); end; procedure TfrmJvTreeViewLinksEditor.acMainUpdate(Action: TBasicAction; var Handled: Boolean); begin acLink.Enabled := (tvItems.Selected <> nil) and (lbPages.ItemIndex > -1); end; procedure TfrmJvTreeViewLinksEditor.FormResize(Sender: TObject); begin pnlLeft.Width := (ClientWidth - pnlMid.Width) div 2; end; class function TfrmJvTreeViewLinksEditor.Edit(TreeView: TCustomTreeView; const PageList: IPageList): boolean; begin with self.Create(Application) do try AssignComponents(TreeView, PageList); Result := ShowModal = mrOK; if Result then AssignToComponents(TreeView, PageList); finally Free; end; end; end. --- NEW FILE: JvPageListTreeViewReg.pas --- {----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvPageListTreeViewReg.PAS, released on 2003-01-22. The Initial Developer of the Original Code is Peter Thörnqvist [pe...@pe...] . Portions created by Peter Thörnqvist are Copyright (C) 2003 Peter Thörnqvist. All Rights Reserved. Contributor(s): Last Modified: 2003-01-01 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, located at http://jvcl.sourceforge.net Known Issues: -----------------------------------------------------------------------------} {$I JVCL.INC} {$I WINDOWSONLY.INC} unit JvPageListTreeViewReg; interface uses Windows, Classes, JvPageListTreeView, JvDsgnEditors, {$IFDEF COMPILER6_UP}DesignEditors, DesignIntf, DesignMenus, VCLEditors, {$ELSE}DsgnIntf, Menus, {$ENDIF}ImgList, Graphics; type { a property editor for the ActivePage property of TJvPageList } TJvActivePageProperty = class(TComponentProperty) public function GetAttributes: TPropertyAttributes; override; procedure GetValues(Proc: TGetStrProc); override; end; TJvShowDesignCaptionProperty = class(TEnumProperty) function GetAttributes: TPropertyAttributes; override; end; { a component editor for the TJvPageList } TJvCustomPageEditor = class(TComponentEditor) private procedure InsertPage; procedure PrevPage; procedure NextPage; procedure RemovePage; function GetPageControl: TJvCustomPageList; public function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; procedure ExecuteVerb(Index: Integer); override; procedure Edit; override; {$IFDEF COMPILER6_UP} procedure PrepareItem(Index: Integer; const AItem: IMenuItem); override; {$ELSE} procedure PrepareItem(Index: Integer; const AItem: TMenuItem); override; {$ENDIF} end; TJvSettingsTreeImagesProperty = class(TJvDefaultImageIndexProperty) protected function ImageList: TCustomImageList; override; end; {$IFNDEF COMPILER6_UP} // since D5 doesn't support interface style published properties, // this editor is supplied to make it easier to select a specific interface // implementor at design-time // NOTE: you must derive a new editor from TJvInterfaceProperty and override // GetInterfaceGUID and GetInterfaceName since these are declared as virtual abstract TJvInterfaceProperty = class(TComponentProperty) private FOrgStrProc: TGetStrProc; protected function IntfSupported(AComponent:TComponent):boolean;virtual; function GetInterfaceGUID:TGUID;virtual;abstract; function GetInterfaceName: string; virtual;abstract; procedure ProcComps(const S:String); property OrgStrProc: TGetStrProc read FOrgStrProc write FOrgStrProc; public procedure GetValues(Proc: TGetStrProc); override; procedure SetValue(const Value: string); override; end; TJvPageListProperty = class(TJvInterfaceProperty) protected function GetInterfaceGUID:TGUID;override; function GetInterfaceName: string; override; end; {$ENDIF} procedure Register; {$R ..\resources\JvPageListTreeViewReg.dcr} implementation uses Forms, ComCtrls, Controls, SysUtils, TypInfo, Consts, JvPageLinkEditor, JvTreeItemsEditor; resourcestring SFmtInterfaceNotSupported = '%s does not support the required interface (%s)'; SNextPage = 'Ne&xt Page'; SPrevPage = '&Previous Page'; SNewPage = '&New Page'; SDelPage = '&Delete Page'; type THackTreeView = class(TJvCustomPageListTreeView); procedure Register; begin RegisterPropertyEditor(typeinfo(TTreeNodes), TCustomTreeView, 'Items', TJvTreeItemsProperty); RegisterPropertyEditor(typeinfo(TJvShowDesignCaption), nil, '', TJvShowDesignCaptionProperty); RegisterComponents('Jv Lists, Combos and Trees', [TJvSettingsTreeView, TJvPageListTreeView, TJvPageList]); RegisterClasses([TJvSettingsTreeView, TJvPageListTreeView, TJvPageList, TJvStandardPage]); RegisterComponentEditor(TJvCustomPageList, TJvCustomPageEditor); RegisterComponentEditor(TJvCustomPage, TJvCustomPageEditor); {$IFNDEF COMPILER6_UP} RegisterPropertyEditor(typeinfo(TComponent), TJvCustomPageListTreeView, 'PageList', TJvPageListProperty); {$ENDIF} RegisterComponentEditor(TCustomTreeView, TJvTreeViewComponentEditor); RegisterComponentEditor(TJvCustomPageListTreeView, TJvPageTreeViewComponentEditor); // register for the standard TTreeView as well // RegisterComponentEditor(TTreeView, TJvTreeViewComponentEditor); RegisterPropertyEditor(typeinfo(TJvPageLinks), TJvCustomPageListTreeView, '', TJvPageLinksProperty); RegisterPropertyEditor(typeinfo(TJvCustomPage), TJvCustomPageList, 'ActivePage', TJvActivePageProperty); RegisterPropertyEditor(typeinfo(TImageIndex), TJvSettingsTreeImages, '', TJvSettingsTreeImagesProperty); // RegisterPropertyEditor(typeinfo(integer),TJvSettingsTreeImages,'CollapsedIndex',TJvSettingsTreeImagesProperty); // RegisterPropertyEditor(typeinfo(integer),TJvSettingsTreeImages,'ExpandedIndex',TJvSettingsTreeImagesProperty); // RegisterPropertyEditor(typeinfo(integer),TJvSettingsTreeImages,'ImageIndex',TJvSettingsTreeImagesProperty); // RegisterPropertyEditor(typeinfo(integer),TJvSettingsTreeImages,'SelectedIndex',TJvSettingsTreeImagesProperty); end; { TJvCustomPageEditor } procedure TJvCustomPageEditor.Edit; begin // move to next page if GetPageControl.PageCount >= 1 then ExecuteVerb(0) else ExecuteVerb(2); // create new end; procedure TJvCustomPageEditor.ExecuteVerb(Index: Integer); begin case Index of 0: NextPage; 1: PrevPage; 2: InsertPage; 3: RemovePage; end; end; function TJvCustomPageEditor.GetPageControl: TJvCustomPageList; begin if Component is TJvCustomPageList then Result := TJvCustomPageList(Component) else Result := TJvCustomPageList(TJvCustomPage(Component).PageList); end; function TJvCustomPageEditor.GetVerb(Index: Integer): string; begin case Index of 0: Result := SNextPage; 1: Result := SPrevPage; 2: Result := SNewPage; 3: Result := SDelPage; end; end; function TJvCustomPageEditor.GetVerbCount: Integer; begin Result := 4; // new, next, previous, delete, end; procedure TJvCustomPageEditor.InsertPage; var P: TJvCustomPage; C: TJvCustomPageList; begin C := GetPageControl; P := C.GetPageClass.Create(Designer.{$IFDEF COMPILER6_UP}Root{$ELSE}Form{$ENDIF}); try P.Parent := C; P.Name := Designer.UniqueName(C.GetPageClass.ClassName); P.PageList := C; C.ActivePage := P; except P.Free; raise; end; end; procedure TJvCustomPageEditor.NextPage; begin GetPageControl.NextPage; end; {$IFDEF COMPILER6_UP} procedure TJvCustomPageEditor.PrepareItem(Index: Integer; const AItem: IMenuItem); {$ELSE} procedure TJvCustomPageEditor.PrepareItem(Index: Integer; const AItem: TMenuItem); {$ENDIF} begin inherited; case Index of {$IFNDEF COMPILER6_UP} 0: AItem.Default := GetPageControl.PageCount > 1; 2: AItem.Default := GetPageControl.PageCount = 0; {$ENDIF} 3: AItem.Enabled := GetPageControl.ActivePage <> nil; end; end; procedure TJvCustomPageEditor.PrevPage; begin GetPageControl.PrevPage; end; procedure TJvCustomPageEditor.RemovePage; var P: TJvCustomPageList; P2: TJvCustomPage; begin P := GetPageControl; if (P <> nil) and (P.ActivePage <> nil) then begin P2 := P.ActivePage; Designer.SelectComponent(P2); P2.PageList := nil; P2.Free; Designer.Modified; end; end; { TJvActivePageProperty } function TJvActivePageProperty.GetAttributes: TPropertyAttributes; begin Result := [paValueList]; end; procedure TJvActivePageProperty.GetValues(Proc: TGetStrProc); var I: Integer; Component: TComponent; begin for I := 0 to Designer.GetRoot.ComponentCount - 1 do begin Component := Designer.GetRoot.Components[I]; if (Component.Name <> '') and (Component is TJvCustomPage) and (TJvCustomPage(Component).PageList = GetComponent(0)) then Proc(Component.Name); end; end; { TJvSettingsTreeImagesProperty } function TJvSettingsTreeImagesProperty.ImageList: TCustomImageList; var T: TJvCustomPageListTreeView; begin if (GetComponent(0) is TJvSettingsTreeImages) and (TJvSettingsTreeImages(GetComponent(0)).TreeView <> nil) then begin T := TJvSettingsTreeImages(GetComponent(0)).TreeView; Result := THackTreeView(T).Images; end else Result := nil; end; { TJvShowDesignCaptionProperty } function TJvShowDesignCaptionProperty.GetAttributes: TPropertyAttributes; begin // we don't want sorting for this property Result := [paMultiSelect, paValueList, paRevertable]; end; {$IFNDEF COMPILER6_UP} { TJvInterfaceProperty } function TJvInterfaceProperty.IntfSupported(AComponent:TComponent):boolean; var obj:IUnknown; begin Result := Supports(AComponent,GetInterfaceGUID,obj); end; procedure TJvInterfaceProperty.ProcComps(const S:String); var Comp:TComponent; begin Comp := Designer.GetComponent(S); if (Comp <> nil) and IntfSupported(Comp) then OrgStrProc(S); end; procedure TJvInterfaceProperty.GetValues(Proc: TGetStrProc); begin OrgStrProc := Proc; inherited GetValues(ProcComps); end; procedure TJvInterfaceProperty.SetValue(const Value: string); var Comp: TComponent; begin if Value = '' then Comp := nil else begin Comp := Designer.GetComponent(Value); if not (Comp is GetTypeData(GetPropType)^.ClassType) and not IntfSupported(Comp) then raise EPropertyError.CreateFmt(SFmtInterfaceNotSupported,[Comp.Name,GetInterfaceName]); end; SetOrdValue(Longint(Comp)); end; { TJvPageListProperty } function TJvPageListProperty.GetInterfaceGUID: TGUID; begin Result := IPageList; end; function TJvPageListProperty.GetInterfaceName: string; begin Result := 'IPageList'; end; {$ENDIF} end. --- NEW FILE: JvPreviewReg.pas --- {----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvPreviewReg.PAS, released on 2003-01-01. The Initial Developer of the Original Code is Peter Thörnqvist [pe...@pe...] . Portions created by Peter Thörnqvist are Copyright (C) 2003 Peter Thörnqvist. All Rights Reserved. Contributor(s): Last Modified: 2003-01-01 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, located at http://jvcl.sourceforge.net Known Issues: -----------------------------------------------------------------------------} {$I JVCL.INC} {$I WINDOWSONLY.INC} unit JvPreviewReg; interface uses {$IFDEF COMPILER6_UP} DesignIntf, DesignEditors {$ELSE} DsgnIntf {$ENDIF}; type TJvPreviewerEditor = class(TComponentEditor) public function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; procedure ExecuteVerb(Index: Integer); override; end; procedure Register; implementation uses Classes, JvPrvwDoc, JvPrvwRender; {$R ..\resources\JvPreviewReg.dcr} procedure Register; begin RegisterComponents('Jv Print Preview', [TJvPreviewControl, TJvPreviewRenderRichEdit, TJvPreviewRenderStrings, TJvPreviewRenderGraphics, TJvPreviewRenderControl, TJvPreviewPrinter]); RegisterComponentEditor(TJvCustomPreviewRenderer, TJvPreviewerEditor); end; type TJvHackCustomPreviewer = class(TJvCustomPreviewRenderer); { TJvPreviewerEditor } procedure TJvPreviewerEditor.ExecuteVerb(Index: Integer); var pv: TJvCustomPreviewControl; begin case Index of 0: TJvHackCustomPreviewer(Component).CreatePreview(false); 1: begin pv := TJvHackCustomPreviewer(Component).PrintPreview; if pv <> nil then pv.Clear; end; end; end; function TJvPreviewerEditor.GetVerb(Index: Integer): string; begin case Index of 0: Result := 'Create Preview'; 1: Result := 'Clear Preview'; end; end; function TJvPreviewerEditor.GetVerbCount: Integer; begin Result := 2; end; end. --- NEW FILE: JvTreeItemsEditor.dfm --- object frmTreeViewItems: TfrmTreeViewItems Left = 281 Top = 187 AutoScroll = False BorderWidth = 2 Caption = 'TreeView Items Editor' ClientHeight = 204 ClientWidth = 443 Color = clBtnFace Constraints.MinHeight = 235 Constraints.MinWidth = 455 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 129 Top = 0 Width = 3 Height = 164 Cursor = crHSplit end object Panel1: TPanel Left = 0 Top = 164 Width = 443 Height = 40 Align = alBottom BevelOuter = bvNone BorderWidth = 1 Caption = ' ' TabOrder = 0 object Bevel1: TBevel Left = 1 Top = 1 Width = 441 Height = 3 Align = alTop Shape = bsTopLine end object btnCancel: TButton Left = 359 Top = 10 Width = 75 Height = 25 Anchors = [akRight, akBottom] Cancel = True Caption = 'Cancel' ModalResult = 2 TabOrder = 0 end object btnOK: TButton Left = 279 Top = 10 Width = 75 Height = 25 Anchors = [akRight, akBottom] Caption = 'OK' Default = True ModalResult = 1 TabOrder = 1 end end object tvItems: TTreeView Left = 0 Top = 0 Width = 129 Height = 164 Align = alLeft DragMode = dmAutomatic HideSelection = False Indent = 19 PopupMenu = PopupMenu1 ReadOnly = True TabOrder = 1 OnChange = tvItemsChange OnDragDrop = tvItemsDragDrop OnDragOver = tvItemsDragOver OnStartDrag = tvItemsStartDrag end object Panel2: TPanel Left = 132 Top = 0 Width = 311 Height = 164 Align = alClient BevelOuter = bvNone Caption = ' ' TabOrder = 2 object btnNew: TButton Left = 16 Top = 63 Width = 80 Height = 25 Action = acNewItem Anchors = [akLeft, akBottom] TabOrder = 0 end object btnNewSub: TButton Left = 16 Top = 95 Width = 80 Height = 25 Action = acNewSubItem Anchors = [akLeft, akBottom] TabOrder = 1 end object btnDelete: TButton Left = 16 Top = 127 Width = 80 Height = 25 Action = acDelete Anchors = [akLeft, akBottom] TabOrder = 2 end object gbProperties: TGroupBox Left = 112 Top = 0 Width = 195 Height = 160 Anchors = [akLeft, akTop, akRight, akBottom] Caption = ' Properties: ' TabOrder = 3 object Label1: TLabel Left = 16 Top = 24 Width = 24 Height = 13 Caption = '&Text:' end object Label2: TLabel Left = 16 Top = 56 Width = 61 Height = 13 Caption = '&Image Index:' end object Label3: TLabel Left = 16 Top = 88 Width = 74 Height = 13 Caption = '&Selected Index:' end object Label4: TLabel Left = 16 Top = 120 Width = 57 Height = 13 Caption = 'State Inde&x:' end object cbImage: TComboBox Left = 100 Top = 53 Width = 88 Height = 21 Anchors = [akLeft, akTop, akRight] ItemHeight = 13 TabOrder = 0 OnChange = edNodeTextChange OnDrawItem = cbImageIndexDrawItem end object cbSelected: TComboBox Left = 100 Top = 85 Width = 88 Height = 21 Anchors = [akLeft, akTop, akRight] ItemHeight = 13 TabOrder = 1 OnChange = edNodeTextChange OnDrawItem = cbImageIndexDrawItem end object cbState: TComboBox Left = 100 Top = 117 Width = 88 Height = 21 Anchors = [akLeft, akTop, akRight] ItemHeight = 13 TabOrder = 2 OnChange = edNodeTextChange OnDrawItem = cbStateDrawItem end object edNodeText: TEdit Left = 58 Top = 19 Width = 127 Height = 21 Anchors = [akLeft, akTop, akRight] TabOrder = 3 OnChange = edNodeTextChange end end end object acItems: TActionList OnUpdate = acItemsUpdate Left = 72 Top = 24 object acNewItem: TAction Category = 'TreeView' Caption = '&New Item' ShortCut = 45 OnExecute = acNewItemExecute end object acNewSubItem: TAction Category = 'TreeView' Caption = 'N&ew SubItem' Enabled = False ShortCut = 16429 OnExecute = acNewSubItemExecute end object acDelete: TAction Category = 'TreeView' Caption = '&Delete' Enabled = False ShortCut = 16430 OnExecute = acDeleteExecute end object acNodeMoveLeft: TAction Category = 'TreeView' Caption = 'Move left' ShortCut = 16421 OnExecute = acNodeMoveLeftExecute end object acNodeMoveRight: TAction Category = 'TreeView' Caption = 'Move right' ShortCut = 16423 OnExecute = acNodeMoveRightExecute end object acNodeMoveUp: TAction Category = 'TreeView' Caption = 'Move up' ShortCut = 16422 OnExecute = acNodeMoveUpExecute end object acNodeMoveDown: TAction Category = 'TreeView' Caption = 'Move down' ShortCut = 16424 OnExecute = acNodeMoveDownExecute end object acLoadFromFile: TAction Category = 'TreeView' Caption = 'Load...' ShortCut = 16463 OnExecute = acLoadFromFileExecute end object acSaveToFile: TAction Category = 'TreeView' Caption = 'Save...' ShortCut = 16467 OnExecute = acSaveToFileExecute end end object PopupMenu1: TPopupMenu Left = 40 Top = 24 object Moveup1: TMenuItem Action = acNodeMoveUp end object Movedown1: TMenuItem Action = acNodeMoveDown end object Moveleft1: TMenuItem Action = acNodeMoveLeft end object Moveright1: TMenuItem Action = acNodeMoveRight end object N1: TMenuItem Caption = '-' end object LoadFromFile1: TMenuItem Action = acLoadFromFile end object SaveToFile1: TMenuItem Action = acSaveToFile end end object SaveDialog1: TSaveDialog Left = 74 Top = 56 end object OpenDialog1: TOpenDialog Left = 42 Top = 56 end end --- NEW FILE: JvTreeItemsEditor.pas --- {----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvTreeItemsEditor.PAS, released on 2003-01-01. The Initial Developer of the Original Code is Peter Thörnqvist [pe...@pe...] . Portions created by Peter Thörnqvist are Copyright (C) 2003 Peter Thörnqvist. All Rights Reserved. Contributor(s): Last Modified: 2003-01-01 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, located at http://jvcl.sourceforge.net Known Issues: -----------------------------------------------------------------------------} {$I JVCL.INC} {$I WINDOWSONLY.INC} unit JvTreeItemsEditor; { Changes: 2002-10-22: Drawing of State images differs from normal images since they are 1-based: the 0-th item for the state imagelist isn't drawn to alert the user to this fact } interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ActnList, ComCtrls, Menus, StdActns, {$IFDEF COMPILEr6_UP}DesignEditors, DesignIntf{$ELSE}DsgnIntf{$ENDIF}; type TJvTreeItemsProperty = class(TClassProperty) function GetAttributes: TPropertyAttributes; override; public procedure Edit; override; end; TJvTreeViewComponentEditor = class(TComponentEditor) function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; procedure ExecuteVerb(Index: Integer); override; procedure Edit; override; end; TJvPageTreeViewComponentEditor = class(TJvTreeViewComponentEditor) function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; procedure ExecuteVerb(Index: Integer); override; end; TfrmTreeViewItems = class(TForm) Panel1: TPanel; btnCancel: TButton; btnOK: TButton; tvItems: TTreeView; Splitter1: TSplitter; Panel2: TPanel; btnNew: TButton; btnNewSub: TButton; btnDelete: TButton; acItems: TActionList; acNewItem: TAction; acNewSubItem: TAction; acDelete: TAction; Bevel1: TBevel; gbProperties: TGroupBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; cbImage: TComboBox; cbSelected: TComboBox; cbState: TComboBox; edNodeText: TEdit; PopupMenu1: TPopupMenu; acNodeMoveLeft: TAction; acNodeMoveRight: TAction; acNodeMoveUp: TAction; acNodeMoveDown: TAction; Movedown1: TMenuItem; Moveup1: TMenuItem; N1: TMenuItem; Moveleft1: TMenuItem; Moveright1: TMenuItem; acLoadFromFile: TAction; acSaveToFile: TAction; LoadFromFile1: TMenuItem; SaveToFile1: TMenuItem; SaveDialog1: TSaveDialog; OpenDialog1: TOpenDialog; procedure edNodeTextChange(Sender: TObject); procedure acNewItemExecute(Sender: TObject); procedure acNewSubItemExecute(Sender: TObject); procedure tvItemsChange(Sender: TObject; Node: TTreeNode); procedure acFileOpenAccept(Sender: TObject); procedure acFileSaveAsAccept(Sender: TObject); procedure acDeleteExecute(Sender: TObject); procedure acItemsUpdate(Action: TBasicAction; var Handled: Boolean); procedure cbImageIndexDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); procedure cbStateDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); procedure acNodeMoveUpExecute(Sender: TObject); procedure acNodeMoveDownExecute(Sender: TObject); procedure acNodeMoveRightExecute(Sender: TObject); procedure acNodeMoveLeftExecute(Sender: TObject); procedure tvItemsStartDrag(Sender: TObject; var DragObject: TDragObject); procedure tvItemsDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); procedure tvItemsDragDrop(Sender, Source: TObject; X, Y: Integer); procedure acLoadFromFileExecute(Sender: TObject); procedure acSaveToFileExecute(Sender: TObject); private { Private declarations } FDragNode:TTreeNode; FTreeView:TCustomTreeView; public { Public declarations } class function Edit(TreeView: TCustomTreeView): boolean; end; TGroupBox = class(StdCtrls.TGroupBox) private FPropagateEnabled: boolean; procedure CMEnabledChanged(var Msg: TMessage); message CM_ENABLEDCHANGED; public constructor Create(AOwner: TComponent); override; published property PropagateEnabled: boolean read FPropagateEnabled write FPropagateEnabled default true; end; procedure ShowTreeNodeEditor(TreeView:TCustomTreeView); implementation uses JvPageListTreeView, JvPageLinkEditor, ImgList; {$R *.dfm} type THackTreeView = class(TCustomTreeView); procedure ShowTreeNodeEditor(TreeView:TCustomTreeView); begin TfrmTreeViewItems.Edit(TreeView); end; function Max(Val1, Val2: integer): integer; begin Result := Val1; if Val2 > Val1 then Result := Val2; end; { TGroupBox } procedure TGroupBox.CMEnabledChanged(var Msg: TMessage); begin inherited; if PropagateEnabled then Broadcast(Msg); end; constructor TGroupBox.Create(AOwner: TComponent); begin inherited; PropagateEnabled := true; end; procedure TfrmTreeViewItems.edNodeTextChange(Sender: TObject); begin if tvItems.Selected <> nil then begin tvItems.Selected.Text := edNodeText.Text; tvItems.Selected.ImageIndex := StrToIntDef( cbImage.Text, tvItems.Selected.ImageIndex); tvItems.Selected.SelectedIndex := StrToIntDef( cbSelected.Text, tvItems.Selected.SelectedIndex); tvItems.Selected.StateIndex := StrToIntDef( cbState.Text, tvItems.Selected.StateIndex); end; end; procedure TfrmTreeViewItems.acNewItemExecute(Sender: TObject); begin with tvItems.Items.Add(tvItems.Selected, '') do begin MakeVisible; Selected := true; end; gbProperties.Enabled := true; edNodeText.SetFocus; end; procedure TfrmTreeViewItems.acNewSubItemExecute(Sender: TObject); begin with tvItems.Items.AddChild(tvItems.Selected, '') do begin MakeVisible; Selected := true; end; gbProperties.Enabled := true; edNodeText.SetFocus; end; function DoStringCompare(SL: TStringList; Index1, Index2: integer): integer; begin Result := StrToIntDef(SL[Index2], Index2) - StrToIntDef(SL[Index1], Index1); end; procedure TfrmTreeViewItems.tvItemsChange(Sender: TObject; Node: TTreeNode); function AddCB(CB: TComboBox; AItemIndex: integer): integer; var S: string; SL: TStringlist; begin S := IntToStr(AItemIndex); Result := CB.Items.IndexOf(S); if Result < 0 then begin Result := CB.Items.Add(S); SL := TStringlist.Create; try SL.Assign(CB.Items); SL.CustomSort(DoStringCompare); CB.Items := SL; finally SL.Free; end; end; end; begin if Node <> nil then begin edNodeText.OnChange := nil; edNodeText.Text := Node.Text; cbImage.ItemIndex := AddCB(cbImage, Node.ImageIndex); cbSelected.ItemIndex := AddCB(cbSelected, Node.SelectedIndex); cbState.ItemIndex := AddCB(cbState, Node.StateIndex); edNodeText.OnChange := edNodeTextChange; end; gbProperties.Enabled := tvItems.Selected <> nil; end; procedure TfrmTreeViewItems.acFileOpenAccept(Sender: TObject); begin // tvItems.LoadFromFile(acFileOpen.Dialog.Filename); tvItems.FullExpand; end; procedure TfrmTreeViewItems.acFileSaveAsAccept(Sender: TObject); begin // tvItems.SaveToFile(acFileSaveAs.Dialog.Filename); end; procedure TfrmTreeViewItems.acDeleteExecute(Sender: TObject); var N: TTreeNode; begin edNodeText.OnChange := nil; tvItems.OnChange := nil; try N := tvItems.Selected.GetPrev; if N = nil then N := tvItems.Selected.GetNext; tvItems.Selected.Delete; edNodeText.Text := ''; if N <> nil then begin N.MakeVisible; N.Selected := true; end; finally edNodeText.OnChange := edNodeTextChange; tvItems.OnChange := tvItemsChange; end; end; procedure TfrmTreeViewItems.acItemsUpdate(Action: TBasicAction; var Handled: Boolean); var bSel:boolean;nSel:TTreeNode; begin bSel := tvItems.Selected <> nil; nSel := tvItems.Selected; acNewSubItem.Enabled := bSel; acDelete.Enabled := bSel; acNodeMoveLeft.Enabled := bSel and (nSel.Parent <> nil); acNodeMoveRight.Enabled := bSel and (nSel.getPrevSibling <> nil); acNodeMoveUp.Enabled := bSel and ((nSel.getPrevSibling <> nil) or (nSel.Parent <> nil)); acNodeMoveDown.Enabled := bSel and ((nSel.getNextSibling <> nil) or (nSel.Parent <> nil)); end; class function TfrmTreeViewItems.Edit(TreeView: TCustomTreeView): boolean; var f: TfrmTreeViewItems; il: TCustomImageList; i: integer; begin f := self.Create(Application); try f.FTreeView := TreeView; f.tvItems.Items.Assign(THackTreeView(Treeview).Items); il := THackTreeView(Treeview).Images; if il <> nil then begin f.cbImage.Style := csOwnerDrawFixed; f.cbSelected.Style := csOwnerDrawFixed; f.cbImage.ItemHeight := il.Height; f.cbSelected.ItemHeight := il.Height; f.cbImage.Items.Add('-1'); f.cbSelected.Items.Add('-1'); for i := 0 to il.Count - 1 do begin f.cbImage.Items.Add(IntToStr(i)); f.cbSelected.Items.Add(IntToStr(i)); end; f.cbImage.Tag := integer(il); f.cbSelected.Tag := integer(il); end; il := THackTreeView(Treeview).StateImages; if il <> nil then begin f.cbState.Style := csOwnerDrawFixed; f.cbState.ItemHeight := il.Height; f.cbState.Items.Add('-1'); for i := 0 to il.Count - 1 do f.cbState.Items.Add(IntToStr(i)); f.cbState.Tag := integer(il); end; f.cbSelected.ItemIndex := 0; f.cbSelected.ItemIndex := 0; f.cbState.ItemIndex := 0; f.tvItems.FullExpand; if f.tvItems.Items.Count > 0 then f.tvItems.Items.getFirstNode.MakeVisible; Result := f.ShowModal = mrOK; if Result then THackTreeView(Treeview).Items.Assign(f.tvItems.Items); finally f.Free; end; end; procedure TfrmTreeViewItems.cbImageIndexDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var DrawOffset, DrawIndex: integer; il: TImageList; CB: TComboBox; begin CB := TComboBox(Control); il := TImageList(CB.Tag); DrawIndex := Index - 1; DrawOffset := 2; CB.Canvas.FillRect(Rect); if il <> nil then begin il.Draw(CB.Canvas, Rect.Left + 2, Rect.Top, DrawIndex); DrawOffset := il.Width + 2; end; Rect.Left := Rect.Left + DrawOffset; DrawText(CB.Canvas.Handle, PChar(Format('%d', [DrawIndex])), -1, Rect, DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); end; procedure TfrmTreeViewItems.cbStateDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var DrawOffset, DrawIndex: integer; il: TImageList; CB: TComboBox; begin CB := TComboBox(Control); il := TImageList(CB.Tag); DrawIndex := Index - 1; DrawOffset := 2; CB.Canvas.FillRect(Rect); // state images are *one*-based, so we don't draw the 0'th image // to remind the user about this fact... if (il <> nil) then begin if DrawIndex > 0 then il.Draw(CB.Canvas, Rect.Left + 2, Rect.Top, DrawIndex); DrawOffset := il.Width + 2; end; Rect.Left := Rect.Left + DrawOffset; DrawText(CB.Canvas.Handle, PChar(Format('%d', [DrawIndex])), -1, Rect, DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); end; { TJvTreeItemsProperty } procedure TJvTreeItemsProperty.Edit; begin TfrmTreeViewItems.Edit(TCustomTreeView(GetComponent(0))); end; function TJvTreeItemsProperty.GetAttributes: TPropertyAttributes; begin Result := [paDialog]; end; { TJvTreeViewComponentEditor } procedure TJvTreeViewComponentEditor.Edit; begin ExecuteVerb(0); end; procedure TJvTreeViewComponentEditor.ExecuteVerb(Index: Integer); begin if (Index = 0) then ShowTreeNodeEditor(TCustomTreeView(Component)) else inherited; end; function TJvTreeViewComponentEditor.GetVerb(Index: Integer): string; begin if Index = 0 then Result := 'Items Editor...' else Result := ''; end; function TJvTreeViewComponentEditor.GetVerbCount: Integer; begin Result := 1; end; procedure TfrmTreeViewItems.acNodeMoveUpExecute(Sender: TObject); begin with tvItems.Selected do begin if getPrevSibling <> nil then MoveTo(getPrevSibling,naInsert) else if Parent <> nil then MoveTo(Parent,naInsert); end; tvItems.FullExpand; end; procedure TfrmTreeViewItems.acNodeMoveDownExecute(Sender: TObject); var N:TTreeNode; begin with tvItems.Selected do begin if getNextSibling <> nil then getNextSibling.MoveTo(tvItems.Selected,naInsert) else if Parent <> nil then begin N := Parent; MoveTo(Parent,naInsert); N.MoveTo(tvItems.Selected,naInsert); end; end; tvItems.FullExpand; end; procedure TfrmTreeViewItems.acNodeMoveRightExecute(Sender: TObject); begin with tvItems.Selected do MoveTo(getPrevSibling,naAddChild); tvItems.FullExpand; end; procedure TfrmTreeViewItems.acNodeMoveLeftExecute(Sender: TObject); var N:TTreeNode; begin with tvItems.Selected do begin N := Parent; MoveTo(Parent,naInsert); N.MoveTo(tvItems.Selected,naInsert); end; tvItems.FullExpand; end; procedure TfrmTreeViewItems.tvItemsStartDrag(Sender: TObject; var DragObject: TDragObject); begin FDragNode := tvItems.Selected; end; procedure TfrmTreeViewItems.tvItemsDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var N:TTreeNode; begin N := tvItems.GetNodeAt(X,Y); Accept := (Source = Sender) and (FDragNode <> nil) and (N <> FDragNode); if (N <> nil) and N.HasChildren and not N.Expanded then N.Expand(false); end; procedure TfrmTreeViewItems.tvItemsDragDrop(Sender, Source: TObject; X, Y: Integer); var N:TTreeNode; begin if FDragNode = nil then Exit; N := tvItems.GetNodeAt(X,Y); if N = nil then FDragNode.MoveTo(tvItems.Items.GetFirstNode,naAdd) else FDragNode.MoveTo(N,naAddChildFirst); FDragNode := nil; tvItems.FullExpand; end; procedure TfrmTreeViewItems.acLoadFromFileExecute(Sender: TObject); begin if OpenDialog1.Execute then tvItems.LoadFromFile(OpenDialog1.Filename); end; procedure TfrmTreeViewItems.acSaveToFileExecute(Sender: TObject); begin if SaveDialog1.Execute then tvItems.SaveToFile(SaveDialog1.Filename); end; { TJvPageTreeViewComponentEditor } procedure TJvPageTreeViewComponentEditor.ExecuteVerb(Index: Integer); begin if Index = 1 then ShowPageLinkEditor(TJvCustomPageListTreeView(Component)) else inherited ExecuteVerb(Index); end; function TJvPageTreeViewComponentEditor.GetVerb(Index: Integer): string; begin if Index = 1 then Result := 'Links Editor...' else Result := inherited GetVerb(Index); end; function TJvPageTreeViewComponentEditor.GetVerbCount: Integer; begin Result := 2; end; end. --- NEW FILE: JvValidateEditReg.pas --- unit JvValidateEditReg; interface uses Classes, JvValidateEdit, DesignEditors, DesignIntf; type TJvCharStringProperty = class(TStringProperty) public function GetAttributes: TPropertyAttributes; override; procedure Edit; override; end; procedure Register; implementation uses JvCharStrEditor; procedure Register; begin RegisterComponents('Jv Convert', [TJvValidateEdit]); RegisterPropertyEditor(typeinfo(string),TJvCustomValidateEdit,'Characters',TJvCharStringProperty); end; { TJvCharStringProperty } procedure TJvCharStringProperty.Edit; var S:String; begin S := GetValue; if TfrmJvCharEditDlg.Edit(S) then SetValue(S); end; function TJvCharStringProperty.GetAttributes: TPropertyAttributes; begin Result := inherited GetAttributes + [paDialog]; end; end. --- NEW FILE: JvValidatorsEditor.dfm --- object frmValidatorsEditor: TfrmValidatorsEditor Left = 289 Top = 205 Width = 160 Height = 260 BorderIcons = [biSystemMenu] Caption = 'JvValidator Items Editor' Color = clBtnFace Constraints.MinHeight = 260 Constraints.MinWidth = 160 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PopupMenu = popForm ShowHint = True OnClose = FormClose OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object ToolBar1: TToolBar Left = 0 Top = 0 Width = 152 Height = 24 AutoSize = True Caption = 'ToolBar1' EdgeBorders = [ebLeft, ebBottom] Flat = True Images = il16 TabOrder = 0 object btnNew: TToolButton Left = 0 Top = 0 Hint = 'Add Required Field Validator' Caption = 'Required Field Validator' DropdownMenu = popNew ImageIndex = 0 Style = tbsDropDown OnClick = acNewRequiredExecute end object btnDelete: TToolButton Left = 36 Top = 0 Action = acDelete end object ToolButton1: TToolButton Left = 59 Top = 0 Width = 8 Caption = 'ToolButton1' ImageIndex = 2 Style = tbsSeparator end object ToolButton2: TToolButton Left = 67 Top = 0 Action = acMoveUp end object ToolButton3: TToolButton Left = 90 Top = 0 Action = acMoveDown end end object StatusBar1: TStatusBar Left = 0 Top = 214 Width = 152 Height = 19 AutoHint = True Panels = < item Width = 50 end> SimplePanel = False end object lbValidators: TListBox Left = 0 Top = 24 Width = 152 Height = 190 Align = alClient ItemHeight = 13 TabOrder = 2 OnClick = lbValidatorsClick end object popNew: TPopupMenu Images = il16 Left = 16 Top = 40 end object alEditor: TActionList Images = il16 OnUpdate = alEditorUpdate Left = 16 Top = 104 object acDelete: TAction Caption = 'Delete' Hint = 'Delete selected item' ImageIndex = 1 ShortCut = 46 OnExecute = acDeleteExecute end object acMoveUp: TAction Caption = 'Move Up' Hint = 'Move Up' ImageIndex = 2 ShortCut = 16422 OnExecute = acMoveUpExecute end object acMoveDown: TAction Caption = 'Move Down' Hint = 'Move Down' ImageIndex = 3 ShortCut = 16424 OnExecute = acMoveDownExecute end end object il16: TImageList Left = 16 Top = 72 Bitmap = { 494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000003000000001001000000000000018 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000010421042104210421042 1042104210421042104210421042104210420000000010421042104210421042 1042104210421042104210421042104210420000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000010420000000000000000000000000000 0000000000000000000000000000000010420000000000000000000000000000 0000000000000000000000000000... [truncated message content] |