MSI对组合框选择进行了排序

MSI对组合框选择进行了排序

本文介绍了MSI对组合框选择进行了排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Installer XML(WiX)工具集版本3.10.2。当我使用具有相似文本的项创建ComboBox时,通过UI进行的选择无法按预期工作。例如,我创建了以下列表:



值|文字

1 | TEXT 10000

2 | TEXT 5000

3 | TEXT 2000

4 |文字1000

5 | TEXT 500

6 |文本100



选择值1,2和3按预期工作。选择值4和6将显示值1的文本。选择值5将显示值2的文本。



我注意到设置Sorted =no没有这种奇怪的行为。但是,这不是我项目的选择。



我缺少什么?



有人提交与WiX团队一起。它被关闭与WiX无关;此行为由MSI和/或Windows控制。但是,没有进一步的解决建议。



我尝试过:



I am using Windows Installer XML (WiX) Toolset version 3.10.2. When I create a ComboBox with items that have similar text, selection through the UI does not work as expected. As an example, I created the following list:

Value | Text
1 | TEXT 10000
2 | TEXT 5000
3 | TEXT 2000
4 | TEXT 1000
5 | TEXT 500
6 | TEXT 100

Selecting values 1, 2, and 3 works as expected. Selecting values 4 and 6 displays the text of value 1. Selecting value 5 displays the text of value 2.

I noticed that setting Sorted="no" does not have this odd behavior. However, that is not an option for my project.

What am I missing?

Someone filed issue #4069 with the WiX team. It was closed as unrelated to WiX; this behavior is controlled by MSI and/or Windows. However, there was no further recommendations for resolution.

What I have tried:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
	<Product Id="*" Name="WiX_ComboBox" Language="1033" Version="1.0.0.0" Manufacturer="Example Company" UpgradeCode="c45d2b80-fc84-48a2-a29c-46e781d26461">
		<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

		<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
		<MediaTemplate />

		<UIRef Id="WixUI_Common"/>
    <UIRef Id="CustomUi"/>
    <UIRef Id="WixUI_ErrorProgressText"/>

    <Property Id="BADCMBVAL1" Value="1" />
	</Product>

  <Fragment>
    <UI>
      <Dialog Id="BadComboBoxDlg" Width="370" Height="270" Title="Bad Combo Box" NoMinimize="yes">
        <Control Id="BadComboBox1" Type="ComboBox" X="100" Y="186" Width="100" Height="16" ComboList="yes" Sorted="yes" Property="BADCMBVAL1">
          <ComboBox Property="BADCMBVAL1">
            <ListItem Value="1" Text="TEXT 10000"/>
            <ListItem Value="2" Text="TEXT 5000"/>
            <ListItem Value="3" Text="TEXT 2000"/>
            <ListItem Value="4" Text="TEXT 1000"/>
            <ListItem Value="5" Text="TEXT 500"/>
            <ListItem Value="6" Text="TEXT 100"/>
          </ComboBox>
        </Control>

        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
      </Dialog>
    </UI>
  </Fragment>

  <Fragment>
    <UI Id="CustomUi">
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
      <Property Id="WixUI_Mode" Value="Mondo" />

      <DialogRef Id="ErrorDlg" />
      <DialogRef Id="FatalError" />
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <DialogRef Id="PrepareDlg" />
      <DialogRef Id="ProgressDlg" />
      <DialogRef Id="ResumeDlg" />
      <DialogRef Id="UserExit" />


      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="BadComboBoxDlg">1</Publish>

      <Publish Dialog="BadComboBoxDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="BadComboBoxDlg" Control="Next" Event="SpawnDialog" Value="CancelDlg">1</Publish>
    </UI>
  </Fragment>
</Wix>

推荐答案

<Control Id="BadComboBox1" Type="ComboBox" X="100" Y="186" Width="100" Height="16" ComboList="yes" Sorted="yes" Property="BADCMBVAL1">
  <ComboBox Property="BADCMBVAL1">
    <ListItem Value="1" Text="TEXT 10000"/>
    <ListItem Value="2" Text="TEXT 5000 "/>
    <ListItem Value="3" Text="TEXT 2000 "/>
    <ListItem Value="4" Text="TEXT 1000 "/>
    <ListItem Value="5" Text="TEXT 500  "/>
    <ListItem Value="6" Text="TEXT 100  "/>
  </ComboBox>
</Control>


这篇关于MSI对组合框选择进行了排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 08:34