<ItemFocused> is not reliable, use ItemIdex

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2576 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2012-10-22 13:46:08 +00:00
parent 8357cd9d78
commit 82a48915cf
3 changed files with 69 additions and 70 deletions

View File

@ -8,7 +8,7 @@ object fProcEdit: TfProcEdit
ClientHeight = 543 ClientHeight = 543
ClientWidth = 522 ClientWidth = 522
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '0.9.29' LCLVersion = '1.0.1.4'
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 493 Height = 493
@ -20,40 +20,40 @@ object fProcEdit: TfProcEdit
TabOrder = 0 TabOrder = 0
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = '&Operation' Caption = '&Operation'
ClientHeight = 467 ClientHeight = 458
ClientWidth = 514 ClientWidth = 516
object Label1: TLabel object Label1: TLabel
Left = 12 Left = 12
Height = 14 Height = 18
Top = 26 Top = 26
Width = 28 Width = 40
Caption = 'Name' Caption = 'Name'
ParentColor = False ParentColor = False
end end
object edtName: TEdit object edtName: TEdit
Left = 112 Left = 112
Height = 21 Height = 27
Top = 26 Top = 26
Width = 388 Width = 390
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0 TabOrder = 0
Text = 'edtName' Text = 'edtName'
end end
object GroupBox1: TGroupBox object GroupBox1: TGroupBox
Left = 11 Left = 11
Height = 304 Height = 295
Top = 114 Top = 114
Width = 489 Width = 491
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Caption = ' Parametters ' Caption = ' Parametters '
ClientHeight = 286 ClientHeight = 276
ClientWidth = 485 ClientWidth = 487
TabOrder = 3 TabOrder = 3
object edtParams: TListView object edtParams: TListView
Left = 0 Left = 0
Height = 286 Height = 276
Top = 0 Top = 0
Width = 485 Width = 487
Align = alClient Align = alClient
Columns = < Columns = <
item item
@ -70,7 +70,6 @@ object fProcEdit: TfProcEdit
end end
item item
end> end>
ItemIndex = -1
RowSelect = True RowSelect = True
TabOrder = 0 TabOrder = 0
ViewStyle = vsReport ViewStyle = vsReport
@ -78,9 +77,9 @@ object fProcEdit: TfProcEdit
end end
object edtFunction: TCheckBox object edtFunction: TCheckBox
Left = 12 Left = 12
Height = 17 Height = 22
Top = 74 Top = 74
Width = 97 Width = 127
Caption = 'Function returns' Caption = 'Function returns'
OnClick = edtFunctionClick OnClick = edtFunctionClick
OnEditingDone = edtFunctionEditingDone OnEditingDone = edtFunctionEditingDone
@ -88,18 +87,18 @@ object fProcEdit: TfProcEdit
end end
object edtResultType: TComboBox object edtResultType: TComboBox
Left = 112 Left = 112
Height = 21 Height = 31
Top = 74 Top = 74
Width = 388 Width = 390
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 13 ItemHeight = 0
Style = csDropDownList Style = csDropDownList
TabOrder = 2 TabOrder = 2
end end
object Button3: TButton object Button3: TButton
Left = 12 Left = 12
Height = 25 Height = 25
Top = 429 Top = 420
Width = 108 Width = 108
Action = actNewArg Action = actNewArg
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -109,7 +108,7 @@ object fProcEdit: TfProcEdit
object Button4: TButton object Button4: TButton
Left = 132 Left = 132
Height = 25 Height = 25
Top = 429 Top = 420
Width = 108 Width = 108
Action = actUpdateArgument Action = actUpdateArgument
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -119,7 +118,7 @@ object fProcEdit: TfProcEdit
object Button5: TButton object Button5: TButton
Left = 248 Left = 248
Height = 25 Height = 25
Top = 429 Top = 420
Width = 108 Width = 108
Action = actDeleteArgument Action = actDeleteArgument
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]

View File

