2013-05-29 32 views
0

我有一個對話框,讓用戶選擇一個網絡共享與自定義操作的幫助。除非已設置此位置,否則我不希望用戶能夠繼續安裝。爲了達到這個目的,我禁用了PushButton控件,讓用戶進入下一個對話框。我的CustomAction設置在PushButton控件的Condition元素中檢查的屬性。Wix UI如何將焦點從一個PushButton控件更改爲另一個?

這一切都很好。困擾我的是,我希望用戶能夠儘可能輕鬆地瀏覽對話框。這就是爲什麼我做了PushButton控件,它將用戶帶到瀏覽對話框CustomAction,即對話框的Default控件。這也是基於CustomAction設置的屬性的條件。屬性設置完成後,PushButton會將用戶帶到下一個對話框,並將其設置爲默認控件。正如你在截圖中看到的那樣,這實際上是有效的。

有趣的是,對話框的默認控件確實發生了變化,但標籤控件仍然保持打開瀏覽對話框CustomAction的PushButton。這種情況導致不規則的行爲,即當按下Return鍵時,瀏覽對話框再次打開,雖然屬性已被設置,即文件夾路徑已被選擇。 First screen of a sample installer showing the disabled next button. The default and focused Control is the Change PushButton control which brings up a dialog created by a CustomAction. Second screen of a sample installer showing the same Dialog after the user has chosen a folder, i.e. the VIEWDIR property has been set (see code)

有沒有什麼辦法可以解決這個問題?我希望重點根據財產的狀態從一個控制轉移到另一個控制。我會怎麼做?

另外:TabSkip和Default屬性如何結合在一起?

下面是對話的代碼:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Fragment> 
    <CustomActionRef Id="OpenFolderBrowser"/> 
    <UI> 
     <Dialog Id="RemoteViewDirectory" X="0" Y="0" Width="374" Height="266" Title="!(loc.GlobalDialogTitle)" NoMinimize="yes"> 
     <Control Id="TopBanner" Type="Bitmap" X="0" Y="0" Width="374" Height="44" Text="TopBanner" TabSkip="yes" Disabled="yes" /> 
     <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="373" Height="0" TabSkip="yes" Disabled="yes" /> 
     <Control Id="DlgSubTitle" Type="Text" X="13" Y="6" Width="292" Height="25" TabSkip="yes" Transparent="yes"> 
      <Text><![CDATA[{&MSSansBold8}!(loc.VwDrctryDlgSubtitle)]]></Text> 
     </Control> 
     <Control Id="DlgDesc" Type="Text" X="21" Y="23" Width="292" Height="25" TabSkip="yes" Transparent="yes"> 
      <Text><![CDATA[{&Tahoma8}!(loc.VwDrctryDlgDesc)]]></Text> 
     </Control> 
     <Control Id="GroupBox" Type="GroupBox" X="15" Y="174" Width="344" Height="41" TabSkip="yes"> 
      <Text><![CDATA[!(loc.VwDrctryDlgSubtitle)]]></Text> 
     </Control> 
     <Control Id="ChangeRemoteFolder" Type="PushButton" X="285" Y="189" Width="66" Height="17" TabSkip="no"> 
      <Text><![CDATA[!(loc.BtnTextChange)]]></Text> 
      <Condition Action="default"><![CDATA[NOT VIEWDIR]]></Condition> 
      <Publish Event="DoAction" Value="OpenFolderBrowser" Order="1">1</Publish> 
      <Publish Property="VIEWDIR" Value="[REMOTEDIR]" Order="2"><![CDATA[REMOTEDIR]]></Publish> 
      <Publish Property="REMOTEDIR" Order="3">1</Publish> 
     </Control> 
     <Control Id="ChgdLocation" Type="Text" X="57" Y="192" Width="220" Height="20" Property="VIEWDIR" Text="[VIEWDIR]" TabSkip="yes"> 
      <Condition Action="show"><![CDATA[VIEWDIR]]></Condition> 
      <Condition Action="hide"><![CDATA[NOT VIEWDIR]]></Condition> 
     </Control> 
     <Control Id="DummyNetworkLocation" Type="Text" X="57" Y="192" Width="220" Height="20" Text="!(loc.TxtDummyViewNetworkPath)" TabSkip="yes"> 
      <Condition Action="show"><![CDATA[NOT VIEWDIR]]></Condition> 
      <Condition Action="hide"><![CDATA[VIEWDIR]]></Condition> 
     </Control> 
     <Control Id="Back" Type="PushButton" X="164" Y="243" Width="66" Height="16" TabSkip="yes"> 
      <Text>!(loc.BtnTextBack)</Text> 
      <Publish Event="NewDialog" Value="PreviousDialog">1</Publish> 
     </Control> 
     <Control Id="Next" Type="PushButton" X="230" Y="243" Width="66" Height="17" TabSkip="yes"> 
      <Text>!(loc.BtnTextNext)</Text> 
      <Condition Action="enable"><![CDATA[VIEWDIR]]></Condition> 
      <Condition Action="disable"><![CDATA[NOT VIEWDIR]]></Condition> 
      <Condition Action="default"><![CDATA[VIEWDIR]]></Condition> 
      <Publish Event="NewDialog" Value="NextDialog">1</Publish> 
     </Control> 
     <Control Id="Cancel" Type="PushButton" X="301" Y="243" Width="66" Height="17" TabSkip="yes" Cancel="yes"> 
      <Text>!(loc.BtnTextCancel)</Text> 
      <Publish Event="SpawnDialog" Value="CancelSetup">1</Publish> 
     </Control> 
     <Control Id="DlgLine" Type="Line" X="0" Y="234" Width="373" Height="0" TabSkip="yes" Disabled="yes" /> 
     </Dialog> 
    </UI> 
    </Fragment> 
