添加自定义单选按钮以设置 ALLUSERS 属性 [英] Add custom radio buttons to set ALLUSERS property

查看:34
本文介绍了添加自定义单选按钮以设置 ALLUSERS 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用目标文件夹"对话框中的两个单选按钮将 ALLUSERS 属性设置为当前用户的空白或所有用户的 1.

I would like to be able to set the ALLUSERS property to either blank for current user or 1 for all users using two radio buttons placed in the 'Destination Folder' dialog.

我知道这是为当前用户运行的代码:

I understand that this is the code to run for current user:

<Property Id="AllUSERS" Value="{}"/>

对于所有用户:

<Property Id="AllUSERS" Value="1"/>

我有这个代码来创建自定义单选按钮:

I've got this code to create the custom radio buttons:

<Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property=" VARIABLETOSTORESTATE " Text="This is My Group">
    <RadioButtonGroup Property="VARIABLETOSTORESTATE">
    <RadioButton Value="1" X="0" Y="0" Width="200" Height="10" Text="State 1" />
    <RadioButton Value="2" X="0" Y="20" Width="200" Height="10" Text="State 2" />
    </RadioButtonGroup>
</Control>

但是,我不知道应该把它放在我的 Wix 代码中的什么位置.

However, I don't know where I should put this in my Wix code.

如有任何帮助,将不胜感激.

Any help would be great thanks.

推荐答案

您需要创建自己的对话框窗口,其中将包含单选按钮.这是一个很好的教程:http://wix.tramontana.co.hu/tutorial/user-interface-revisited/a-single-dialog

You need to create your own dialog window which will contain the radio buttons. Here is a good tutorial to start with : http://wix.tramontana.co.hu/tutorial/user-interface-revisited/a-single-dialog

这是一个极简主义的例子.这样,安装程序的 UI 将只包含 1 个带有单选按钮和安装"按钮的对话框:

Here is a minimalist example. With this, the UI of your installer will consist of only 1 dialog with your radio buttons and the button "install":

<UI>
  <Dialog Id="RbDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
    <Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property=" VARIABLETOSTORESTATE " Text="This is My Group">
    <RadioButtonGroup Property="VARIABLETOSTORESTATE">
    <RadioButton Value="1" X="0" Y="0" Width="200" Height="10" Text="State 1" />
    <RadioButton Value="2" X="0" Y="20" Width="200" Height="10" Text="State 2" />
    </RadioButtonGroup>
    </Control>

    <Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
                Default="yes" Text="Install">
      <Publish Event="EndDialog" Value="Return" />
    </Control>
  </Dialog>
  <InstallUISequence>
    <Show Dialog="RbDlg" Before="CostInitialize" />
  </InstallUISequence>
</UI>

当然,您可以在现有的 Wix 对话框集中添加此对话框.也许您已经使用例如:

Of course you can add this dialog in an already existing Wix dialog set. Maybe you already call such an UI using for example :

<UIRef Id="WixUI_Mondo" />

这里有一个很好的介绍:http://www.packtpub.com/article/windows-installer-xml-wix-adding-user-interface

Here is a good introduction : http://www.packtpub.com/article/windows-installer-xml-wix-adding-user-interface

这里有一些提示可以节省您一些时间:在上面的教程中,请注意每个对话框如何使用下一步"和后退"按钮调用另一个对话框:

Here are some hints to save you some time : in the above tutorial, note how each dialog calls another one with the "next" and "back" buttons :

<Publish Dialog="LicenseAgreementDlg" Control="Back" 
      Event="NewDialog" Value="WelcomeDlg">1</Publish> 
<Publish Dialog="LicenseAgreementDlg" Control="Next" 
      Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish> 

在对话框中,您还可以创建下一步"和返回"按钮.Ofc 最后一个对话框有一个完成"按钮而不是下一步".

In your dialog, you can also create "next" and "back" buttons. Ofc the last dialog has a "Finish" button instead of "next".

互联网上有很多关于如何跳过许可协议对话框的示例(例如 这个).这些是关于如何更改安装 UI 顺序的很好的基本示例.如果您能理解此类示例,那么您将有足够的知识将自定义对话框添加到安装 UI 序列中.学起来并不难,而且相当强大.祝你好运!

There are many examples on the internet on how to skip the licence agreement dialog (like this one). Those are good basic examples on how to alter the install UI sequence. If you can understand such examples, then you'll have enough knowledge to add your custom dialog to the install UI sequence. It is not very difficult to learn, and quite powerful. Good luck !

这篇关于添加自定义单选按钮以设置 ALLUSERS 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