@ -4,50 +4,50 @@ LazarusResources.Add('TfProcEdit','FORMDATA',[
'TPF0'#10'TfProcEdit'#9'fProcEdit'#4'Left'#3'I'#1#6'Height'#3#31#2#3'Top'#3 'TPF0'#10'TfProcEdit'#9'fProcEdit'#4'Left'#3'I'#1#6'Height'#3#31#2#3'Top'#3
+#143#0#5'Width'#3#10#2#11'BorderStyle'#7#13'bsSizeToolWin'#7'Caption'#6#9'fP' +#143#0#5'Width'#3#10#2#11'BorderStyle'#7#13'bsSizeToolWin'#7'Caption'#6#9'fP'
+'rocEdit'#12'ClientHeight'#3#31#2#11'ClientWidth'#3#10#2#8'Position'#7#16'po' +'rocEdit'#12'ClientHeight'#3#31#2#11'ClientWidth'#3#10#2#8'Position'#7#16'po'
+'MainFormCenter'#10'LCLVersion'#6#6'0.9.29'#0#12'TPageControl'#12'PageContro' +'MainFormCenter'#10'LCLVersion'#6#7'1.0.1.4'#0#12'TPageControl'#12'PageContr'
+'l1'#4'Left'#2#0#6'Height'#3#237#1#3'Top'#2#0#5'Width'#3#10#2#10'ActivePage' +'ol1'#4'Left'#2#0#6'Height'#3#237#1#3'Top'#2#0#5'Width'#3#10#2#10'ActivePage'
+#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#0#0#9'T' +#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#0#0#9'T'
+'TabSheet'#9'TabSheet1'#7'Caption'#6#10'&Operation'#12'ClientHeight'#3#211#1 +'TabSheet'#9'TabSheet1'#7'Caption'#6#10'&Operation'#12'ClientHeight'#3#202#1
+#11'ClientWidth'#3#2#2#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'T' +#11'ClientWidth'#3#4#2#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#18#3'T'
+'op'#2#26#5'Width'#2#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#5'TEdit'#7 +'op'#2#26#5'Width'#2'('#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#5'TEdit'#7
+'edtName'#4'Left'#2'p'#6'Height'#2#21#3'Top'#2#26#5'Width'#3#132#1#7'Anchors' +'edtName'#4'Left'#2'p'#6'Height'#2#27#3'Top'#2#26#5'Width'#3#134#1#7'Anchors'
+#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#0#4'Text'#6#7'edtName'#0#0 +#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#0#4'Text'#6#7'edtName'#0#0
+#9'TGroupBox'#9'GroupBox1'#4'Left'#2#11#6'Height'#3'0'#1#3'Top'#2'r'#5'Width' +#9'TGroupBox'#9'GroupBox1'#4'Left'#2#11#6'Height'#3''''#1#3'Top'#2'r'#5'Widt'
+#3#233#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption' +'h'#3#235#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Capt'
+#6#15' Parametters '#12'ClientHeight'#3#30#1#11'ClientWidth'#3#229#1#8'Tab' +'ion'#6#15' Parametters '#12'ClientHeight'#3#20#1#11'ClientWidth'#3#231#1#8
+'Order'#2#3#0#9'TListView'#9'edtParams'#4'Left'#2#0#6'Height'#3#30#1#3'Top'#2 +'TabOrder'#2#3#0#9'TListView'#9'edtParams'#4'Left'#2#0#6'Height'#3#20#1#3'To'
+#0#5'Width'#3#229#1#5'Align'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6#4'Na' +'p'#2#0#5'Width'#3#231#1#5'Align'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6
+'me'#5'Width'#3#180#0#0#1#7'Caption'#6#4'Type'#5'Width'#3#190#0#0#1#7'Captio' +#4'Name'#5'Width'#3#180#0#0#1#7'Caption'#6#4'Type'#5'Width'#3#190#0#0#1#7'Ca'
+'n'#6#8'Modifier'#5'Width'#2'<'#0#1#0#0#9'ItemIndex'#2#255#9'RowSelect'#9#8 +'ption'#6#8'Modifier'#5'Width'#2'<'#0#1#0#0#9'RowSelect'#9#8'TabOrder'#2#0#9
+'TabOrder'#2#0#9'ViewStyle'#7#8'vsReport'#0#0#0#9'TCheckBox'#11'edtFunction' +'ViewStyle'#7#8'vsReport'#0#0#0#9'TCheckBox'#11'edtFunction'#4'Left'#2#12#6
+#4'Left'#2#12#6'Height'#2#17#3'Top'#2'J'#5'Width'#2'a'#7'Caption'#6#16'Funct' +'Height'#2#22#3'Top'#2'J'#5'Width'#2#127#7'Caption'#6#16'Function returns'#7
+'ion returns'#7'OnClick'#7#16'edtFunctionClick'#13'OnEditingDone'#7#22'edtFu' +'OnClick'#7#16'edtFunctionClick'#13'OnEditingDone'#7#22'edtFunctionEditingDo'
+'nctionEditingDone'#8'TabOrder'#2#1#0#0#9'TComboBox'#13'edtResultType'#4'Lef' +'ne'#8'TabOrder'#2#1#0#0#9'TComboBox'#13'edtResultType'#4'Left'#2'p'#6'Heigh'
+'t'#2'p'#6'Height'#2#21#3'Top'#2'J'#5'Width'#3#132#1#7'Anchors'#11#5'akTop'#6 +'t'#2#31#3'Top'#2'J'#5'Width'#3#134#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR'
+'akLeft'#7'akRight'#0#10'ItemHeight'#2#13#5'Style'#7#14'csDropDownList'#8'Ta' +'ight'#0#10'ItemHeight'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#2#0#0
+'bOrder'#2#2#0#0#7'TButton'#7'Button3'#4'Left'#2#12#6'Height'#2#25#3'Top'#3 +#7'TButton'#7'Button3'#4'Left'#2#12#6'Height'#2#25#3'Top'#3#164#1#5'Width'#2
+#173#1#5'Width'#2'l'#6'Action'#7#9'actNewArg'#7'Anchors'#11#6'akLeft'#8'akBo' +'l'#6'Action'#7#9'actNewArg'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'Border'
+'ttom'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#4#0#0#7'TButton'#7 +'Spacing.InnerBorder'#2#4#8'TabOrder'#2#4#0#0#7'TButton'#7'Button4'#4'Left'#3
+'Button4'#4'Left'#3#132#0#6'Height'#2#25#3'Top'#3#173#1#5'Width'#2'l'#6'Acti' +#132#0#6'Height'#2#25#3'Top'#3#164#1#5'Width'#2'l'#6'Action'#7#17'actUpdateA'
+'on'#7#17'actUpdateArgument'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'Border'
+'Spacing.InnerBorder'#2#4#8'TabOrder'#2#5#0#0#7'TButton'#7'Button5'#4'Left'#3
+#248#0#6'Height'#2#25#3'Top'#3#173#1#5'Width'#2'l'#6'Action'#7#17'actDeleteA'
+'rgument'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder' +'rgument'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder'
+#2#4#8'TabOrder'#2#6#0#0#0#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2'2'#3 +#2#4#8'TabOrder'#2#5#0#0#7'TButton'#7'Button5'#4'Left'#3#248#0#6'Height'#2#25
+'Top'#3#237#1#5'Width'#3#10#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'2'#11 +#3'Top'#3#164#1#5'Width'#2'l'#6'Action'#7#17'actDeleteArgument'#7'Anchors'#11
+'ClientWidth'#3#10#2#8'TabOrder'#2#1#0#7'TButton'#7'Button1'#4'Left'#3'X'#1#6 +#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#6#0
+'Height'#2#25#3'Top'#2#11#5'Width'#2'K'#6'Action'#7#5'actOk'#7'Anchors'#11#5 +#0#0#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2'2'#3'Top'#3#237#1#5'Width'
+'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrd' +#3#10#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#10#2#8
+'er'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3#176#1#6'Height'#2#25#3'Top'#2#11 +'TabOrder'#2#1#0#7'TButton'#7'Button1'#4'Left'#3'X'#1#6'Height'#2#25#3'Top'#2
+#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBor' +#11#5'Width'#2'K'#6'Action'#7#5'actOk'#7'Anchors'#11#5'akTop'#7'akRight'#0#25
+'der'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder' +'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#0#0#0#7'TButton'#7
+#2#1#0#0#0#11'TActionList'#2'AL'#4'left'#3#198#0#3'top'#3#241#0#0#7'TAction' +'Button2'#4'Left'#3#176#1#6'Height'#2#25#3'Top'#2#11#5'Width'#2'K'#7'Anchors'
+#5'actOk'#7'Caption'#6#2'OK'#9'OnExecute'#7#12'actOkExecute'#8'OnUpdate'#7#11 +#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Ca'
+'actOkUpdate'#0#0#7'TAction'#9'actNewArg'#7'Caption'#6#12'New Argument'#9'On' +'ption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0#11'TActionList'
+'Execute'#7#16'actNewArgExecute'#0#0#7'TAction'#17'actUpdateArgument'#7'Capt' +#2'AL'#4'left'#3#198#0#3'top'#3#241#0#0#7'TAction'#5'actOk'#7'Caption'#6#2'O'
+'ion'#6#13'Edit Argument'#9'OnExecute'#7#24'actUpdateArgumentExecute'#8'OnUp' +'K'#9'OnExecute'#7#12'actOkExecute'#8'OnUpdate'#7#11'actOkUpdate'#0#0#7'TAct'
+'date'#7#23'actUpdateArgumentUpdate'#0#0#7'TAction'#17'actDeleteArgument'#7 +'ion'#9'actNewArg'#7'Caption'#6#12'New Argument'#9'OnExecute'#7#16'actNewArg'
+'Caption'#6#15'Delete Argument'#9'OnExecute'#7#24'actDeleteArgumentExecute'#8 +'Execute'#0#0#7'TAction'#17'actUpdateArgument'#7'Caption'#6#13'Edit Argument'
+'OnUpdate'#7#23'actUpdateArgumentUpdate'#0#0#0#10'TPopupMenu'#10'PopupMenu1' +#9'OnExecute'#7#24'actUpdateArgumentExecute'#8'OnUpdate'#7#23'actUpdateArgum'
+#4'left'#2'S'#3'top'#3#217#0#0#0#0 +'entUpdate'#0#0#7'TAction'#17'actDeleteArgument'#7'Caption'#6#15'Delete Argu'
+'ment'#9'OnExecute'#7#24'actDeleteArgumentExecute'#8'OnUpdate'#7#23'actUpdat'
+'eArgumentUpdate'#0#0#0#10'TPopupMenu'#10'PopupMenu1'#4'left'#2'S'#3'top'#3
+#217#0#0#0#0
]); ]);

