Inno setup 将值转换为变量

Inno setup 将值转换为变量,inno-setup,pascalscript,Inno Setup,Pascalscript,我有一个我认为很简单的问题,只是我的头脑无法解决它 试图用一个页面编写脚本 一个组合框和一个编辑框 组合框工作正常,我可以根据选择的内容获取它的内容 但是,如果编辑框中的文本被更改,我无法让它更新变量 [Code] var server: string; procedure InitializeWizard; var Edit: TNewEdit; begin server := '127.0.0.1'; Edit := TNewEdit.Create(CustomPage);

我有一个我认为很简单的问题,只是我的头脑无法解决它

试图用一个页面编写脚本

一个组合框和一个编辑框

组合框工作正常,我可以根据选择的内容获取它的内容

但是,如果编辑框中的文本被更改,我无法让它更新变量

[Code]
var

server: string;

procedure InitializeWizard;
var
Edit: TNewEdit;

begin
  server := '127.0.0.1';

  Edit := TNewEdit.Create(CustomPage);
  Edit.Top := DescLabel2.Top + DescLabel2.Height + 6; 
  Edit.Width := CustomPage.SurfaceWidth div 2 - ScaleX(8);
  Edit.Text := server; 
  Edit.Parent := CustomPage.Surface;

我想不出我做错了什么

也许我的一段代码会有帮助:

// The name of the virtual machine
Edit1 := TEdit.Create(WizardForm);
with Edit1 do
 begin
  Parent     := Panel3;
  Left       := ScaleX(Offset);
  Top        := ScaleY(0*LineHeight) + ScaleY(5);
  Width      := ScaleX(145);
  Height     := LineHeight;
  Text       := '';
  ShowHint   := True;
  Hint       := ExpandConstant('{cm:VBoxConfig1Hint}');
  TabOrder   := 0;
  OnExit     := @GetVM_Name;
  OnKeyPress := @CheckEditInput;
 end;
标记OnExit!!你忘了编程了

Procedure GetVM_Name(Sender: TObject);
// Get the machineName
{}
begin
 VirtualMachineName := AddQuotes(Edit1.Text);
end;
为了避免不必要的输入,创建一个on checkinput例程。 例如:

Procedure CheckEditInput(Sender: TObject; var Key: char);
// This procedure checks if the character entered is a wanted one
{} 
begin
 if (Key = '{') or (Key = '}') or (Key = '<') or (Key = '>') then
  begin
   Beep;
   Key := #0;
  end;
 if (Key = '[') or (Key = ']') or (Key = '`') or (Key = '~') then
  begin
   Beep;
   Key := #0;
  end;
 if (Key = '(') or (Key = ')') or (Key = '#') or (Key = '%') or (Key = '*') then
  begin
   Beep;
   Key := #0;
  end;
 if (Key = ';') or (Key = ':') or (Key = ',') or (Key = '?') or (Key = '@') then
  begin
   Beep;
   Key := #0;
  end;
end;
过程CheckEditInput(发送方:TObject;变量键:char);
//此过程检查输入的字符是否为所需字符
{} 
开始
如果(Key='{')或(Key='}')或(Key=''),则
开始
嘟嘟声
键:=#0;
结束;
如果(Key='[')或(Key=']')或(Key=''`')或(Key='~'),则
开始
嘟嘟声
键:=#0;
结束;
如果(Key='(')或(Key=')')或(Key='#')或(Key='%')或(Key='*')),则
开始
嘟嘟声
键:=#0;
结束;
如果(Key=';')或(Key=':')或(Key=',')或(Key='?')或(Key='@'),则
开始
嘟嘟声
键:=#0;
结束;
结束;

对不起,这对我来说毫无意义。你的目标是什么?为什么要使用变量跟踪编辑框文本?您可以在使用该变量之前读取或更新该变量。在当前代码中,您正在创建一个编辑框,并从
服务器
变量中分配一个文本,仅此而已。我希望有一个包含默认IP地址的文本框,但也希望允许对其进行更新。随后,该IP将在脚本中的注册表项中使用。如果有人输入或修改了已经设置好的文本,我似乎无法让它更新。那么,实际上你不需要那个变量。查看原因。完全按照你的要求去做是可能的,但那是错误的。所谓的方法是正确的。哦,在您给出的示例中,您实际上没有附加任何事件来接收更改通知。如果输入['{','}',''''.[',']',''''''.','.'(',')',''.'''.'''.'''.''.''.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.''.'.''.'.'.'.'.''.'.'.''.'.'.'.'-'.'.''.'.'.'.'.'。另外,不需要对
键进行四次求值,我的意思是,您可以从
操作符一次编写它。