From 48387376bec98912acb831d262c9b9bb48a77650 Mon Sep 17 00:00:00 2001 From: jesus Date: Fri, 16 Jul 2010 19:22:34 +0000 Subject: [PATCH] IDE, fix newfield form to allow data field type, from Marcelo Borges de Paula, issue #16941 git-svn-id: trunk@26694 - --- ideintf/languages/objinspstrconsts.pb.po | 35 +++++---- ideintf/newfield.lfm | 97 ++++++++++++------------ ideintf/newfield.pas | 23 ++++-- 3 files changed, 87 insertions(+), 68 deletions(-) diff --git a/ideintf/languages/objinspstrconsts.pb.po b/ideintf/languages/objinspstrconsts.pb.po index d2fd3238f2..6873ec0025 100644 --- a/ideintf/languages/objinspstrconsts.pb.po +++ b/ideintf/languages/objinspstrconsts.pb.po @@ -131,7 +131,7 @@ msgstr "Acima" #: objinspstrconsts.fescalculated msgid "&Calculated" -msgstr "" +msgstr "&Calculado" #: objinspstrconsts.fescancelbtn msgctxt "objinspstrconsts.fescancelbtn" @@ -142,53 +142,60 @@ msgstr "Cancelar" msgid "Check dataset settings" msgstr "Verificar configurações \"dataset\"" +#: objinspstrconsts.fesdata +msgid "&Data" +msgstr "&Dado" + #: objinspstrconsts.fesdataset msgid "&Dataset:" -msgstr "" +msgstr "&Dataset:" #: objinspstrconsts.fesfetitle #| msgid "Edit Fields" msgid "Edit Fields..." msgstr "Editar Campos" +#: objinspstrconsts.fesfieldcantbec +msgid "Field %s cannot be created!" +msgstr "Campo %s não pôde ser criado!" + #: objinspstrconsts.fesfieldprops msgid "Field properties" -msgstr "" +msgstr "Propriedades campo" #: objinspstrconsts.fesfieldtype msgid "Field Type" -msgstr "" +msgstr "Tipo de campo" #: objinspstrconsts.fesfltitle msgid "FieldDefs" msgstr "Definições Campos" #: objinspstrconsts.fesformcaption -#, fuzzy #| msgid "New fileld" msgctxt "objinspstrconsts.fesformcaption" msgid "New field" -msgstr "Caixa de diálogo" +msgstr "Novo campo" #: objinspstrconsts.feskeyfield msgid "&Key fields:" -msgstr "" +msgstr "Campos c&have:" #: objinspstrconsts.feslookup msgid "&Lookup" -msgstr "" +msgstr "&Lookup" #: objinspstrconsts.feslookupdef msgid "Lookup definition" -msgstr "" +msgstr "Definição \"Lookup\"" #: objinspstrconsts.feslookupkeys msgid "L&ookup keys:" -msgstr "" +msgstr "Chaves \"L&ookup\":" #: objinspstrconsts.fesname msgid "&Name:" -msgstr "" +msgstr "&Nome:" #: objinspstrconsts.fesnofields msgid "It was not possible to get the dataset field's list" @@ -205,15 +212,15 @@ msgstr "OK" #: objinspstrconsts.fesresultfield msgid "&Result Fields:" -msgstr "" +msgstr "Campos &Resultado:" #: objinspstrconsts.fessize msgid "&Size:" -msgstr "" +msgstr "&Tamanho:" #: objinspstrconsts.festype msgid "&Type:" -msgstr "" +msgstr "T&ipo:" #: objinspstrconsts.ilesadd msgctxt "objinspstrconsts.ilesadd" diff --git a/ideintf/newfield.lfm b/ideintf/newfield.lfm index 70bb17f987..575f2fb907 100644 --- a/ideintf/newfield.lfm +++ b/ideintf/newfield.lfm @@ -2,13 +2,13 @@ object NewFieldFrm: TNewFieldFrm Left = 447 Height = 428 Top = 271 - Width = 354 + Width = 357 HorzScrollBar.Page = 261 VertScrollBar.Page = 375 BorderStyle = bsDialog Caption = 'Dialog' ClientHeight = 428 - ClientWidth = 354 + ClientWidth = 357 OnCreate = FormCreate ParentFont = True Position = poScreenCenter @@ -18,52 +18,52 @@ object NewFieldFrm: TNewFieldFrm Left = 0 Height = 121 Top = 112 - Width = 354 + Width = 357 Align = alTop ClientHeight = 121 - ClientWidth = 354 + ClientWidth = 357 FullRepaint = False TabOrder = 0 object GroupBox1: TGroupBox Left = 8 Height = 105 Top = 8 - Width = 336 + Width = 339 Anchors = [akTop, akLeft, akRight] Caption = 'Field properties' - ClientHeight = 87 - ClientWidth = 332 + ClientHeight = 83 + ClientWidth = 335 TabOrder = 0 object Label1: TLabel Left = 6 - Height = 14 + Height = 18 Top = 11 - Width = 32 + Width = 41 Caption = '&Name:' FocusControl = EditName ParentColor = False end object Label2: TLabel Left = 6 - Height = 14 + Height = 18 Top = 35 - Width = 29 + Width = 37 Caption = '&Type:' FocusControl = SelectType ParentColor = False end object Label3: TLabel Left = 6 - Height = 14 + Height = 18 Top = 59 - Width = 24 + Width = 29 Caption = '&Size:' FocusControl = EditSize ParentColor = False end object EditName: TEdit Left = 158 - Height = 21 + Height = 25 Hint = 'Field name' Top = 8 Width = 168 @@ -74,11 +74,11 @@ object NewFieldFrm: TNewFieldFrm end object SelectType: TComboBox Left = 158 - Height = 21 + Height = 25 Hint = 'Field type' Top = 32 Width = 168 - ItemHeight = 13 + ItemHeight = 17 Items.Strings = ( 'String' 'Integer' @@ -101,7 +101,7 @@ object NewFieldFrm: TNewFieldFrm end object EditSize: TEdit Left = 158 - Height = 21 + Height = 25 Hint = 'Field size' Top = 56 Width = 168 @@ -114,10 +114,10 @@ object NewFieldFrm: TNewFieldFrm Left = 0 Height = 144 Top = 233 - Width = 354 + Width = 357 Align = alTop ClientHeight = 144 - ClientWidth = 354 + ClientWidth = 357 FullRepaint = False TabOrder = 1 Visible = False @@ -125,54 +125,54 @@ object NewFieldFrm: TNewFieldFrm Left = 8 Height = 129 Top = 8 - Width = 336 + Width = 339 Anchors = [akTop, akLeft, akRight, akBottom] Caption = 'Lookup definition' - ClientHeight = 111 - ClientWidth = 332 + ClientHeight = 107 + ClientWidth = 335 TabOrder = 0 object Label4: TLabel Left = 6 - Height = 14 + Height = 18 Top = 10 - Width = 47 + Width = 57 Caption = '&Key fields' FocusControl = SelectKeyFields ParentColor = False end object Label5: TLabel Left = 6 - Height = 14 + Height = 18 Top = 58 - Width = 60 + Width = 79 Caption = 'L&ookup keys' FocusControl = SelectLookupKeys ParentColor = False end object Label6: TLabel Left = 6 - Height = 14 + Height = 18 Top = 82 - Width = 61 + Width = 74 Caption = '&Result Fields' FocusControl = SelectResultField ParentColor = False end object Label10: TLabel Left = 6 - Height = 14 + Height = 18 Top = 34 - Width = 39 + Width = 48 Caption = 'Dataset' ParentColor = False end object SelectKeyFields: TComboBox Left = 158 - Height = 21 + Height = 25 Hint = 'Key fields' Top = 7 Width = 168 - ItemHeight = 13 + ItemHeight = 17 OnChange = SelectKeyFieldsChange ParentShowHint = False ShowHint = True @@ -180,31 +180,31 @@ object NewFieldFrm: TNewFieldFrm end object SelectLookupKeys: TComboBox Left = 158 - Height = 21 + Height = 25 Top = 55 Width = 168 Enabled = False - ItemHeight = 13 + ItemHeight = 17 OnChange = SelectLookupKeysChange TabOrder = 2 end object SelectResultField: TComboBox Left = 158 - Height = 21 + Height = 25 Top = 79 Width = 168 Enabled = False - ItemHeight = 13 + ItemHeight = 17 OnChange = SelectResultFieldChange TabOrder = 3 end object DataSetsCombo: TComboBox Left = 158 - Height = 21 + Height = 25 Hint = 'Lookup dataset' Top = 31 Width = 168 - ItemHeight = 13 + ItemHeight = 17 OnChange = DataSetsComboChange ParentShowHint = False ShowHint = True @@ -217,10 +217,10 @@ object NewFieldFrm: TNewFieldFrm Left = 0 Height = 47 Top = 381 - Width = 354 + Width = 357 Align = alBottom ClientHeight = 47 - ClientWidth = 354 + ClientWidth = 357 FullRepaint = False TabOrder = 2 object OKBtn: TButton @@ -252,17 +252,17 @@ object NewFieldFrm: TNewFieldFrm Left = 0 Height = 112 Top = 0 - Width = 354 + Width = 357 Align = alTop ClientHeight = 112 - ClientWidth = 354 + ClientWidth = 357 FullRepaint = False TabOrder = 3 object NoteLbl: TLabel Left = 8 Height = 37 Top = 58 - Width = 336 + Width = 339 Anchors = [akTop, akLeft, akRight] AutoSize = False Caption = 'NoteLbl' @@ -274,7 +274,7 @@ object NewFieldFrm: TNewFieldFrm Left = 8 Height = 48 Top = 8 - Width = 336 + Width = 339 Anchors = [akTop, akLeft, akRight] AutoFill = True Caption = 'Field Type' @@ -285,12 +285,13 @@ object NewFieldFrm: TNewFieldFrm ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom - ChildSizing.ControlsPerLine = 2 - ClientHeight = 30 - ClientWidth = 332 - Columns = 2 + ChildSizing.ControlsPerLine = 3 + ClientHeight = 26 + ClientWidth = 335 + Columns = 3 ItemIndex = 0 Items.Strings = ( + '&Data' '&Calculated' '&Lookup' ) diff --git a/ideintf/newfield.pas b/ideintf/newfield.pas index 5b12a90e31..1926277a3b 100644 --- a/ideintf/newfield.pas +++ b/ideintf/newfield.pas @@ -13,6 +13,7 @@ * * ***************************************************************************** } +{ 2010-07-15 - New field type option (Data) Marcelo B. Paula } unit newfield; {$mode Delphi} {$H+} @@ -160,6 +161,7 @@ begin Caption := fesFormCaption; RadioGroup1.Caption := fesFieldType; RadioGroup1.Items.Clear; + RadioGroup1.Items.Add(fesData); RadioGroup1.Items.Add(fesCalculated); RadioGroup1.Items.Add(fesLookup); GroupBox1.Caption := fesFieldProps; @@ -241,7 +243,16 @@ begin LinkDataSet.Active := False; try case RadioGroup1.ItemIndex of - 0: begin //Create calc field + 0: begin //Create data field + fldType := TFieldType(PtrUInt(SelectType.Items.Objects[SelectType.ItemIndex])); + NewField := CreateField(fldType, CheckName(EditName.Text)); + NewField.Calculated := False; + NewField.FieldKind := fkData; + + FDesigner.PropertyEditorHook.PersistentAdded(NewField, True); + FDesigner.Modified; + end; + 1: begin //Create calc field fldType := TFieldType(PtrUInt(SelectType.Items.Objects[SelectType.ItemIndex])); NewField := CreateField(fldType, CheckName(EditName.Text)); NewField.Calculated := True; @@ -268,7 +279,7 @@ begin FDesigner.PropertyEditorHook.PersistentAdded(NewField, True); end else - ShowMessage('Field ''' + L[i] + ''' can''t be created!'); + ShowMessage(Format(fesFieldCanTBeC, [L[i]])); end; FDesigner.Modified; finally @@ -285,12 +296,12 @@ end; procedure TNewFieldFrm.RadioGroup1Click(Sender: TObject); begin case RadioGroup1.ItemIndex of - 0: begin //calculated field + 0..1: begin //data,calculated field Panel3.Visible := False; Panel2.Visible := True; ClientHeight := Panel1.Height + Panel2.Height + Panel4.Height; end; - 1: begin //lookup field + 2: begin //lookup field Panel3.Visible := True; Panel2.Visible := False; ClientHeight := Panel1.Height + Panel3.Height + Panel4.Height; @@ -330,9 +341,9 @@ begin end else EditSize.Enabled := False; case RadioGroup1.ItemIndex of - 0: OkBtn.Enabled := (Length(EditName.Text) > 0) And + 0..1: OkBtn.Enabled := (Length(EditName.Text) > 0) And (SelectType.ItemIndex > -1); - 1: OkBtn.Enabled := (SelectKeyFields.Text <> '') And + 2: OkBtn.Enabled := (SelectKeyFields.Text <> '') And (DataSetsCombo.ItemIndex > -1) And (SelectLookupKeys.Text <> '') And (SelectResultField.Text <> '');