View File

@ -105,10 +105,10 @@ procedure TfProcEdit.actDeleteArgumentExecute(Sender: TObject);
var var
prop : TPasArgument; prop : TPasArgument;
begin begin
prop := TPasArgument(edtParams.ItemFocused.Data); prop := TPasArgument(edtParams.Items[edtParams.ItemIndex].Data);
FObject.ProcType.Args.Extract(prop); FObject.ProcType.Args.Extract(prop);
prop.Release(); prop.Release();
edtParams.ItemFocused.Free(); edtParams.Items[edtParams.ItemIndex].Free();
end; end;
procedure TfProcEdit.actOkUpdate(Sender: TObject); procedure TfProcEdit.actOkUpdate(Sender: TObject);
@ -148,7 +148,7 @@ var
prp : TPasArgument; prp : TPasArgument;
itm : TListItem; itm : TListItem;
begin begin
itm := edtParams.ItemFocused; itm := edtParams.Items[edtParams.ItemIndex];
if Assigned(itm) then begin if Assigned(itm) then begin
prp := TPasArgument(itm.Data); prp := TPasArgument(itm.Data);
if edit_helper.UpdateObject(TPasElement(prp),FSymbolTable) then begin if edit_helper.UpdateObject(TPasElement(prp),FSymbolTable) then begin
@ -160,7 +160,7 @@ end;
procedure TfProcEdit.actUpdateArgumentUpdate(Sender: TObject); procedure TfProcEdit.actUpdateArgumentUpdate(Sender: TObject);
begin begin
TAction(Sender).Enabled := Assigned(edtParams.ItemFocused); TAction(Sender).Enabled := (edtParams.ItemIndex >= 0);
end; end;
procedure TfProcEdit.edtFunctionClick(Sender: TObject); procedure TfProcEdit.edtFunctionClick(Sender: TObject);
@ -244,7 +244,7 @@ procedure TfProcEdit.SaveToObject();
newArg.Access := arg.Access; newArg.Access := arg.Access;
newArg.ArgType := arg.ArgType; newArg.ArgType := arg.ArgType;
newArg.ArgType.AddRef(); newArg.ArgType.AddRef();
newArg.Value := arg.Value; //newArg.Value := arg.Value;
end; end;
end; end;