在这个用于创建自定义“CreateInputOptionPage”的支持页面上,他们建议通过将页面值分配给变量来存储页面的值。然而,当这项任务发生时,它并不清楚。'
据我所知,如果您在创建页面时正确分配,您将获得默认值。这是有道理的,因为在创建页面时,用户尚未输入任何“输入查询”。
因此,我推断在点击“下一步”按钮时,使用function NextButtonClick(CurPageID: Integer): Boolean;
为了做到这一点,我需要访问Page.Values[0]
函数中的页面变量(NextButtonClick
)。由于Page是在不同的函数中定义的,因此访问这些值以使Page成为全局变量的唯一方法是什么?这就是我决定要做的事情,但我想知道是否有人可以替代全局变量。
到目前为止我的代码存根。
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "O"
#define MyAppVersion "0.0"
#define MyAppPublisher "O."
#define MyAppURL "http://www.o.com/"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{ED5F31B8-32DD-4175-833A-C6D7CBD90DD9}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={sd}\{#MyAppName}
AllowNoIcons=yes
OutputDir={desktop}
OutputBaseFilename=dummy
Compression=lzma
SolidCompression=yes
[code]
var
Page: TInputOptionWizardPage;
InstallationTypeIsClient: boolean;
procedure InitializeWizard();
begin
Page := CreateInputOptionPage(wpWelcome,'Installation Type', 'Select Installation Type', 'No really, do some selecting', True, False)
Page.Add('Server Install');
Page.Add('Client Install');
Page.Values[1] := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID=100 then
begin
InstallationTypeIsClient := Page.Values[1];
MsgBox('InstallationTypeIsClient value is ' + Format('%d', [InstallationTypeIsClient]), mbInformation, MB_OK);
end;
Result := True;
end;
答案 0 :(得分:1)
使用全局变量存储对自定义页面的引用是正确且最简单的方法。
虽然您是否确实需要将用户值存储到另一个变量,这是值得怀疑的。只需在您需要时从自定义页面中读取值。
唯一的另一种方法是递归查找hiregridApp.provider('organizationService', function() {
return {
getOrganization: ['$http', '$location',
function($http, $location) {
$http({
method: 'GET',
url: http: //dev.api.hiregrid.io/api/customer/token/hiregrid',
}).success(function(data) {
$log.log(data);
}).error(function(error, status) {
$routeParams.code = status;
$location.path('/error/' + $routeParams.code);
});
}
]
}, this.$get: ['$http', '$location',
function($http, $location) {
var obj = '';
alert("hai");
obj.getOrganization = function() {
$http({
method: 'GET',
url: 'http://dev.api.hiregrid.io/csbuilder- api/api/csbuilder/hiregrid',
}).success(function(data) {
$log.log(data);
}).error(function(error, status) {
$routeParams.code = status;
$location.path('/error/' + $routeParams.code);
});
return obj;
}
}
];
});
hiregridApp.config(function(organizationServiceProvider) {
console.log(organizationServiceProvider);
organizationServiceProvider.getOrganization("http://dev.api.hiregrid.io");
});
的子控件中的自定义页面。它的代码很多而且效率很低。
有关递归组件迭代的示例,请参阅my answer to Inno Setup: OnHover event。