mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 03:00:30 +01:00
IDE: Use InputQuery in SysVarOverrideDialog. Issue #28836, patch from Alexey Torgashin.
git-svn-id: trunk@50105 -
This commit is contained in:
parent
86f922df9a
commit
cc38074466
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5986,7 +5986,6 @@ ide/startlazarus.lpr svneol=native#text/pascal
|
||||
ide/startlazarus.res -text
|
||||
ide/syncolorattribeditor.lfm svneol=native#text/pascal
|
||||
ide/syncolorattribeditor.pas svneol=native#text/pascal
|
||||
ide/sysvaruseroverridedlg.lfm svneol=native#text/plain
|
||||
ide/sysvaruseroverridedlg.pas svneol=native#text/pascal
|
||||
ide/toolbarconfig.lfm svneol=native#text/plain
|
||||
ide/toolbarconfig.pas svneol=native#text/pascal
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
object SysVarUserOverrideDialog: TSysVarUserOverrideDialog
|
||||
Left = 348
|
||||
Height = 145
|
||||
Top = 397
|
||||
Width = 417
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 146
|
||||
ActiveControl = VariableEdit
|
||||
Align = alTop
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'SysVarUserOverrideDialog'
|
||||
ClientHeight = 145
|
||||
ClientWidth = 417
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
object VariableLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 405
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'VariableLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ValueLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 56
|
||||
Width = 405
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'ValueLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ValueEdit: TEdit
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 77
|
||||
Width = 405
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
TabOrder = 1
|
||||
Text = 'ValueEdit'
|
||||
end
|
||||
object VariableEdit: TEdit
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 405
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
TabOrder = 0
|
||||
Text = 'VariableEdit'
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 113
|
||||
Width = 405
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
OKButton.OnClick = OkButtonClick
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.DefaultCaption = True
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 2
|
||||
ShowButtons = [pbOK, pbCancel]
|
||||
ShowBevel = False
|
||||
end
|
||||
end
|
||||
@ -36,69 +36,36 @@ uses
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Controls, Forms, Buttons, StdCtrls, Dialogs,
|
||||
LazarusIDEStrConsts, ButtonPanel, IDEDialogs;
|
||||
|
||||
type
|
||||
{ TSysVarUserOverrideDialog }
|
||||
TSysVarUserOverrideDialog = class(TForm)
|
||||
ButtonPanel: TButtonPanel;
|
||||
VariableLabel: TLabel;
|
||||
VariableEdit: TEdit;
|
||||
ValueLabel: TLabel;
|
||||
ValueEdit: TEdit;
|
||||
procedure OkButtonClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
end;
|
||||
Classes, SysUtils, Controls, Forms, Dialogs,
|
||||
LazarusIDEStrConsts, IDEDialogs;
|
||||
|
||||
function ShowSysVarUserOverrideDialog(var AName, AValue: string): TModalResult;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function ShowSysVarUserOverrideDialog(var AName, AValue: string): TModalResult;
|
||||
var
|
||||
ok: boolean;
|
||||
Vals: array of string;
|
||||
begin
|
||||
with TSysVarUserOverrideDialog.Create(nil) do
|
||||
try
|
||||
VariableEdit.Text:=AName;
|
||||
ValueEdit.Text:=AValue;
|
||||
//if AName=''
|
||||
// then ActiveControl := VariableEdit;
|
||||
Result:=ShowModal;
|
||||
if (Result=mrOk) then begin
|
||||
AName:=Trim(VariableEdit.Text);
|
||||
AValue:=ValueEdit.Text;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
SetLength(Vals, 2);
|
||||
Vals[0]:= AName;
|
||||
Vals[1]:= AValue;
|
||||
|
||||
{ TSysVarUserOverrideDialog }
|
||||
repeat
|
||||
ok:= InputQuery(lisSVUOOverrideSystemVariable,
|
||||
[lisVariable, lisValue], Vals);
|
||||
if not ok then exit(mrCancel);
|
||||
|
||||
procedure TSysVarUserOverrideDialog.OkButtonClick(Sender: TObject);
|
||||
var v: string;
|
||||
begin
|
||||
v:=Trim(VariableEdit.Text);
|
||||
if not IsValidIdent(v) then begin
|
||||
if IDEMessageDialog(lisSVUOInvalidVariableName,
|
||||
Format(lisSVUOisNotAValidIdentifier, [v]),
|
||||
mtWarning,[mbCancel,mbIgnore])=mrCancel
|
||||
then ModalResult := mrNone; //cancel close
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TSysVarUserOverrideDialog.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
||||
Caption:=lisSVUOOverrideSystemVariable;
|
||||
|
||||
VariableLabel.Caption:=lisVariable;
|
||||
ValueLabel.Caption:=lisValue;
|
||||
AName:= Trim(Vals[0]);
|
||||
AValue:= Vals[1];
|
||||
if IsValidIdent(AName) then
|
||||
exit(mrOk)
|
||||
else
|
||||
if IDEMessageDialog(lisSVUOInvalidVariableName,
|
||||
Format(lisSVUOisNotAValidIdentifier, [AName]),
|
||||
mtWarning, [mbCancel, mbIgnore])=mrIgnore then exit(mrOk);
|
||||
until false;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user