检查 MaskedEdit 控件是否包含文本
你好 我正在与 wix 合作创建一个安装。我需要一个自定义对话框来让用户定义端口。该对话框有一个 MaskedEdit 类型的控件,他应该在其中写入端口。连接到控件的属性已定义默认值。问题是,当用户按下下一步按钮时,我想确保端口字段有一个值,否则会向他显示警告。 该控件的代码如下所示:
<Property Id="DataStoragePort">4323</Property>
<Dialog Id="DataStoragePortConfig" Width="370" Height="270" Title="CellaVision DM1 Setup">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Data Storage Configuration" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="DSDescription" Type="Text" X="20" Y="60" Width="250" Height="13" NoPrefix="yes" Text="Enter the port that the Data Storage Service should run on" />
<Control Id="DSPort" Type="Text" X="20" Y="80" Width="20" Height="13" NoPrefix="yes" Text="Port:" />
<Control Id="DSText" Type="MaskedEdit" Text="#####" X="45" Y="78" Width="70" Height="14" Property="DataStoragePort" />
</Dialog>
单击下一个按钮的处理如下所示:
<Publish Dialog="DataStoragePortConfig" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="DataStoragePortConfig" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
但在下一次单击时,我想确保属性 DataStoragePort 不是空字符串。有什么建议吗? 问候 丹尼尔
Hi
I'm working with wix to create an installation. I need a custom dialog to let the user define a port. The dialog have a control that is of type MaskedEdit where he should write the port. The property connected to the control have a default value defined. The problem is that when the user presses the next button, I would like to make sure that the port field have a value or else show him a warning.
The code for the control looks like this:
<Property Id="DataStoragePort">4323</Property>
<Dialog Id="DataStoragePortConfig" Width="370" Height="270" Title="CellaVision DM1 Setup">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Data Storage Configuration" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="DSDescription" Type="Text" X="20" Y="60" Width="250" Height="13" NoPrefix="yes" Text="Enter the port that the Data Storage Service should run on" />
<Control Id="DSPort" Type="Text" X="20" Y="80" Width="20" Height="13" NoPrefix="yes" Text="Port:" />
<Control Id="DSText" Type="MaskedEdit" Text="#####" X="45" Y="78" Width="70" Height="14" Property="DataStoragePort" />
</Dialog>
and the handling of click on the next button look like this:
<Publish Dialog="DataStoragePortConfig" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="DataStoragePortConfig" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
but on the next click I would like to make sure that the property DataStoragePort is not a empty string. Any suggestions?
Regards
Daniel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
空的屏蔽编辑控件将其属性设置为模板字符串,其中包含空格而不是“#”和“?”。例如,如果“文本”设置为“#####”,则空值为
If "Text" is set to "###-###" the empty value is
在您的情况下,您可以使用此条件:
An empty masked edit control sets its property to the template string with spaces instead of "#" and "?". For example, if "Text" is set to "#####" the empty value is
If "Text" is set to "###-###" the empty value is
In your case you can use this condition:
我创建了 VBS 自定义操作来删除空格。
然后,我将该操作添加到对话框上的下一个按钮控件:
Publish Event="DoAction" Value="CA_RemoveSpaces">1"
自定义操作:
CustomAction Id="CA_RemoveSpaces" BinaryKey='CustomActionsScript' 执行='立即' Return='ignore' VBScriptCall="RemoveSpaces" Impersonate="no" />"
I created VBS custom action to remove spaces.
I then added the action to the next button control on the dialog:
Publish Event="DoAction" Value="CA_RemoveSpaces">1"
The custom action:
CustomAction Id="CA_RemoveSpaces" BinaryKey='CustomActionsScript' Execute='immediate' Return='ignore' VBScriptCall="RemoveSpaces" Impersonate="no" />"