ideintf: string properties

- increase edit limit for string properties from 255 to 4095
  - report correct length and line count when start editing of string property

git-svn-id: trunk@18396 -
This commit is contained in:
paul 2009-01-23 16:43:27 +00:00
parent 632fda53b8
commit 588e9f6302
4 changed files with 70 additions and 77 deletions

View File

@ -2324,9 +2324,9 @@ begin
with FPropList^[Index] do Result:=LazGetMethodProp(Instance,PropInfo);
end;
function TPropertyEditor.GetEditLimit:Integer;
function TPropertyEditor.GetEditLimit: Integer;
begin
Result:=255;
Result := 255;
end;
function TPropertyEditor.GetName:shortstring;
@ -3113,7 +3113,7 @@ begin
if GetPropType^.Kind = tkSString then
Result := GetTypeData(GetPropType)^.MaxLength
else
Result := 255;
Result := $0FFF;
end;
function TStringPropertyEditor.GetValue: ansistring;
@ -4959,10 +4959,9 @@ end;
function TStringsPropertyEditor.CreateDlg(s: TStrings): TStringsPropEditorDlg;
begin
if s=nil then ;
Result:=TStringsPropEditorDlg.Create(Application);
Result.Editor:=Self;
Result.Memo.Text:=s.Text;
Result := TStringsPropEditorDlg.Create(Application);
Result.Editor := Self;
Result.Memo.Text := s.Text;
Result.MemoChange(nil); // force call OnChange event
end;
@ -4978,16 +4977,18 @@ var
TheDialog : TStringsPropEditorDlg;
AString : string;
begin
AString:= GetStrValue;
TheDialog:= TStringsPropEditorDlg.Create(nil);
AString := GetStrValue;
TheDialog := TStringsPropEditorDlg.Create(nil);
try
TheDialog.Editor:=Self;
TheDialog.Memo.Text:=AString;
if (TheDialog.ShowModal = mrOK) then begin
AString:=TheDialog.Memo.Text;
TheDialog.Editor := Self;
TheDialog.Memo.Text := AString;
TheDialog.MemoChange(nil);
if (TheDialog.ShowModal = mrOK) then
begin
AString := TheDialog.Memo.Text;
//erase the last lineending if any
if copy(AString,length(AString)-length(LineEnding)+1,length(LineEnding))=LineEnding then
delete(AString, length(AString)-length(LineEnding)+1,length(LineEnding));
if Copy(AString, length(AString) - length(LineEnding) + 1, length(LineEnding)) = LineEnding then
Delete(AString, length(AString) - length(LineEnding) + 1, length(LineEnding));
SetStrValue(AString);
end;
finally

View File

@ -3,8 +3,6 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
Height = 302
Top = 158
Width = 400
HorzScrollBar.Page = 399
VertScrollBar.Page = 301
ActiveControl = Memo
Caption = 'StringsPropEditorFrm'
ClientHeight = 302
@ -13,25 +11,26 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
Constraints.MinWidth = 180
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.27'
object TextGroupBox: TGroupBox
AnchorSideBottom.Control = BtnPanel
Left = 6
Height = 242
Height = 252
Top = 6
Width = 388
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
ClientHeight = 223
ClientHeight = 234
ClientWidth = 384
TabOrder = 0
object StatusLabel: TLabel
AnchorSideBottom.Control = TextGroupBox
AnchorSideBottom.Side = asrBottom
Left = 9
Height = 20
Top = 197
Width = 77
Height = 14
Top = 214
Width = 57
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
Caption = 'StatusLabel'
@ -42,7 +41,7 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
AnchorSideRight.Control = SortButton
AnchorSideBottom.Control = StatusLabel
Left = 6
Height = 185
Height = 202
Top = 6
Width = 291
Anchors = [akTop, akLeft, akRight, akBottom]
@ -58,7 +57,7 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
AnchorSideRight.Control = TextGroupBox
AnchorSideRight.Side = asrBottom
Left = 303
Height = 37
Height = 23
Top = 6
Width = 75
Anchors = [akTop, akRight]
@ -71,23 +70,23 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
end
end
object BtnPanel: TPanel
Height = 48
Top = 254
Left = 0
Height = 38
Top = 264
Width = 400
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 48
ClientHeight = 38
ClientWidth = 400
TabOrder = 1
OnClick = BtnPanelClick
object CancelButton: TBitBtn
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 316
Height = 36
Left = 317
Height = 26
Top = 6
Width = 78
Width = 77
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
@ -101,8 +100,8 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
end
object OKButton: TBitBtn
AnchorSideBottom.Side = asrBottom
Left = 235
Height = 36
Left = 236
Height = 26
Top = 6
Width = 75
Align = alRight

