gpt4 book ai didi

wix - 组合框选择属性更改

转载 作者:行者123 更新时间:2023-12-04 05:36:20 25 4
gpt4 key购买 nike

我正在为应用程序编写安装程序。作为其中的一部分,我需要获取用户选择的国家/地区名称。如果用户选择美国,我希望在我的程序中使用值 US,即 2 个字母的代码。

目前我实现了这样的组合框:

<Control Id="CountryList" Type="ComboBox" Sorted="yes" ComboList="yes" Property="COUNTRY" X="30" Y="118" Width="150" Height="15">
<ComboBox Property="COUNTRY">
<ListItem Value="United States" />
<ListItem Value="India" />
<ListItem Value="Australia" />
<ListItem Value="United Kingdom" />
</ComboBox>
</Control>

任何人都可以建议我如何更改属性 COUNTRYUSINUK等我的意思是2个字母的代码。

此外,我必须添加所有可能的国家/地区。有没有更好的方法来实现这一点?

与此相关,我希望第一个组合框列出所有国家/地区。然后第二个组合框可以显示属于该国家/地区的州。 :)

最佳答案

Use the Text attribute for a visible text, and Value attribute for the value被放入ComboBox选择项目时的属性:

<Control Id="CountryList" Type="ComboBox" Sorted="yes" ComboList="yes" Property="COUNTRY" X="30" Y="118" Width="150" Height="15">
<ComboBox Property="COUNTRY">
<ListItem Text="United States" Value="US" />
<ListItem Text="United Kingdom" Value="UK" />
...
</ComboBox>
</Control>

至于你的其他问题:

Also I have to add all possible countries. Any better way to accomplish this?



您可以从 this thread 中获取灵感并添加构建时步骤以生成 <ListItem> 的 XML 片段。元素。

The second combobox can then show the states that belong to the country.



请注意,当组合框中的选定项目发生更改时,无法捕获该事件。这是 MSI UI 的一个众所周知的限制。您可以尝试使用我称为“双对话框”的解决方法来实现您想要的。见 this thread了解更多信息。

关于wix - 组合框选择属性更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11883500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com