</Wix> 

而且這裏是日誌的Windows安裝程序創建的輸出:

Action 17:36:08: RemoteViewDirectory. Dialog created 
MSI (c) (68:AC) [17:36:09:525]: Doing action: OpenFolderBrowser 
Action 17:36:09: OpenFolderBrowser. 
Action start 17:36:09: OpenFolderBrowser. 
MSI (c) (68:28) [17:36:09:525]: Invoking remote custom action. DLL: C:\...\Temp\MSI9B.tmp, Entrypoint: OpenFolderBrowser 
MSI (c) (68!1C) [17:36:18:608]: PROPERTY CHANGE: Adding \\Win2k3iis6\cmak property. Its value is 'exists'. 
MSI (c) (68!1C) [17:36:18:608]: PROPERTY CHANGE: Adding REMOTEDIR property. Its value is '\\Win2k3iis6\cmak'. 
Action ended 17:36:18: OpenFolderBrowser. Return value 1. 
MSI (c) (68:AC) [17:36:18:638]: PROPERTY CHANGE: Adding VIEWDIR property. Its value is '\\Win2k3iis6\cmak'. 
MSI (c) (68:AC) [17:36:18:638]: PROPERTY CHANGE: Deleting REMOTEDIR property. Its current value is '\\Win2k3iis6\cmak'. 
+0

此行爲在WIX內置對話框中也存在。當我們使用Change按鈕更改InstallDir位置時,我們可以重現它。 – Vinoth

回答

1

我不知道的方式來控制聚焦在MSI用戶界面中。你可以嘗試的一件事是離開下一步按鈕默認但禁用。 可能使Enter鍵導致按下聚焦按鈕(Change按鈕)。這也是一個很好的機會,不會奏效。微星用戶界面在很多方面都相當有限。

要回答第二個問題TabSkip屬性會從選項卡順序中刪除控件。換句話說,在按Tab鍵在控件之間導航時,絕對不應該選擇帶有TabSkip='yes'的控件。 Default屬性指示按Enter鍵時應按下哪個按鈕。

相關問題