View File

@ -2,40 +2,39 @@
LazarusResources.Add('TStringsPropEditorFrm','FORMDATA',[
'TPF0'#21'TStringsPropEditorFrm'#20'StringsPropEditorFrm'#4'Left'#3'7'#1#6'He'
+'ight'#3'.'#1#3'Top'#3#158#0#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1
+#18'VertScrollBar.Page'#3'-'#1#13'ActiveControl'#7#4'Memo'#7'Caption'#6#20'S'
+'tringsPropEditorFrm'#12'ClientHeight'#3'.'#1#11'ClientWidth'#3#144#1#21'Con'
+'straints.MinHeight'#3#160#0#20'Constraints.MinWidth'#3#180#0#8'OnCreate'#7
+#10'FormCreate'#8'Position'#7#14'poScreenCenter'#0#9'TGroupBox'#12'TextGroup'
+'Box'#24'AnchorSideBottom.Control'#7#8'BtnPanel'#4'Left'#2#6#6'Height'#3#242
+#0#3'Top'#2#6#5'Width'#3#132#1#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6
+'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#12'ClientHeig'
+'ht'#3#223#0#11'ClientWidth'#3#128#1#8'TabOrder'#2#0#0#6'TLabel'#11'StatusLa'
+'bel'#24'AnchorSideBottom.Control'#7#12'TextGroupBox'#21'AnchorSideBottom.Si'
+'de'#7#9'asrBottom'#4'Left'#2#9#6'Height'#2#20#3'Top'#3#197#0#5'Width'#2'M'#7
+'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'
+#6#11'StatusLabel'#11'ParentColor'#8#0#0#5'TMemo'#4'Memo'#22'AnchorSideLeft.'
+'Control'#7#12'TextGroupBox'#23'AnchorSideRight.Control'#7#10'SortButton'#24
+'AnchorSideBottom.Control'#7#11'StatusLabel'#4'Left'#2#6#6'Height'#3#185#0#3
+'Top'#2#6#5'Width'#3'#'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBo'
+'ttom'#0#20'BorderSpacing.Around'#2#6#8'OnChange'#7#10'MemoChange'#10'Scroll'
+'Bars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#8'WordWrap'#8#0#0#7'TButton'#10'Sort'
+'Button'#22'AnchorSideLeft.Control'#7#4'Memo'#19'AnchorSideLeft.Side'#7#9'as'
+'rBottom'#23'AnchorSideRight.Control'#7#12'TextGroupBox'#20'AnchorSideRight.'
+'Side'#7#9'asrBottom'#4'Left'#3'/'#1#6'Height'#2'%'#3'Top'#2#6#5'Width'#2'K'
+#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2
+#6#7'Caption'#6#4'Sort'#20'Constraints.MinWidth'#2'K'#7'OnClick'#7#15'SortBu'
+'ttonClick'#8'TabOrder'#2#1#0#0#0#6'TPanel'#8'BtnPanel'#6'Height'#2'0'#3'Top'
+#3#254#0#5'Width'#3#144#1#5'Align'#7#8'alBottom'#8'AutoSize'#9#10'BevelOuter'
+#7#6'bvNone'#12'ClientHeight'#2'0'#11'ClientWidth'#3#144#1#8'TabOrder'#2#1#7
+'OnClick'#7#13'BtnPanelClick'#0#7'TBitBtn'#12'CancelButton'#20'AnchorSideRig'
+'ht.Side'#7#9'asrBottom'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
+'<'#1#6'Height'#2'$'#3'Top'#2#6#5'Width'#2'N'#5'Align'#7#7'alRight'#8'AutoSi'
+'ze'#9#20'BorderSpacing.Around'#2#6#6'Cancel'#9#7'Caption'#6#6'Cancel'#20'Co'
+'nstraints.MinWidth'#2'K'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGly'
+'phs'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#8'OKButton'#21'AnchorSideBottom.Sid'
+'e'#7#9'asrBottom'#4'Left'#3#235#0#6'Height'#2'$'#3'Top'#2#6#5'Width'#2'K'#5
+'Align'#7#7'alRight'#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6
+#3'&OK'#20'Constraints.MinWidth'#2'K'#7'Default'#9#4'Kind'#7#4'bkOK'#11'Moda'
+'lResult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#0#0
+'ight'#3'.'#1#3'Top'#3#158#0#5'Width'#3#144#1#13'ActiveControl'#7#4'Memo'#7
+'Caption'#6#20'StringsPropEditorFrm'#12'ClientHeight'#3'.'#1#11'ClientWidth'
+#3#144#1#21'Constraints.MinHeight'#3#160#0#20'Constraints.MinWidth'#3#180#0#8
+'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6
+#6'0.9.27'#0#9'TGroupBox'#12'TextGroupBox'#24'AnchorSideBottom.Control'#7#8
+'BtnPanel'#4'Left'#2#6#6'Height'#3#252#0#3'Top'#2#6#5'Width'#3#132#1#5'Align'
+#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'Bor'
+'derSpacing.Around'#2#6#12'ClientHeight'#3#234#0#11'ClientWidth'#3#128#1#8'T'
+'abOrder'#2#0#0#6'TLabel'#11'StatusLabel'#24'AnchorSideBottom.Control'#7#12
+'TextGroupBox'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#9#6'Height'
+#2#14#3'Top'#3#214#0#5'Width'#2'9'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#11'StatusLabel'#11'ParentColor'#8#0#0
+#5'TMemo'#4'Memo'#22'AnchorSideLeft.Control'#7#12'TextGroupBox'#23'AnchorSid'
+'eRight.Control'#7#10'SortButton'#24'AnchorSideBottom.Control'#7#11'StatusLa'
+'bel'#4'Left'#2#6#6'Height'#3#202#0#3'Top'#2#6#5'Width'#3'#'#1#7'Anchors'#11
+#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#8
+'OnChange'#7#10'MemoChange'#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#8
+'WordWrap'#8#0#0#7'TButton'#10'SortButton'#22'AnchorSideLeft.Control'#7#4'Me'
+'mo'#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#12
+'TextGroupBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#3'/'#1#6'Heig'
+'ht'#2#23#3'Top'#2#6#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'Aut'
+'oSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#4'Sort'#20'Constraints.M'
+'inWidth'#2'K'#7'OnClick'#7#15'SortButtonClick'#8'TabOrder'#2#1#0#0#0#6'TPan'
+'el'#8'BtnPanel'#4'Left'#2#0#6'Height'#2'&'#3'Top'#3#8#1#5'Width'#3#144#1#5
+'Align'#7#8'alBottom'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeig'
+'ht'#2'&'#11'ClientWidth'#3#144#1#8'TabOrder'#2#1#0#7'TBitBtn'#12'CancelButt'
+'on'#20'AnchorSideRight.Side'#7#9'asrBottom'#21'AnchorSideBottom.Side'#7#9'a'
+'srBottom'#4'Left'#3'='#1#6'Height'#2#26#3'Top'#2#6#5'Width'#2'M'#5'Align'#7
+#7'alRight'#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#6'Cancel'#9#7'Caption'
+#6#6'Cancel'#20'Constraints.MinWidth'#2'K'#4'Kind'#7#8'bkCancel'#11'ModalRes'
+'ult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#8'OKButton'#21'Anc'
+'horSideBottom.Side'#7#9'asrBottom'#4'Left'#3#236#0#6'Height'#2#26#3'Top'#2#6
+#5'Width'#2'K'#5'Align'#7#7'alRight'#8'AutoSize'#9#20'BorderSpacing.Around'#2
+#6#7'Caption'#6#3'&OK'#20'Constraints.MinWidth'#2'K'#7'Default'#9#4'Kind'#7#4
+'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#0#0
]);

View File

@ -39,7 +39,6 @@ type
Memo: TMemo;
procedure FormCreate(Sender: TObject);
procedure MemoChange(Sender: TObject);
procedure BtnPanelClick(Sender: TObject);
procedure SortButtonClick(Sender: TObject);
public
procedure AddButtons; virtual;
@ -55,8 +54,8 @@ begin
Caption := oisStringsEditorDialog;
StatusLabel.Caption := ois0Lines0Chars;
SortButton.Caption := oisSort;
OKButton.Caption:=oisOk2;
CancelButton.Caption:=oiStdActDataSetCancel1Hint;
OKButton.Caption := oisOk2;
CancelButton.Caption := oiStdActDataSetCancel1Hint;
AddButtons;
end;
@ -75,11 +74,6 @@ begin
StatusLabel.Caption := Format(oisDLinesDChars, [Memo.Lines.Count, NumChars]);
end;
procedure TStringsPropEditorFrm.BtnPanelClick(Sender: TObject);
begin
end;
procedure TStringsPropEditorFrm.SortButtonClick(Sender: TObject);
var
OldText, NewSortedText: String;